by PromptSpace
High-performance browser-based text layout and measurement for virtualization, canvas, and layout-heavy applications.
Free
One-time purchase
Prepared handle cached for "Hello World". Height: 48px at 200px width. Line 1: "Hello " (0-6) Line 2: "World" (6-11) Performance: <0.1ms layout time. Verified against document.fonts.ready status.
by PromptSpace
High-performance browser-based text layout and measurement for virtualization, canvas, and layout-heavy applications.
Free
One-time purchase
⚡ Skill ready to install in Claude Code, Gemini CLI, or any MCP-compatible client. Read the install guides →
Prepared handle cached for "Hello World". Height: 48px at 200px width. Line 1: "Hello " (0-6) Line 2: "World" (6-11) Performance: <0.1ms layout time. Verified against document.fonts.ready status.
The Pretext Layout skill enables AI agents to integrate and debug high-performance multiline text measurement using the @chenglou/pretext library. It solves the common frontend performance bottleneck of "layout thrashing" by replacing slow DOM-based height probes with a fast, browser-native API approach.
This skill provides developers with a structured methodology for measuring text width and height without repeated DOM reflows. It supports high-level block height calculation for virtualization and low-level line-by-line geometry for custom Canvas or SVG rendering workflows. It handles complex edge cases including web fonts, emoji, and bidirectional text.
While a general AI can write basic JavaScript, this skill understands the specific lifecycle of the Pretext library—such as partitioning the expensive "prepare" phase from the lightweight "layout" phase. It ensures your agent correctly manages browser-only runtime constraints, font loading promises, and locale-specific white-space behaviors to prevent layout shifts and flickering.
• Requires a browser environment or OffscreenCanvas; no native Node.js support. • Does not support complex CSS properties like 'float', 'flex', or 'letter-spacing'.
mkdir -p ~/.claude/skills/pretext-layout && curl -s -X POST 'https://api.promptspace.in/api/skills/pretext-layout/install' | python3 -c "import sys,json; sys.stdout.write(json.load(sys.stdin).get('installInstructions') or '')" > ~/.claude/skills/pretext-layout/SKILL.mdFree skills install directly. Paid skills require purchase - use the download button above after buying.
Security Scanned
Passed automated security review
No special permissions declared or detected
OpenClaw, Cursor, Claude Code, Codex CLI
PromptSpace
We build AI agent skill packages for content creators. Specializing in Chinese social media automation.