Variable and Color OpenType Fonts

Version 2.1111.0 adds finite concentric radial fields under huge affine transforms, retaining source distance, colorline direction and strictly positive-radius coverage within the documented numerical and reader limits

Version 2.1110.0 adds exact positive-scale sweep normalization while preserving original centers, clipping and transparency capture

Version 2.1109.0 adds finite-root multi-branch affine recovery, preserving original layer/composite scheduling, clip capture positions and finite referenced components

Version 2.1108.0 adds exact dyadic-grid linear-field recovery when the earlier closest-point and axis-intercept representations are unavailable, preserving the original color stops and alpha

Version 2.1107.0 adds general affine field recovery with exact private Double matrices and finite equivalent root linear gradients, keeping the original public authored-transform contract

Version 2.1106.0 restores finite affine gradient coverage through exact contiguous transform composition and proved unchanged linear/sweep parameter fields, retaining original clip and group boundaries

Version 2.1105.0 adds exact source-coordinate and quadratic TrueType outlines, preserving component and curve precision for deep finite uniform-color glyph clipping

Version 2.1104.0 adds portable TrueType design outlines and proved finite COLRv1 root-clip coverage, preserving visible uniform paints under deep finite transforms without a device outline path

Version 2.1102.0 adds ordinary native CFF2 text and portable CFF1 font embedding. Registered names select the frozen font bytes directly; cmap and hmtx supply glyphs and metrics, with per-font BMP/SMP mappings and a CIDFontType0C stream retaining all original glyph slots

Version 2.1101.0 adds native CFF2 contour fills and clips, a public outline-command extractor and per-glyph mixed COLR lookup. A missing modern definition can use legacy layers in a version 1 table; an invalid selected modern graph remains rejected. The directory limit is independent of the single-graph budget

Version 2.1100.0 adds explicit COLR foreground color and alpha through ColorGlyphForegroundColor and ColorGlyphForegroundAlpha, plus THPDFOpenTypeColorForeground overloads for both AtAxes inspection functions. Palette entry 0xFFFF resolves with foreground RGBA before local alpha is quantized; ordinary CPAL entries and the legacy black/255 defaults remain

HotPDF can inspect fvar axes and named instances, validate selected coordinates, and produce a static instance before normal font installation, subsetting, and persistent caching

Variable font workflow

PDF.InspectVariableFont(FontPath, Axes, Instances);
PDF.SetVariableFontAxis('wght', 650);
PDF.RegisterUnicodeTTF(FontPath);

CFF2 OpenType fonts are instantiated internally at default or selected coordinates, including fvar, avar 1.0 and 2.0 mapping, per-font-dictionary vsindex state, blend evaluation, recursive local and global subroutines, and HVAR, VVAR, and MVAR metric deltas

TrueType variable fonts with glyf outlines are instantiated internally for non-default coordinates. The pipeline evaluates shared and private gvar tuples, applies IUP interpolation, updates simple outlines and composite offsets, resolves horizontal and vertical phantom-point metrics, bakes MVAR, rebuilds compact glyph data and loca, and removes variation tables from the checksum-correct static sfnt

OnVariableFontInstance is optional for CFF2 and TrueType variable fonts. It can override a non-default internal instance by returning a valid static sfnt without an fvar table

The resolved coordinates remain available through GetRegisteredVariableFontAxes. Outlines and metrics use the selected static instance; original variable COLR bytes and frozen coordinates can remain separate from the installed and cached outline font, preserving evaluated color precision

Low-level instancing, subsetting, and safety

HPDFIsCFF2Font, HPDFInstantiateCFF2Font, HPDFSubsetCFF2Font, HPDFIsTrueTypeVariableFont, and HPDFInstantiateTrueTypeVariableFont expose byte-array workflows for callers that already manage font containers

Static output preserves glyph IDs and hint programs while rebuilding sfnt tables and checksums. The CFF2 path also preserves per-font-dictionary private data and font matrices

CFF2 instances and subsets rebuild head outline bounds and the aggregate hhea and optional vhea measurements from the final serialized outlines and updated glyph metrics. Cubic extrema use exact comparisons before outward integer rounding; empty glyphs contribute to maximum advances but not to contour bounds, sidebearing minima, or maximum extents

CFF2 static instances resolve VVAR vertical-origin mappings into VORG, preserving the distinction between the default origin and per-glyph exceptions. Drawable glyphs' vmtx top bearings are rebuilt from the final origin minus the final outline maximum Y, including when an origin stays fixed while its outline changes; empty subset slots retain their existing bearings

Version 2.994.17 has finite synthetic CFF2 API acceptance on Delphi Win32/Win64, FPC Win32/Win64 and native x86_64 Linux, with independent checks of fourteen saved fonts per console target. The actual FPC builds were 3.3.1-fa517678 on Win32, 3.3.1-3a45bc79 on Win64 and 3.3.1-20818-ga205e76e12-dirty on Ubuntu under WSL. These controls cover selected instances, subsets, avar version 2, cubic and flex extrema and empty-glyph headers; they do not establish compatibility with arbitrary external fonts or every later compiler build

Malformed offsets, invalid variation structures, excessive subroutine depth, operation limits, and expanded CharString limits fail closed instead of returning a partially instantiated font

For bounded instance engines, see controlled TrueType instancing; the headless variable appearance workflow uses one complete static font for mapping, shaping, metrics, outlines, and embedding

Color glyph workflow

See selected-axis color programs and static outlines for HPDFGetCOLRColorGlyphAtAxes, HPDFGetOpenTypeColorGlyphAtAxes and HPDFInstantiateVariableFontOutlines, including negative radii and selected values outside static color-field encodings

GetRegisteredColorGlyphInfo detects COLR and CPAL layers, SVG glyph documents, CBDT/CBLC strikes, and sbix strikes for a registered font

DrawRegisteredColorGlyph draws COLR v0 layers, bounded COLR v1 paint graphs, restricted safe SVG documents, CBDT PNG images, and sbix PNG or JPEG images natively

COLR v1 supports layered glyph clips, solid and multi-stop linear fills, radial fills, sweep fills, affine transforms, reusable color glyphs, source and destination ordering, and PDF blend composites

The native SVG profile supports paths, rectangles, circles, ellipses, lines, polygons, polylines, inherited solid fills and strokes, affine transforms, and gzip-compressed SVG documents

THPDFColorGlyphRasterizeEvent remains the fallback for unsupported SVG features, strict-profile transparency restrictions and application-specific raster output

THPDFOpenTypeColorGlyphInfo.COLRv1Paints exposes the validated flat DAG through THPDFCOLRv1Paint, THPDFCOLRv1ColorStop, and THPDFCOLRv1Transform records for inspection without reparsing font bytes

Callers choose the palette and target pixel size so strike selection and raster output stay deterministic