Skip to content

Function: setDefaultFontURL() ​

ts
function setDefaultFontURL(url): void;

Experimental

Record the app's default font URL (troika's defaultFontURL, used for every unregistered family) and register it as a CSS FontFace under DEFAULT_FONT_CSS_FAMILY (browsers only), so text is measured with the font that is drawn. configureText calls this; call it directly only when configuring troika yourself. While set, the built-in default font is not used. null forgets it (the built-in default font applies again).

The face is loaded eagerly: document.fonts reports loading meanwhile (charts wait for it), and font-change subscribers are notified when it has loaded.

Parameters ​

ParameterType
urlstring | null

Returns ​

void

Released under the MIT License.