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.