Variable and Color OpenType Fonts

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 and become part of the installed and cached font content

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

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

Color glyph workflow

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, unsupported Porter-Duff modes, opacity, gradients, 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