@mocanvas/mocanvas · function

defaultAddFontsFromNode

declare function defaultAddFontsFromNode(node: Node | VisitedNode, state: RichTextFontState, addFont: (font: TLFontFace) => void): RichTextFontState

The built-in rich-text font visitor: work out which face a node needs, register it, and pass the resulting state to the node's children.

Bold and italic marks switch weight and style; a code mark switches the whole family to the monospace one, because that is what the mark means. An app that adds a mark of its own wraps this — handle the mark, then delegate — rather than reimplementing the standard cases.

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.