Asking the DOM for layout is like confessing to the police, then asking for leniency.
Layoutmaster computes text layout without reflow — returning exact coordinates, baselines, and paint metadata for every fragment. Tell the DOM where to paint. Don't let it decide.
Ask that too often, too fast, and it thrashes.
Tools like chenglou's pretext help by measuring text without DOM and returning the heights — but that is like asking for the blueprint of a house and getting handed a ruler.
Layoutmaster solves the full layout first, then hands you the job tickets: exact coordinates, baselines, and paint metadata for every fragment. No reflow. Whether you render with HTML, canvas, or WebGL doesn't matter.
It's also blindingly fast — powered by game engine internals, not browser heuristics. Your browser stops thrashing and starts painting.
{ kind, text, x, y, width, height, baselineY, lineIndex, pieceIndex, fontFamily, fontSize, color, … }
— returned by every mantra. The job ticket. You paint it.
npm install @layoutmaster/layoutmaster179 KiB gzip · no WebAssembly · no other dependencies · browser-native font metrics · full bidi support
© 2026 Layoutmaster