pretext

Measure text line breaks, widths, and glyph positions without the DOM.

Updated Jun 17, 2026
One-click install
npx skills add https://github.com/anilcan-kara/nozich-agent --skill pretext-anilcan-kara
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pretext
Source: https://github.com/anilcan-kara/nozich-agent/tree/main/skills/creative/pretext
Command: npx skills add https://github.com/anilcan-kara/nozich-agent --skill pretext-anilcan-kara

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pretext enables DOM-free text measurement and layout in the browser, letting creators generate complex text layouts and typography-driven demos without DOM reflows or heavy frameworks.

Core Features & Use Cases

  • DOM-free measurement: returns line breaks, per-line widths, and per-grapheme positions.
  • Flow around obstacles and kinetic typography: build text hugging moving shapes and dynamic scenes.
  • Single-file demos: produce deployable HTML demos with minimal setup.

Quick Start

Open a demo HTML file, import the pretext API from esm.sh, and feed it your text to generate a flow around an obstacle.

Frequently Asked Questions about pretext

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I measure text width and get glyph positions without triggering DOM reflow?

DOM-free text measurement is handled by the pretext API, which calculates precise line breaks, per-line widths, and per-grapheme positions without triggering DOM reflows, enabling complex text layouts without heavy frameworks.

How can I flow text around shapes for interactive canvas demos?

To flow text around shapes in interactive canvas demos, you feed real prose content into the pretext API to generate layout data. The API measures the text and returns the precise positions needed to render typography hugging moving obstacles in dynamic scenes.

What is DOM-free text measurement and when do I need it for generative art?

DOM-free text measurement is the process of calculating line breaks and glyph positions independently of the browser DOM. You need it for generative art and kinetic typography where text must wrap around shapes or flow in multiple columns without causing layout reflows.

Can I build multi-column editorial layouts without a heavy framework?

Yes, you can build multi-column editorial layouts without heavy frameworks by importing the pretext API from esm.sh. It provides the layout data needed to position text precisely across columns in single-file deployable HTML demos.

What are the limitations of canvas-based text layout for creative coding?

A key limitation is that canvas-based text layout via pretext requires the browser-based API and real prose content to function. It focuses on generating layout data for graphics and demos, meaning it operates independently of standard DOM layout engines.