For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Class FontFaceManager
Index
Constructors
Properties
Methods
Constructors
constructor
Parameters
- requestManager: RequestManager
Returns FontFaceManager
Methods
destroy
Returns void
getFontFamily
Finds the font file to draw a codepoint with: each name of the
text-fontstack in turn, and within a name each declared file, until one covers it. A file that fails to load is skipped, the specification asking for unsupported fonts to be ignored.Parameters
- fontStack: string
- codePoint: number
Returns Promise<string | null>
the CSS family to draw with, or
nullto leave the codepoint to theglyphsURL
hasFontFaces
Whether the style declared any font face at all, so that the common case of a style without
font-facescosts nothing.Returns boolean
setFontFaces
Replaces the declared font faces. Nothing is downloaded here: each file waits until a codepoint it covers is actually drawn.
Parameters
OptionalfontFaces: FontFacesSpecification | null
Returns void
Keeps the font files a style declares in its
font-facesproperty, and hands the GlyphManager the CSS family to draw a given codepoint with.The files go to the browser's CSS Font Loading API, so any format it can render text with works. Each is registered under a family name of our own making, so that a style cannot restyle the surrounding page and a codepoint can be pinned to one file rather than to whatever font matching picks.
Rasterizing happens a grapheme cluster at a time, so a letter reaches the browser's text engine with its marks. Shaping across cluster boundaries still needs the RTL text plugin.