@mocanvas/editor · function

registerFontsFromThemes

declare function registerFontsFromThemes(themes: TLThemes): void

Make every font named by a registered theme selectable.

The mirror of registerColorsFromThemes, and it exists for the same reason: the *style prop* is what a shape persists, so a font an app added to a theme is unusable until the prop's value list knows about it — the store would reject font: "pixel" as an invalid enum value.

Union across themes, in first-seen order, so switching theme does not invalidate a shape whose font only the other theme defines. A shape keeps its font when the theme has no stack for it; it just falls back while that theme is current, which is recoverable, whereas dropping the value is not.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.