Controlled TrueType variable-font instancing

HPDFInstantiateTrueTypeVariableFontControlled in HPDFOpenTypeAdvanced accepts original TrueType variable-font bytes, axis selections, and an optional THPDFVariableFontControl

The existing HPDFInstantiateTrueTypeVariableFont entry remains available and delegates with no explicit control object

Instance engine

The engine resolves gvar tuples and IUP interpolation, simple-glyph points, composite placement, phantom-point metrics, HVAR, VVAR, and MVAR, then rebuilds static glyph data, loca, dependent metrics, and checksums

The resulting hhea.advanceWidthMax uses all final horizontal advances; minLeftSideBearing, minRightSideBearing, and xMaxExtent use glyphs with contours and become zero for an all-empty font

Derived signed header values are range-checked before encoding; an unrepresentable value does not wrap into a misleading signed field

Layout variation references are resolved against the selected coordinates before their shared store is removed, including supported GPOS and BASE references, feature variations, and GPOS lookups embedded in JSTF

JSTF table instancing is separate from choosing justification priorities or applying full paragraph justification in a PDF layout engine; finite table-branch checks do not establish the latter behavior

Resource controls

THPDFVariableFontControl accepts maximum output bytes, cumulative working-admission bytes, and a cancellation callback; internal table, glyph, tuple, metric, layout, checksum, and output-building work uses that same control

Cancellation or a resource rejection leaves the caller's input bytes unchanged and does not return a partial static font; later calls can retry from the original source

The admission counter is conservative allocation accounting rather than exact live-heap accounting; callback checks are checkpoints and do not promise asynchronous interruption between every machine instruction

The low-level engine preserves the original naming contract; the headless wrapper separately gives a static instance its deterministic PostScript name while retaining original notices

See headless variable-font instances and advanced OpenType font workflows