FontFeatures.vb
'' 完毕:
Imports System.IO
Imports System.Drawing
Imports GrapeCity.Documents.Pdf
Imports GrapeCity.Documents.Text
Imports GCTEXT = GrapeCity.Documents.Text
Imports GCDRAW = GrapeCity.Documents.Drawing
'' 一些有趣的字体功能的简单演示。
'' 有关字体功能的完整列表,请参阅
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("线路没有自定义字体功能。", tf)
''
tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss03)}
tl.AppendLine("启用字体功能 ss03 的线路。", tf)
''
tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss05)}
tl.AppendLine("启用字体功能 ss05 的线路。", tf)
''
tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss07)}
tl.AppendLine("启用字体功能 ss07 的线路。", tf)
''
tl.PerformLayout(true)
g.DrawTextLayout(tl, New PointF(72, 72))
''
'' 完毕:
doc.Save(stream)
Return doc.Pages.Count
End Function
End Class