FontFeatures.vb
''
'' This code is part of GrapeCity Documents for PDF samples.
'' Copyright (c) GrapeCity, Inc. All rights reserved.
''
Imports System.IO
Imports System.Drawing
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Text

'' 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 = 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)
        ''
        tl.PerformLayout(true)
        g.DrawTextLayout(tl, New PointF(72, 72))
        ''
        '' Done:
        doc.Save(stream)
        Return doc.Pages.Count
    End Function
End Class