CreateTrueTypeFontVariation
Text, fonts, variable fonts
Description
Instantiates a TrueType variable font at requested design-axis coordinates and adds the resulting static font to the current document
Syntax
Delphi
Function TPDFlib.CreateTrueTypeFontVariation(FontID: Integer; Const AxisCoordinates: WideString): Integer;Parameters
| FontID | A TrueType variable-font handle returned by a font creation or loading API |
|---|---|
| AxisCoordinates | Comma- or semicolon-separated tag=value pairs such as wght=700,wdth=75; omitted axes use their defaults and values outside a declared range are clamped |
Return values
Returns a positive font handle and selects it on success, or 0 for an invalid handle, unknown or malformed coordinate, unsupported outline format or malformed variation data
Remarks
Coordinate calculations preserve the full Fixed 16.16 range; the supported avar format is version 1 with the required identity mappings at -1, 0, and 1; unsupported versions and malformed glyph or metric-variation records return 0
Sparse IUP interpolation processes each contour in linear time; a single instantiation allows at most 16,777,216 point-and-tuple combinations
The instantiator applies normalized gvar tuples, avar segment maps, HVAR horizontal metrics and MVAR global metrics, including IUP interpolation and composite-glyph transforms
Composite outlines are flattened and emitted as simple glyphs, horizontal metrics and font bounds are rebuilt, stale hinting and device-metric tables are removed, and the output sfnt receives a new checksum
The returned font is a regular static TrueType font that works with drawing, embedding, subsetting, glyph inspection and SaveFontToFile; GetFontVariationAxes returns 0 for it
This API requires glyf outlines; use CreateOpenTypeFontVariation for variable CFF2 fonts
See also
GetFontVariationAxes, CreateOpenTypeFontVariation, SaveFontToFile, GetFontGlyphOutline