Registering a family changes the process, and cannot be undone
A family registered by one render is registered for every render after it,
on that thread, until the process exits. 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. constFONTS = [{ family:'Brand', paths: ['./fonts/Brand-Regular.ttf'] }] constcanvas = awaitRoot({ width:200, height:100, fonts:FONTS, children: [] }) canvas.release()
Registering the same list on every render is fine and costs nothing beyond
the file read — it is varying it 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.
A font family, and the files that make it up.
Registering a family changes the process, and cannot be undone
A family registered by one render is registered for every render after it, on that thread, until the process exits. 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.
Registering the same list on every render is fine and costs nothing beyond the file read — it is varying it 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 — seecrates/meo-canvas-core/src/resolve.rs, which says the same thing to a Rust caller and has the measurement behind it.