UnicodeRanges.vb
- ''
- '' This code is part of Document Solutions for PDF demos.
- '' Copyright (c) MESCIUS inc. All rights reserved.
- ''
- Imports System.IO
- Imports System.Drawing
- Imports GrapeCity.Documents.Pdf
- Imports GrapeCity.Documents.Text
-
- '' This sample lists Unicode ranges available in each system font.
- public class UnicodeRanges
- Function CreatePDF(ByVal stream As Stream) As Integer
- '' Setup:
- Dim doc = New GcPdfDocument()
- Dim tl = New TextLayout(72) With {
- .MaxWidth = doc.PageSize.Width,
- .MaxHeight = doc.PageSize.Height,
- .MarginAll = 72
- }
- tl.DefaultFormat.FontSize = 7
- Dim tfH = New TextFormat() With {.Font = StandardFonts.TimesBold, .FontSize = 12}
- Dim tfP = New TextFormat() With {.Font = StandardFonts.Times, .FontSize = 11}
-
- '' Loop through all system fonts,
- '' list Unicode ranges provided by each font:
- For Each font In FontCollection.SystemFonts
- tl.AppendLine($"{font.FontFileName} [{font.FullFontName}] [{font.FontFamilyName}]", tfH)
- Dim shot = font.CreateFontTables(TableTag.OS2)
- tl.AppendLine(shot.GetUnicodeRanges(), tfP)
- tl.AppendLine()
- Next
-
- '' Split and render TextLayout as shown in the PaginatedText sample:
- Dim tso = New TextSplitOptions(tl) With {
- .MinLinesInFirstParagraph = 2,
- .MinLinesInLastParagraph = 2
- }
- tl.PerformLayout(True)
- While True
- Dim rest As TextLayout = Nothing
- Dim SplitResult = tl.Split(tso, rest)
- doc.Pages.Add().Graphics.DrawTextLayout(tl, PointF.Empty)
- If SplitResult <> SplitResult.Split Then
- Exit While
- End If
- tl = rest
- End While
- ''
- '' Done:
- doc.Save(stream)
- Return doc.Pages.Count
- End Function
- End Class
-