Pretext is a pure JavaScript/TypeScript library for multiline text measurement and layout that avoids DOM reflows by using the browser's font engine directly.
It offers APIs like prepare() and layout() to compute paragraph height, line count, and manual line layouts without DOM interaction, supporting all languages, emojis, and mixed-bidi text. Install via npm install @chenglou/pretext; demos available online.