@mocanvas/editor · function
declare function getFontsFromRichText(editor: TLRichTextFontSource, richText: TiptapNode | null | undefined, initialState: RichTextFontVisitorState): TLFontFace[]Every font face a rich-text document needs, in first-seen order.
Fonts have to be loaded *before* the text is painted, or the shape is measured against a fallback and then reflows when the real face arrives — which on a canvas means every shape below it moves. So the document is walked ahead of render, and this is that walk.
initialState is the base font, from the shape's own font and size
props; marks on the way down override it. An app that has added its own
formatting marks supplies a visitor through options.text.addFontsFromNode
and wraps defaultAddFontsFromNode to keep the built-in behaviour.
Mentioned here
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.