CFF2 color glyph outlines and mixed COLR versions

Version 2.1104.0 adds HPDFGetTrueTypeGlyphOutline for ordinary glyf fonts, sharing the Double command representation below. CFF2 and TrueType outlines also support the conservative complete-root-clip coverage proof for transformed uniform paints

Starting in version 2.1101.0, DrawRegisteredColorGlyph uses CFF2 outline paths directly for COLRv0 layer fills and COLRv1 glyph clips. It does not rely on a system font mapper to interpret a CFF2 glyph as a TrueType glyph

The registered static outline font supplies the geometry, while the original registered color program supplies selected-axis paints when needed. Native paths use the requested position and font size and participate in the existing transforms, clipping, foreground RGBA, transparency groups and completed-glyph caller opacity

Extracting outline commands

THPDFCFF2OutlineCommandKind = (cff2OutlineMoveTo, cff2OutlineLineTo,
  cff2OutlineCurveTo, cff2OutlineClose);

THPDFCFF2OutlineCommand = record
  Kind: THPDFCFF2OutlineCommandKind;
  X1, Y1, X2, Y2, X3, Y3: Double;
end;
THPDFCFF2OutlineCommandArray = array of THPDFCFF2OutlineCommand;

function HPDFGetCFF2GlyphOutline(const FontBytes: TBytes; GlyphID: Word;
  const AxisValues: THPDFVariableFontAxisValueArray;
  out Commands: THPDFCFF2OutlineCommandArray; out UnitsPerEm: Word;
  Control: THPDFVariableFontControl = nil): Boolean;

This HPDFOpenTypeAdvanced function accepts an sfnt containing CFF2, a glyph ID and optional design-space axis selections. It expands subroutines and evaluates blends with the existing CFF2 processor, including axis normalization and avar mapping. Static fonts accept an empty axis selection

Coordinates are absolute font design units with a positive upward Y axis. Move and line commands use X1/Y1, cubic curves use both control points and the final point in X3/Y3, and close commands end a contour without changing the CharString's current point for the following relative move. Scale by the requested font size divided by UnitsPerEm; do not apply an additional CFF 1 default 0.001 matrix

A valid empty glyph returns True, an empty Commands array and the font's UnitsPerEm. Invalid font data, a missing glyph or an invalid axis selection returns False with empty Commands and zero UnitsPerEm. An optional control object retains cancellation, allocation and output checks; its budget or cancellation exceptions remain visible to the caller

The extractor retains the existing finite CharString execution and expanded-output limits. It returns geometry without requiring the FWORD bounds used by static-font metric reconstruction. Static instancing and subsetting continue using their existing metric path

Mixed COLR versions

A version 1 COLR table can contain both legacy base-glyph records and modern paint graphs. Inspection first looks for the requested glyph in the modern BaseGlyphList. If the structurally valid list has no entry for that glyph, the legacy layer records remain eligible. An empty modern list can therefore coexist with usable legacy glyphs

A present modern definition takes precedence over a legacy definition for the same glyph. A malformed or unsupported selected paint graph does not silently select the older definition. Missing required lists, invalid directory extents and unknown table versions remain rejected

The base-glyph directory permits up to 65536 entries independently of the 4096-node and 64-level single-graph limits. A font with 4097 base-glyph entries can therefore expose a small valid graph without raising the individual graph budget

Evidence and scope

A separate isolated-process selected-axis CFF2 source and authoritative static-CFF2 provider pass all 189 checks and 324 reader samples against independently authored TrueType geometry, requiring visible interior ink and a real gradient with zero raster callbacks

Focused outline extraction passes 632 assertions across 59 cases, with all 168 commands matching independent FontTools RecordingPen coordinates exactly. Curves, flex operators, multiple contours, fixed-point coordinates, 11 empty glyphs, coordinates beyond FWORD, selected axes, invalid inputs, non-finite selections and controlled cancellation/budget failures are covered. The original five main and 11 boundary static-font controls also pass, with independent inspection of all 11 boundary outputs

The focused Delphi Win64 mixed-version profile covers 18 source/reference pairs and four invalid-input controls. All 346 checks and 864 MuPDF/Poppler samples pass, with identical sampled colors against independent TrueType references; the preceding source fails 128 checks and 336 samples. Source output is saved before registering its reference font, preventing system font registration from making a blank CFF2 path appear successful

The historical 2.1098.0 CFF2 contour control compared blank source, reference and provider images. Its 324 matching samples do not establish contour painting; the other six runtime pairs and 1944 samples remain separate evidence. Historical CFF2 container-gradient, instancing, metric, subset and headless controls retain their own scope and are not invalidated by that contour-specific finding

This 2.1101.0 profile covers native registered COLR outline fills and clips and the public outline extractor. Ordinary CFF2 text and CID-keyed CFF1 embedding follow in version 2.1102.0; unrestricted real-font compatibility, every reader's precision and the full compiler/platform matrix remain separate

See selected-axis color glyphs, COLR foreground color and alpha and COLRv1 paint graphs