Headless variable-font instances
Use HPDFHeadlessFontInstance to inspect axes and create one complete static OpenType instance from original TrueType or OpenType CFF2 bytes
Coordinates and one-instance ownership
HPDFGetHeadlessFontAxes returns each four-byte axis tag and its minimum, default, and maximum values; THPDFHeadlessFontCoordinates carries selected tag/value pairs
Omitted coordinates use the source default; finite values outside an axis range are clamped to that range; duplicate tags, unknown tags, non-finite values, and more than 64 selections are errors
HPDFInstantiateHeadlessFont returns static font bytes; HPDFInstantiateHeadlessFontBounded additionally accepts an explicit working-admission limit
Each call starts from its supplied original bytes, so requesting defaults after a nondefault instance does not reuse previous variation state
HPDFBuildHeadlessVariableTextAppearance in HPDFHeadlessVariableAppearance creates one instance and passes those same bytes to character mapping, shaping, horizontal advances, outline conversion, and font embedding
Complex shaping retains the existing scale-1000 integer-advance contract and the matching-architecture HarfBuzz and FriBidi dependencies; it does not promise ideal unquantised unitsPerEm advances
Selected-axis style metadata
TrueType and CFF2 instances update existing OS/2.usWeightClass, OS/2.usWidthClass, and post.italicAngle fields from the resolved wght, wdth, and slnt user coordinates. The calculation uses the requested or default values after the headless range clamp, before normalisation and avar mapping
Weight is rounded to an integer and limited to 1–1000. Width percentages are mapped by interpolation between the OpenType width classes, rounded and limited to 1–9. Slant retains its sign and fractional degrees in signed 16.16 format; rounding uses nearest values with halves toward positive infinity
For example, wght=700, wdth=75, and slnt=-12 produce weight class 700, width class 3, and italic angle −12. The generated appearance font descriptor uses the selected angle and its corresponding italic flag
Axes absent from the source leave the corresponding numeric metadata unchanged; missing metadata tables remain absent. The independent ital classification axis is not interpreted as a slant angle
Italic endpoint classification and names
When ital=0 or ital=1 differs from the source default and all other axes remain at their defaults, the static instance updates the italic classification in OS/2.fsSelection and head.macStyle together with the style names. The source family names and Bold style-link bits remain unchanged; numeric weight does not determine the Bold bit
Selecting the italic endpoint clears the Regular bit; selecting the non-italic endpoint clears the italic bits without assuming that the face is the family's Regular style. The existing geometric slant angle remains independent
A complete coordinate match with an authored fvar named instance supplies its typographic subfamily names, preserving their platform, encoding, and language associations. If no target name is available, a deterministic Instance ital=0 or Instance ital=1 label identifies the selected endpoint
Legacy subfamily names use canonical English Regular, Bold, Italic, or Bold Italic labels according to the retained Bold and selected italic bits. Stale localised legacy subfamily records are removed so they cannot describe the opposite style. Authored localised typographic subfamily names remain available, and full names are rebuilt from matching family and target style records; missing English names use the deterministic endpoint label, with HPDF Instance as the final display-family fallback
If the source includes a compatible full name, the static instance replaces it with the new Macintosh full-name records. If either WWS family or WWS subfamily records are present, the instance retains nonempty authored WWS family names, supplies missing canonical English family records, and replaces the WWS subfamily with a numerical label such as Weight 600 Width 5 Italic. The values come from the resulting weight and width classes; Upright identifies the non-italic endpoint. Optical-size and other non-WWS qualifiers in a typographic instance name are not copied into this label
Missing English WWS family records first use a safely encoded author English WWS family, then the English legacy family. If neither is available, the fallback includes a stable hash of the original source font, keeping both endpoints in the same fallback family without grouping unrelated source fonts together. WWS records clear the fsSelection.WWS bit; stale localised WWS subfamily names are removed
The complete default coordinate retains the source style metadata. Intermediate italic coordinates, independent oblique or nonzero slant-axis states, and multi-axis selections outside the STAT-linked profile below retain the existing style behaviour whilst still applying outline and numerical-metadata instancing
STAT-linked weight, width, and design families
Explicit STAT format 3 weight links and format 1/2/3 labels can project changed instances into legacy families, including optical-size and other named design axes. The linked source value is the non-bold member and its linked value is the bold member; no numeric weight threshold or range nominal value determines this relationship
The legacy group uses the link's base weight and selected width and non-WWS design groups. If it matches the source default group, the instance preserves the source legacy family name, keeping the default face and its linked partner together. A different group builds a family from the typographic family plus the non-elidable design, width, and link-base labels, following the author's STAT axis order
For example, a source Probe Light family with a 300 to 600 weight link retains that family at both weights. If width 75 has the label Condensed and precedes weight in STAT order, both weights use Probe Condensed Light; their legacy subfamilies distinguish Regular from Bold, with the italic endpoint adding Italic
A complete authored fvar instance name still takes precedence for the typographic subfamily. Otherwise, selected non-elidable STAT labels form the subfamily in axis order, using the author's elided fallback name when all selected labels are elidable. Existing compatible-full-name and WWS records are synchronised by the same writer
STAT format 2 ranges include their endpoints and use the specified nominal-value exceptions when adjoining ranges or point values meet. Coordinates within the same selected author range remain in the same family group. Contained overlapping ranges defer to the larger range, whilst partially overlapping ranges prefer the higher range
Non-WWS attributes such as Caption or Display enter both legacy and WWS family names, whilst WWS subfamily records retain only numerical weight, width, and posture. When a non-WWS group changes, stale WWS family records are replaced. Within the default group, nonempty author WWS families are preserved; missing English records use an available English WWS name or the projected typographic family and design labels
Multi-axis combination names
STAT format 4 associates an authored name with a combination of axis values. Matching combinations take precedence over their individual axis labels: the most specific combination wins, with source order resolving equal specificity. Disjoint combinations can contribute separate labels, ordered by the lowest axis order within each combination. Elidable combinations cover their axes without adding visible text
Complete authored fvar instance names retain precedence. Otherwise, selected combination labels are preserved as complete names; the library does not split words to infer weight, width, or optical-size meanings. Remaining axes use their individual labels or stable numerical labels such as opsz=72
Legacy and WWS families select their labels at consistent family coordinates so linked styles stay together even when their display names differ. Legacy families use the linked base weight and source default italic state; WWS families use source default weight, width, and italic states. Other design groups remain selected, and named ranges use their nominal coordinate. If no authored label matches the family coordinates, numerical axis labels provide a stable fallback
Weights without explicit style links
A unique, consistent STAT weight link supplies the Regular/Bold relationship. Without such a link, each selected weight uses an independent legacy group instead of retaining stale style names or guessing a Bold threshold. The source default weight keeps its authored Bold role; other independent weights use the non-bold slot of their own family. Typographic names still use exact authored instances, STAT labels, or numerical axis labels
When independent weights are involved, newly generated legacy families include a final wght=value key. This distinguishes two coordinates that share a range label, and keeps a linked pair separate from an independently named default weight. WWS family names omit this weight key because their family model already supports weight variation
Repeated identical links represent one relationship. Conflicting, reverse, or self-referencing links, and links that contradict the source default Bold role, do not supply a style pair. Their affected coordinates use independent groups whilst ordinary font instancing continues
A font without a dynamic weight axis retains its source Bold classification. If it has a static STAT weight axis, its existing OS/2.usWeightClass supplies the coordinate for labels and combination matching. Fonts without a weight axis can still project changed width and other design-axis names. Existing isolated italic endpoint naming is retained
This profile requires usable English family names. Intermediate italic coordinates and independent oblique or slant states still require broader projection policies; fonts are not rejected solely for falling outside this profile
Names, notices, and embedding
The headless instance receives a deterministic HPDFVar- PostScript name. Copyright, licence, and unrelated name records are preserved; the endpoint projection described above replaces the affected style-name records
The appearance path supplies the original font separately to Notice construction, so the embedded CFF 1 Notice retains the original name-table bytes rather than substituting the renamed instance table
The variable appearance entry requires installable or editable outline embedding permission and verifies that the instance has the same embedding flags; it does not use the broader preview-and-print permission policy of every other appearance entry
Limits and cancellation
The font byte limit bounds source and published output; the bounded entry also checks cumulative working-allocation admission and forwards cancellation checks into the CFF2 or TrueType instance engine, whose unit-level counterpart for OpenType CFF2 input is HPDFInstantiateCFF2FontControlled taking the axis values and a THPDFVariableFontControl
The convenience entry uses a 64 MiB working-admission limit; admission is a conservative accounting limit, not a measurement of instantaneous heap usage or a promise that every allocator failure has been injected in tests
Static output retains glyph identity and original embedding authorisation and removes resolved variation state; invalid or unrepresentable output is not returned as a partially valid instance
See controlled TrueType instancing, raw CFF2 with companion tables, and CFF2 appearance conversion