HPDFShapeHeadlessText
function HPDFShapeHeadlessText(const Text: UnicodeString;
const FontBytes: SysUtils.TBytes; MaximumGlyphs: Integer;
CancellationToken: THPDFCancellationToken;
MaximumLineAdvance: Double = 0; CharacterAdvance: Double = 0;
WordAdvance: Double = 0): THPDFHeadlessShapedGlyphs;
Uses a caller-supplied OpenType font through HarfBuzz and resolves Unicode visual runs through FriBidi, retaining clusters and positioning in 1000-unit font coordinates
CR/LF paragraphs are shaped independently; a positive MaximumLineAdvance requests logical cluster wrapping before the final shaping pass
Automatic physical lines inherit the original complete paragraph's directional embeddings, overrides, isolates and paired brackets; each line has its own whitespace reset, visual reorder and HarfBuzz joining context
The paragraph order is resolved once and reused without mutation across physical lines; an actual CR/LF separator starts a new paragraph and resets control state
When automatic wrapping changes the text, SourceOffset remains relative to the normalized wrapped logical sequence, including inserted U+000A line breaks and the existing removal of a break space; glyph UnicodeText, field values and PDF ActualText preserve their established logical contracts
CharacterAdvance and WordAdvance are optional finite advances in the same 1000-unit font coordinates; character advance applies once per shaped cluster, including the final cluster, except for clusters containing only Unicode directional controls, and word advance applies to a U+0020 cluster, with both included in logical wrapping and the returned glyph advances
Input and generated glyphs, including inserted line-break records, are bounded by the same total MaximumGlyphs; malformed surrogates and missing required glyphs fail, and cancellation is checked between paragraphs, runs, cached line resolution and wrapping checkpoints
Linux uses libharfbuzz.so.0 and libfribidi.so.0; Windows requires matching-architecture libraries, with explicit paths optionally supplied by HOTPDF_HARFBUZZ_LIBRARY and HOTPDF_FRIBIDI_LIBRARY
For PDF font permissions, CID objects, ToUnicode, appearance links, and incremental output, use HPDFBuildHeadlessTextAppearance or a document appearance method
Windows native complex text describes matching process architectures and runtime dependency search paths
Use HPDFShapeHeadlessTextSpan to shape a selected style item with surrounding paragraph context, and HPDFResolveHeadlessTextOrder to inspect actual Unicode visual positions