@mocanvas/mocanvas · function

renderTextToCanvas

declare function renderTextToCanvas(spec: TextTextureSpec): HTMLCanvasElement

Draw the label onto a canvas covering the whole width × height box, so the engine's uv 0..1 quad over the shape's local bounds lands pixel-for-pixel. Throws where there is no document (Node, SSR) — callers keep the DOM path.

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.