Skip to Content

Function: createOpentypeTextMeasurerFromBuffers()

function createOpentypeTextMeasurerFromBuffers(fontBuffers: FontBuffer[], fontMapping?: FontMapping): Promise<OpentypeTextMeasurer | null>;

Create a text measurer from caller-provided font buffers.

This low-level helper is useful when rendering in an environment where fonts are bundled as bytes instead of discovered from the OS. It dynamically imports opentype.js and returns null if no fonts can be parsed or the optional dependency is unavailable.

Parameters

fontBuffers

FontBuffer[]

Font file bytes to parse.

fontMapping?

FontMapping

Optional PPTX font name to replacement font mapping.

Returns

Promise<OpentypeTextMeasurer | null>

A text measurer, or null when setup is not possible.