Home
Search

Discussion

Discussion categories

General
Tech

Library

Library pages

Design
Resources
Websites
Articles
Web development
Cool Libraries
Tools
Resources
Papers and Studies
Articles
Language Models
Tech and Systems
Computers
Windows Tools and Modding
Windhawk
Raycast for Windows
Rainmeter
Vintage Computing Festival Berlin 2026
Plasma 6.7
Haiku: BeOS-Inspired Open-Source OS
Random fun stuff
Esoteric File Systems
Cool websites
Friends
Unity - Cheaterman's Bar
ChatGPT
Gentoo is Rice - Humor about Linux Obsession
Storyden
Selfh.st
OpenAlternative
Microlaunch
Peerlist
Glama.ai
AlternativeTo
Brandfetch
Dokploy
PitchHut
Piefed Social
Collections
Links
Members
Roles
RegisterLogin
Login
Library
github-chenglou-pretext

No versions or drafts yet.

GitHub - chenglou/pretext

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).

GitHub - chenglou/pretext

Contribute to chenglou/pretext development by creating an account on GitHub.

github.com