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

FontIDA TrueType variable-font handle returned by a font creation or loading API
AxisCoordinatesComma- 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

The instantiator applies normalised 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