Font Generation

Namespace: FontGeneration Language: C++ Type: Defold C++ File: fontgen.h Source: engine/font/src/fontgen.h Include: engine/font/src/fontgen.h

Asynchronously generates glyphs and hands them to a caller-owned cache. Glyph insertion and completion callbacks run on the job context owner, or on the caller of FontGenUpdateGlyphs for a batch started with FontGenStartGlyphs. Cache lookup runs while preparing the batch. The caller context must remain valid until the completion callback has run or the job has been cancelled.

API

FFontGenAddGlyph

Type: TYPEDEF Returning FONT_RESULT_OK transfers ownership of the glyph to the callback. For every other result, font_gen retains ownership and frees the glyph.

FFontGenComplete

Type: TYPEDEF Reports completion of a glyph generation batch.

FFontGenIsGlyphCached

Type: TYPEDEF Looks up a glyph in the caller-owned cache.

FontGenCreateJobData

Type: FUNCTION Allocates scratch data for one generation batch.

Parameters

Returns

FontGenDestroyJobData

Type: FUNCTION Batches started with FontGenStartGlyphs cancel and wait for their own jobs. Other batches must already have finished or been canceled by the caller.

Parameters

FontGenIsSupported

Type: FUNCTION Tests whether runtime glyph generation is linked into the engine.

Returns

FontGenParams

Type: STRUCT Runtime glyph generation parameters.

Members

FontGenStartGlyphs

Type: FUNCTION Worker jobs generate glyphs without invoking callbacks. Call FontGenUpdateGlyphs on the resource’s creation thread to install the results. That update can take over queued glyphs, including when the caller occupies the last worker. With no workers it generates all glyphs. The job context must outlive the batch.

Parameters

Returns

FontGenUpdateGlyphs

Type: FUNCTION Generates queued glyphs or consumes finished results without dispatching other jobs or callbacks. Running jobs keep ownership until they finish. The completion callback may destroy the batch. Calls for one batch must be serialized by its owner.

Parameters

Returns