pretext

Measure multiline text height and line layout without DOM reflow.

40|9|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/akillness/jeo-skills --skill pretext-akillness
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pretext
Source: https://github.com/akillness/jeo-skills/tree/main/.agent-skills/pretext
Command: npx skills add https://github.com/akillness/jeo-skills --skill pretext-akillness

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fast multiline text measurement and layout without DOM reflow; enables precise heights, line counts, and per-line rendering for canvas, SVG, or DOM contexts in JavaScript/TypeScript.

Core Features & Use Cases

  • Fast height measurement for paragraphs with cached font metrics
  • Per-line layout for manual rendering around images or custom flows
  • Works with DOM, Canvas, and SVG targets; supports options (whiteSpace, wordBreak, letterSpacing) and Intl.Segmenter

Quick Start

Install the pretext package and run a simple example to measure text heights for a given container.

Frequently Asked Questions about pretext

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

FAQPage Schema
How do I measure multiline text height in JavaScript without causing DOM reflow?

You can measure multiline text height without DOM reflow using a pure JavaScript API that calculates precise heights and line counts via cached font metrics and Canvas 2D measurement, avoiding layout thrashing entirely.

Can I do per-line text layout for Canvas or SVG rendering manually?

Yes, per-line text layout is supported for manual rendering in Canvas or SVG. The API provides per-line access, allowing you to render text around custom flows or images by calculating exact line breaks and bounds.

Does this text measurement API work in Node.js and modern browsers?

The text measurement API works in both modern browsers and Node.js. It requires Intl.Segmenter support for locale-aware segmentation and utilizes Canvas 2D measurement to function across these environments.

What is the best way to handle locale-aware text segmentation and soft hyphenation in TypeScript?

The best way to handle locale-aware segmentation and soft hyphenation is using an API built on Intl.Segmenter. It accurately segments text across different fonts and locales while applying soft hyphenation rules.

What text layout options are supported for controlling word breaks and spacing?

Supported text layout options include whiteSpace, wordBreak, and letterSpacing. These options integrate with Intl.Segmenter to provide precise control over how multiline text is measured and flowed.