'' This code is part of Document Solutions for PDF samples.
'' Copyright (c) MESCIUS inc. All rights reserved.
Imports System.IO
Imports System.Drawing
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Text
Imports GCTEXT = GrapeCity.Documents.Text
Imports GCDRAW = GrapeCity.Documents.Drawing

'' A simple demonstration of some interesting font features in action.
'' For the complete list of font features see featurelist.htm.
'' See also Ligatures.
Public Class FontFeatures
    Function CreatePDF(ByVal stream As Stream) As Integer
        Dim doc = New GcPdfDocument()
        Dim g = doc.NewPage().Graphics
        Dim fnt = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "Gabriola.ttf"))
        Dim tf = New TextFormat() With {.Font = fnt, .FontSize = 20}
        Dim tl = g.CreateTextLayout()
        tl.AppendLine("Line with no custom font features.", tf)
        tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss03)}
        tl.AppendLine("Line with font feature ss03 enabled.", tf)
        tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss05)}
        tl.AppendLine("Line with font feature ss05 enabled.", tf)
        tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss07)}
        tl.AppendLine("Line with font feature ss07 enabled.", tf)
        g.DrawTextLayout(tl, New PointF(72, 72))
        '' Done:
        Return doc.Pages.Count
    End Function
End Class