FontFeatures.vb
  1. ''
  2. '' This code is part of Document Solutions for PDF demos.
  3. '' Copyright (c) MESCIUS inc. All rights reserved.
  4. ''
  5. Imports System.IO
  6. Imports System.Drawing
  7. Imports GrapeCity.Documents.Pdf
  8. Imports GrapeCity.Documents.Text
  9. Imports GCTEXT = GrapeCity.Documents.Text
  10. Imports GCDRAW = GrapeCity.Documents.Drawing
  11.  
  12. '' A simple demonstration of some interesting font features in action.
  13. '' For the complete list of font features see featurelist.htm.
  14. '' See also Ligatures.
  15. Public Class FontFeatures
  16. Function CreatePDF(ByVal stream As Stream) As Integer
  17. Dim doc = New GcPdfDocument()
  18. Dim g = doc.NewPage().Graphics
  19. ''
  20. Dim fnt = GCTEXT.Font.FromFile(Path.Combine("Resources", "Fonts", "Gabriola.ttf"))
  21. Dim tf = New TextFormat() With {.Font = fnt, .FontSize = 20}
  22. ''
  23. Dim tl = g.CreateTextLayout()
  24. tl.AppendLine("Line with no custom font features.", tf)
  25. ''
  26. tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss03)}
  27. tl.AppendLine("Line with font feature ss03 enabled.", tf)
  28. ''
  29. tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss05)}
  30. tl.AppendLine("Line with font feature ss05 enabled.", tf)
  31. ''
  32. tf.FontFeatures = New FontFeature() {New FontFeature(FeatureTag.ss07)}
  33. tl.AppendLine("Line with font feature ss07 enabled.", tf)
  34. ''
  35. tl.PerformLayout(true)
  36. g.DrawTextLayout(tl, New PointF(72, 72))
  37. ''
  38. '' Done:
  39. doc.Save(stream)
  40. Return doc.Pages.Count
  41. End Function
  42. End Class
  43.