GetFontVariationAxes

Text, fonts, variable fonts

Description

Reads the fvar design axes of a TrueType or OpenType CFF2 variable font and returns their user-coordinate ranges as JSON

Syntax

Delphi

Function TPDFlib.GetFontVariationAxes(FontID: Integer; Out AxesJSON: WideString): Integer;

Parameters

FontIDA font handle returned by a TrueType or OpenType font creation or loading API
AxesJSONReceives a JSON array containing each axis tag, localised display name, minimum, default, maximum and hidden state

Return values

Returns the number of axes, or 0 when the handle is invalid, the font has no usable fvar table or its data is malformed; AxesJSON is [] when no axes are returned

JSON format

[{"tag":"wght","name":"Weight","minimum":100,"default":400,"maximum":900,"hidden":false}]

Remarks

Axis values use the design coordinates defined by the font, before normalisation and any avar mapping

TrueType Collection handles inspect the face selected when the font was loaded

See also

CreateTrueTypeFontVariation, CreateOpenTypeFontVariation, AddTrueTypeFont, AddTrueTypeFontFromFile