Layout

Pretext: Wie Canvas die Layout-Kunst neu erfindet Pretext: How Canvas reinvents the art of layout

Pretext von Cheng Lou löst ein fundamentales Browser-Problem: Text messen ohne DOM-Reflow. Statt teurer getBoundingClientRect()-Aufrufe nutzt es die Canvas-API für präzises mehrzeiliges Text-Measurement. Das Ergebnis: 19ms für 500 Texte im prepare()-Schritt, danach 0.09ms reines Arithmetik-Layout. Pretext by Cheng Lou solves a fundamental browser problem: measuring text without DOM reflow. Instead of expensive getBoundingClientRect() calls, it uses the Canvas API for precise multiline text measurement. Result: 19ms for 500 texts in prepare(), then 0.09ms pure arithmetic layout.

Weiterlesen →Read more →

Pretext in der Praxis: Virtualisierung, Canvas-Rendering & RTL Pretext in Practice: Virtualization, Canvas Rendering & RTL

Wo bringt Pretext konkret etwas? Virtualisierte Listen ohne Heuristiken, Text der um Objekte fliesst, und vollständige RTL-Unterstützung. Die offiziellen Demos — Masonry, Bubbles, Dynamic Layout, Accordion — zeigen das eindrücklich. Where does Pretext actually help? Virtualized lists without heuristics, text flowing around objects, full RTL support. The official demos — Masonry, Bubbles, Dynamic Layout, Accordion — show it impressively.

Weiterlesen →Read more →

200× schneller: Die Performance-Analyse von Pretext 200× Faster: The Performance Analysis of Pretext

Layout-Reflow ist einer der teuersten Vorgänge im Browser. Pretext umgeht das komplett: prepare() einmal, dann layout() in reiner Arithmetik — bis zu 200× schneller als DOM-Messung. Layout reflow is one of the most expensive browser operations. Pretext bypasses it entirely: prepare() once, then layout() as pure arithmetic — up to 200× faster than DOM measurement.

Weiterlesen →Read more →

How-To: Pretext in 5 Minuten einrichten How-To: Set up Pretext in 5 Minutes

Von npm install bis zur ersten Layout-Berechnung. Eine praktische Schritt-für-Schritt Anleitung mit Code-Beispielen für prepare(), layout() und Canvas-Rendering. Inklusive Erklärung warum Pretext für dein Projekt sinnvoll sein könnte. From npm install to your first layout calculation. A practical step-by-step guide with code examples for prepare(), layout(), and Canvas rendering. Includes an explanation of why Pretext might be right for your project.

Weiterlesen →Read more →