HPDFBuildHeadlessTextAppearance

function HPDFBuildHeadlessTextAppearance(const Text: UnicodeString;
  const TrueTypeFont: SysUtils.TBytes; FirstObjectNumber: Integer;
  const Options: THPDFHeadlessTextAppearanceOptions): THPDFHeadlessTextAppearance;

Builds a real Unicode Form XObject and its font objects using the shared HotPDF parser, object classes, cmap reader, actual TrueType advance and descriptor metadata and optional HarfBuzz/FriBidi shaping

The returned bundle owns seven consecutive objects starting at a positive FirstObjectNumber; use the document appearance method for object registration, field links, encryption and bounded incremental output

The font requires named TrueType glyf/loca outlines, a consistent sfnt signature and head magic, ordered bounded glyph offsets and a complete valid Unicode cmap contained inside its declared table extent

Unicode lookup does not fall back to Symbol or MacRoman mappings; missing glyphs are rejected instead of replaced with a visually unrelated glyph

Supported text is direct horizontal Latin, Greek, Cyrillic, simple CJK, precomposed Hangul, selected mathematical symbols and isolated emoji when the supplied font contains each scalar

Multiline CR/LF layout, measured wrapping, comb cells, quarter-turn rotations and rectangular or circular borders are controlled by the options record

With ShapeComplexText enabled, complex scripts, combining sequences, bidi and ligatures use native HarfBuzz shaping and FriBidi run ordering; malformed surrogates, unsupported control characters, missing glyphs, invalid font permissions and exhausted budgets remain errors

Complex glyphs receive individual positioning including shaping offsets, cluster-aware ToUnicode mappings and marked-content ActualText retaining the logical source; readers may use their own annotation text extraction order

Linux loads libharfbuzz.so.0 and libfribidi.so.0; Windows requires matching-architecture libharfbuzz-0.dll and libfribidi-0.dll, with optional explicit paths through HOTPDF_HARFBUZZ_LIBRARY and HOTPDF_FRIBIDI_LIBRARY

Full original font bytes are embedded with their actual PostScript name, bounds, ascent, descent, italic angle and fixed-pitch flag; cap height uses OS/2 when available and otherwise the hhea ascender, whilst StemV uses a conservative fixed descriptor estimate

Installable or editable embedding is required; no-subsetting is honoured by full embedding, and restricted, preview-and-print, bitmap-only, absent or unknown embedding permissions are rejected

The builder checks font bytes, glyph count, stream and dictionary sizes, scalar validity and cancellation before returning an owned bundle

Refer to THPDFHeadlessTextAppearanceOptions, THPDFHeadlessTextAppearance and SetTextFieldValueWithAppearance

OpenType CFF 1 fonts are supported through the compact font appearance backend, preserving the full font, actual CID mapping, Unicode text, widths and embedding policy