pretext

Measure and lay out DOM-free multiline text using canvas metrics.

Updated May 16, 2026
One-click install
npx skills add https://github.com/jaredcroxton/hermes-mirror --skill pretext-jaredcroxton
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pretext
Source: https://github.com/jaredcroxton/hermes-mirror/tree/main/agents/skills/creative/pretext
Command: npx skills add https://github.com/jaredcroxton/hermes-mirror --skill pretext-jaredcroxton

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pretext solves the challenge of measuring and laying out multiline text with precision in the browser without relying on DOM reflow or bounding-box reads, so your visuals can be driven by accurate typography.

Core Features & Use Cases

  • DOM-free measurement & layout: Compute line breaks, per-line widths, and per-grapheme positions from (text, font, width) using canvas measurement.
  • Variable-width streaming for flowing text: Continuously ask pretext for the next line range that fits a corridor width (ideal for text that wraps around moving shapes).
  • Creative primitive for generative demos: Build text-as-geometry effects (kinetic typography, particle shatters, ASCII-from-prose obstacle layouts) where you draw everything from returned layout numbers.
  • Use case: When a user drags an orb across the screen, render paragraphs that actively flow around the orb’s changing silhouette using row-by-row available widths.

Quick Start

Ask Hermes to generate a single-file HTML “pretext demo” where text reflows around a moving obstacle and ships with an immediately visible first-paint style choice.

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 layout multiline text in the browser without DOM reflow?

You can measure text and compute multiline layouts without DOM reflow by using canvas measurement to calculate line breaks, per-line widths, and per-grapheme positions directly. This DOM-free approach avoids bounding-box reads and prevents layout thrash.

Can I flow typography around moving obstacles in a browser canvas?

Yes, you can flow typography around moving obstacles using variable-width streaming, which continuously queries for the next line range that fits a dynamic corridor width. This allows text to actively wrap around changing shapes row-by-row without DOM layout updates.

What is kinetic typography and how do I generate text-as-geometry for generative art?

Kinetic typography and text-as-geometry effects are built by drawing visuals directly from computed layout numbers. You generate multiline text layouts to obtain precise per-grapheme positions, enabling generative art like particle shatters or ASCII-from-prose obstacle layouts.

Does browser canvas text layout work for creating text-based geometry games?

Browser canvas text layout works for text-based geometry games by providing accurate line breaks and per-grapheme positions before rendering. This allows you to draw game elements and obstacles entirely from returned layout numbers without relying on DOM elements.

Why does measuring text for generative art require calculating line breaks before rendering?

Calculating line breaks before rendering is required for generative art to ensure visuals are driven by accurate typography. Knowing exact line widths and per-grapheme positions beforehand lets you draw complex effects like particle shatters without causing DOM layout thrash.