Cheng Lou introduces a library providing text height without DOM calculation in the hot path, manual line routing, and width-tight multiline UI:
Pure JavaScript/TypeScript library for multiline text measurement & layout. Fast, accurate & supports all the languages you didn’t even know about. Allows rendering to DOM, Canvas, SVG and soon, server-side.
Pretext side-steps the need for DOM measurements (e.g.
getBoundingClientRect,offsetHeight), which trigger layout reflow, one of the most expensive operations in the browser. It implements its own text measurement logic, using the browsers’ own font engine as ground truth (very AI-friendly iteration method).
Check out the demos.
Leave a Reply