coretext

Guide glyph-level text layout and drawing with CoreText into CGContexts.

4|1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill coretext
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coretext
Source: https://github.com/AutisticAF/claude-code-apple-dev-plugin/tree/main/skills/coretext
Command: npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill coretext

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

CoreText provides deterministic, high-performance control for shaping, measuring, and drawing text at the glyph level when higher-level text systems are insufficient or too slow. It solves issues around custom multi-line layout, exact glyph positioning, OpenType feature access, caret/hit testing, vertical CJK flow, and PDF or offscreen text rendering where built-in controls do not provide the needed precision.

Core Features & Use Cases

  • Low-level layout primitives and pipeline guidance for CTFramesetter, CTFrame, CTLine, and CTRun to produce glyph arrays, positions, and advances.
  • Exact typographic metrics and font management using CTFont and CTFontDescriptor, including variable font axis control and OpenType feature settings such as small caps and old-style figures.
  • Practical drawing patterns for CGContext-based rendering, PDF generation, coordinate system transforms, truncation strategies, caret positioning, hit testing, and high-performance read-only rendering for thousands of labels.
  • Use Cases: custom text views with bespoke line backgrounds and selection, PDF composition with typographic fidelity, vertical CJK layout, and performance-sensitive label rendering in scrolling lists.

Quick Start

Ask the coretext skill to render an attributed string into a CGPath with CTFramesetter and return glyph positions, typographic metrics, and drawing instructions.

Frequently Asked Questions about coretext

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

FAQPage Schema
How do I get exact glyph positions when drawing text with CTFramesetter in a CGContext?

To get exact glyph positions with CTFramesetter, you process attributed strings through CTFrame, CTLine, and CTRun to extract deterministic glyph arrays, typographic advances, and precise drawing coordinates for your CGContext rendering.

Can I access OpenType features and variable font axes using CTFont?

Yes, CTFont and CTFontDescriptor provide access to OpenType feature settings like small caps and old-style figures, along with variable font axis control for precise typographic metrics in low-level text rendering.

What's the best way to handle vertical CJK layout using CoreText?

Vertical CJK layout using CoreText involves configuring CTFramesetter and CTLine to produce glyph positions and advances that account for vertical flow metrics, returning precise typographic data for accurate graphics context rendering.

Does CoreText support high-performance read-only rendering for thousands of scrolling labels?

CoreText supports high-performance read-only rendering for thousands of scrolling labels by providing deterministic glyph-level layout primitives that bypass higher-level text systems for optimized drawing in graphics contexts.

How do I calculate caret positions and hit testing for custom text views?

Calculating caret positions and hit testing for custom text views uses CTLine and CTRun metrics to determine exact glyph offsets and truncation strategies, providing precise caret offset calculations within your graphics context coordinate system.

Why does my text appear flipped when rendering with CGContext and CoreText?

Text appears flipped in CGContext because CoreText uses a different coordinate system origin, requiring coordinate system transforms to align glyph positions and typographic metrics correctly during PDF generation or offscreen rendering.