meo-canvas
    Preparing search index...

    Interface FontRegistration

    A font family, and the files that make it up.

    Registering a family changes the thread, and cannot be undone

    A family registered by one render is registered for every render after it, on that thread, for as long as the thread runs. Nothing unregisters anything, passing different files under the same name replaces what that name draws from then on, and a render that names a family it never registered will use whatever an earlier one left behind rather than failing.

    That last part is the one to leave with, because it is not an error a log will show: it is the wrong typeface in a picture nobody looks at twice. A server that registers per request, one tenant's face at a time, is a server where the next request quietly renders in the previous tenant's font.

    // Register once, where the process starts.
    const FONTS = [{ family: 'Brand', paths: ['./fonts/Brand-Regular.ttf'] }]
    const canvas = await Root({ width: 200, height: 100, fonts: FONTS, children: [] })
    canvas.release()

    Naming the same list on every render is the pattern to follow. A file whose bytes this thread already holds under that family adds no face, so memory does not grow with the number of renders and the GPU draws every render with the same face. It is varying the list that is the hazard. Faces belong at start-up, named once, and every render after that names the same ones.

    Each worker thread is its own process for this purpose: they do not share a registry, so each has to register its own faces, and each is contaminated only by itself. Two renders already in flight keep their own faces.

    The registry lives in meo-skia-canvas, below the addon, and neither surface can scope it — see crates/meo-canvas-core/src/resolve.rs, which says the same thing to a Rust caller and has the measurement behind it.

    interface FontRegistration {
        family: string;
        paths: readonly string[];
    }
    Index
    family: string

    The name fontFamily refers to. Any name may be chosen; it need not match the file.

    paths: readonly string[]

    Paths to the font files of that family — one per weight or style.