FontFeatures.vb
C# VB
'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.IOImports System.DrawingImports GrapeCity.Documents.PdfImports GrapeCity.Documents.TextImports GCTEXT = 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 As GCTEXT.Font Dim fpath = Path.Combine("Resources", "Fonts", "Gabriola.ttf") If File.Exists(fpath) Then fnt = GCTEXT.Font.FromFile(fpath) Else fnt = FontCollection.SystemFonts.FindFamilyName("Gabriola") End If 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 FunctionEnd Class