Font Fallback and Vertical Text
HotPDF can select fallback faces by Unicode script, report code points that remain unresolved, and write CJK text through a real vertical CID writing mode
Document-level fallback chains
THotPDF.SetFontFallbackChain stores an ordered face list for one THPDFFontScript category
THPDFPage.TextOutWithFallback resolves each Unicode scalar against the selected face, its script chain, and the common chain, then emits adjacent scalars with the same face as one text run
- Fallback chains are document settings and remain available across pages
- Duplicate and empty face names are removed while the caller's order is preserved
- Installed-face probing rejects silent GDI substitution before accepting coverage
- Supplementary-plane scalars are decoded from UTF-16 surrogate pairs before classification
- Each fallback run uses the existing embedded Type0 font, subsetting,
ToUnicode, and shared cross-page font path
Actionable diagnostics
AnalyzeUnresolvedGlyphs performs a read-only coverage audit, while TextOutWithFallback records unresolved scalars encountered during output
Each THPDFUnresolvedGlyphInfo includes the scalar code point, primary face, classified script, and a semicolon-separated fallback suggestion list
GetUnresolvedGlyphs returns the current document report and ClearUnresolvedGlyphs starts a new reporting interval
Vertical CJK writing
THPDFPage.TextOutVertical selects the current face's vertical variant and emits one Identity-V text run rather than positioning every character manually
- The CID descendant font contains
/DW2defaults and glyph-specific/W2entries - When present, OpenType
vheaandvmtxsupply vertical advances andVORGsupplies vertical origins - Fonts without vertical tables use configurable 1000-unit advance and 880-unit origin defaults
- Existing
vert,vrt2, and vertical GPOS features remain available throughShapingFeatures GetVerticalTextAdvancereturns the user-space advance needed to position the next vertical run
Example
PDF.SetFontFallbackChain(hfsCJK,
['Microsoft YaHei UI', 'Yu Gothic UI', 'Malgun Gothic']);
PDF.SetFontFallbackChain(hfsEmoji, ['Segoe UI Emoji']);
PDF.CurrentPage.SetFont('Arial', [], 12);
PDF.CurrentPage.TextOutWithFallback(72, 72, 0, Text);
PDF.CurrentPage.SetFont('Yu Gothic UI', [], 14);
PDF.CurrentPage.TextOutVertical(420, 72, VerticalText);
Missing := PDF.GetUnresolvedGlyphs;