📰 2026-03-30 03:00 更新
🔸 Pretext: TypeScript library for multiline text measurement and layout / Pretext :用于多行文本测量和布局的TypeScript库
🔗 Pretext: TypeScript library for multiline text measurement and layout
🔥 66 points
原文:
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…
译文:
纯JavaScript/TypeScript库,用于多行文本测量和布局。快速、准确,并支持您甚至不知道的所有语言。允许渲染到DOM、Canvas、SVG ,并很快渲染到服务器端。Pretext避免了对DOM测量(例如getBoundingClientRect、offsetHeight )的需求,这会触发布局重排,这是浏览器中最昂贵的操作之一。它实现了自己的文本测量逻辑,使用BRO wsers自己的字体引擎作为地面真相(非常AI…
自动更新 · 正文抓取 · 双语翻译