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

Keeps the font files a style declares in its font-faces property, 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.

Index

Constructors

Properties

requestManager: RequestManager

Methods

  • Returns void

  • Finds the font file to draw a codepoint with: each name of the text-font stack 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 null to leave the codepoint to the glyphs URL

  • Whether the style declared any font face at all, so that the common case of a style without font-faces costs nothing.

    Returns boolean

  • Replaces the declared font faces. Nothing is downloaded here: each file waits until a codepoint it covers is actually drawn.

    Parameters

    Returns void

Was this helpful?