Variable: fonts
ts
const fonts: object;The font registry as one namespace (plan E8.3, Holochart.fonts): register a family's faces, registerFace one file, resolve a CSS family list to a registered face, list the registered families, or clear the registry.
Type Declaration
| Name | Type | Default value |
|---|---|---|
clear() | () => void | clearFontRegistry |
families() | () => string[] | registeredFontFamilies |
register() | (family, faces, options) => () => void | registerFontFamily |
registerFace() | (face, options) => () => void | registerFont |
resolve() | (family, weight?, style?) => ResolvedFontFace | undefined | resolveFontFace |
Example
ts
fonts.register('Inter', { regular: '/fonts/Inter.woff', bold: '/fonts/Inter-Bold.woff' });
fonts.resolve('"Brand", Inter, sans-serif', 'bold')?.url; // '/fonts/Inter-Bold.woff'