Skip to content

Function: loadDefaultFontFaces() ​

ts
function loadDefaultFontFaces(requests, options?): Promise<void> | null;

Experimental

Load the built-in default font faces that draw these requests and have not loaded yet (the regular face for plain text, bold or italic only when requested). Returns a promise that resolves once they have loaded (or failed: text then draws with troika's default font, and the error is logged once), or null when nothing needs loading. Each face is loaded once, and its load includes its CSS FontFace for the metrics oracle, so text measured afterwards uses it.

Parameters ​

ParameterType
requestsIterable<TextFontRequest>
optionsLoadDefaultFontFacesOptions

Returns ​

Promise<void> | null

Released under the MIT License.