Tagged articles
5 articles
Page 1 of 1
Frontend AI Walk
Frontend AI Walk
Apr 8, 2026 · Frontend Development

Mastering Pretext: A Practical Frontend Guide for Precise Text Measurement

This article explains how the open‑source Pretext library enables fast, accurate multi‑line text measurement and layout in pure JavaScript/TypeScript, outlines the problems it solves, lists ideal front‑end scenarios, provides step‑by‑step API usage, and warns when the library should be avoided.

JavaScriptPretextVirtualization
0 likes · 12 min read
Mastering Pretext: A Practical Frontend Guide for Precise Text Measurement
Node.js Tech Stack
Node.js Tech Stack
Apr 1, 2026 · Frontend Development

How a Former React Core Engineer’s Pretext Library Solves a 30‑Year‑Old Browser Text Layout Problem

Front‑end developers struggle to measure text height without rendering, causing performance issues in virtual scrolling, chat bubbles, and masonry layouts, but the TypeScript‑based Pretext library bypasses the DOM, uses Canvas measureText, and delivers order‑of‑magnitude speedups while offering line‑level layout APIs.

JavaScriptPretextTypeScript
0 likes · 10 min read
How a Former React Core Engineer’s Pretext Library Solves a 30‑Year‑Old Browser Text Layout Problem
AI Architecture Path
AI Architecture Path
Apr 1, 2026 · Frontend Development

How Pretext Eliminates DOM Reflows for Ultra‑Fast Text Measurement

Pretext, a zero‑DOM, high‑performance text measurement engine created by React core contributor chenglou, uses Canvas‑based calculations and a two‑stage prepare/layout workflow to avoid layout reflows, delivering up to 500× speed gains for virtual scrolling, rich‑text rendering, and AI‑driven UI layout predictions.

Performance OptimizationPretexttext measurement
0 likes · 7 min read
How Pretext Eliminates DOM Reflows for Ultra‑Fast Text Measurement
AI Insight Log
AI Insight Log
Mar 30, 2026 · Frontend Development

How Pure Math Eliminates DOM Layout Thrashing and Solves AI UI Lag

Pretext, a TypeScript library by React core contributor Cheng Lou, replaces costly DOM‑based text measurement with pure‑math calculations, cutting layout reflows from hundreds to zero and reducing measurement time from 30 ms to 0.05 ms, enabling precise UI layouts for AI‑driven interfaces.

AI UIPretextTypeScript
0 likes · 7 min read
How Pure Math Eliminates DOM Layout Thrashing and Solves AI UI Lag
Kuaishou Frontend Engineering
Kuaishou Frontend Engineering
Sep 26, 2023 · Mobile Development

Why Text Gets Cut Off in React Native – Android Measurement Deep Dive & Fixes

This article analyzes the long‑standing React Native text‑truncation issue, explains Android’s text‑measurement architecture—including Spanned, TextPaint, Layout and TextLine—examines two common truncation cases, provides concrete fixes, and proposes a runtime monitoring solution to detect and log such problems.

AndroidReact NativeText Truncation
0 likes · 24 min read
Why Text Gets Cut Off in React Native – Android Measurement Deep Dive & Fixes