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 whilst 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 - Fallback layout checks installed font families with the requested bold and italic face, preserves all font style, charset, size, and writing-direction settings across runs, and restores the caller's font afterwards
Actionable diagnostics
AnalyzeUnresolvedGlyphs performs a read-only coverage audit, whilst 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
The explicit-style overloads of THotPDF.ResolveFontForCodePoint and THotPDF.AnalyzeUnresolvedGlyphs accept TFontStyles so preflight can inspect the same face used for output; their original overloads continue to inspect regular faces
Text boxes, SVG embedded text, and loaded text appearances retain styled font families through fallback layout, rather than treating PDF internal font names as system families or switching every run to a regular face
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 originsVORGsupplies the authoritative CFF origin defaults and exceptions - Fonts without vertical tables use configurable 1000-unit advance and 880-unit origin defaults
- With
sfVerticalAlternates, the complete length-preserving GSUB run usesvrt2when advertised and otherwise falls back tovert, preserving the active script and language selection - When a font omits a punctuation substitution but maps Unicode vertical presentation forms, commas, stops, brackets, dashes, ellipses, and related punctuation use those glyphs while
ToUnicodepreserves the source text - 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;