CreateOpenTypeFontVariation
Text, fonts, variable fonts
Description
Instantiates an OpenType CFF2 variable font at requested design-axis coordinates and adds the resulting static CFF font to the current document
Syntax
Delphi
Function TPDFlib.CreateOpenTypeFontVariation(FontID: Integer; Const AxisCoordinates: WideString): Integer;Parameters
| FontID | A CFF2 variable-font handle returned by an OpenType 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, non-CFF2 font, unknown or malformed coordinate, unsupported CFF2 structure or malformed variation data
Remarks
The instantiator evaluates vsindex and blend against the CFF2 variation store, expands local and global subroutines, applies HVAR horizontal metrics and supported MVAR global metrics, and synchronises common style axes
The output is a checksum-correct CID-keyed CFF1 OpenType font with static charstrings and metrics; stale variation, hint-program and signature tables are removed
CharString recursion, operand stack usage, operation count, INDEX sizes and output size are bounded before allocation, so malformed input fails without returning a partial font
The returned font works with drawing, embedding, CFF subsetting and SaveFontToFile; GetFontVariationAxes returns 0 for it
Loading a CFF2 font directly selects its default static instance while retaining the original variable program for later calls to this API
Use CreateTrueTypeFontVariation for variable fonts that use glyf outlines
See also
GetFontVariationAxes, CreateTrueTypeFontVariation, AddOpenTypeFontFromFile, SaveFontToFile