Functions & Hooks

loadFont

function loadFont(source: FontSource, family?: string): Promise<string>;

Register one font face under family. Weight and slant come from the font's own OS/2 table, so a family's regular and bold faces register identically and <Text fontWeight> picks between them.

Pass an empty family to file the face under the name inside the font. Resolves to the family name it was filed under.

Registration is process-wide and permanent: the same face registered twice replaces itself rather than stacking.

Parameters

source

FontSource

family?

string = ''

Returns

Promise<string>

On this page