axiom-typography-ref

6
1
Source

Apple platform typography reference (San Francisco fonts, text styles, Dynamic Type, tracking, leading, internationalization) through iOS 26

Install

mkdir -p .claude/skills/axiom-typography-ref && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4365" && unzip -o skill.zip -d .claude/skills/axiom-typography-ref && rm skill.zip

Installs to .claude/skills/axiom-typography-ref

About this skill

Typography Reference

Complete reference for typography on Apple platforms including San Francisco font system, text styles, Dynamic Type, tracking, leading, and internationalization through iOS 26.

San Francisco Font System

Font Families

SF Pro and SF Pro Rounded (iOS, iPadOS, macOS, tvOS)

  • Main system fonts for most UI elements
  • Rounded variant for friendly, approachable interfaces (e.g., Reminders app)

SF Compact and SF Compact Rounded (watchOS, narrow columns)

  • Optimized for constrained spaces and small sizes
  • watchOS default system font

SF Mono (Code environments, monospaced text)

  • Monospaced font for code editors and technical content
  • Consistent character widths for alignment

New York (Serif system font)

  • Serif alternative for editorial content
  • Works with text styles just like SF Pro

Variable Font Axes

Weight Axis (9 weights)

  • Ultralight, Thin, Light, Regular, Medium, Semibold, Bold, Heavy, Black
  • Continuous weight spectrum via variable fonts
  • Avoid light weights at small sizes (legibility issues)

Width Axis (WWDC 2022)

  • Condensed — narrowest width
  • Compressed — narrow width
  • Regular — standard width (default)
  • Expanded — wide width

Access via:

// iOS/macOS
let descriptor = UIFontDescriptor(fontAttributes: [
    .family: "SF Pro",
    kCTFontWidthTrait: 1.0 // 1.0 = Expanded
])

SF Arabic (WWDC 2022)

  • Matches SF Pro design language for Arabic text
  • Proper right-to-left support

Optical Sizes

Variable fonts automatically adjust optical size based on point size:

  • Text variant (< 20pt) — more spacing, sturdier strokes
  • Display variant (≥ 20pt) — tighter spacing, refined details
  • Smooth transition (17-28pt) with variable SF Pro

From WWDC 2020:

"TextKit 2 abstracts away glyph handling to provide a consistent experience for international text."

Text Styles & Dynamic Type

System Text Styles

Text StyleDefault Size (iOS)Use Case
.largeTitle34ptPrimary page headings
.title28ptSecondary headings
.title222ptTertiary headings
.title320ptQuaternary headings
.headline17pt (Semibold)Emphasized body text
.body17ptPrimary body text
.callout16ptSecondary body text
.subheadline15ptTertiary body text
.footnote13ptFootnotes, captions
.caption12ptSmall annotations
.caption211ptSmallest annotations

Font Size Guidance

  • Avoid .caption2 for readable content — at 11pt, it's acceptable for timestamps and metadata annotations but too small for body text or labels users need to read. Prefer .caption or .footnote as the minimum for readable content.

Emphasized Text Styles

Apply .bold symbolic trait to get emphasized variants:

// UIKit
let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .title1)
let boldDescriptor = descriptor.withSymbolicTraits(.traitBold)!
let font = UIFont(descriptor: boldDescriptor, size: 0)

// SwiftUI
Text("Bold Title")
    .font(.title.bold())

Actual weights by text style:

  • Some styles map to medium
  • Others map to semibold, bold, or heavy
  • Depends on semantic hierarchy

Leading Variants

Tight Leading (reduces line height by 2pt on iOS, 1pt on watchOS):

// UIKit
let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body)
let tightDescriptor = descriptor.withSymbolicTraits(.traitTightLeading)!

// SwiftUI
Text("Compact text")
    .font(.body.leading(.tight))

Loose Leading (increases line height by 2pt on iOS, 1pt on watchOS):

// SwiftUI
Text("Spacious paragraph")
    .font(.body.leading(.loose))

Dynamic Type

Automatic Scaling (iOS): Text styles scale automatically based on user preferences from Settings → Display & Brightness → Text Size.

Custom Fonts with Dynamic Type:

// UIKit - UIFontMetrics
let customFont = UIFont(name: "Avenir-Medium", size: 34)!
let bodyMetrics = UIFontMetrics(forTextStyle: .body)
let scaledFont = bodyMetrics.scaledFont(for: customFont)

// Also scale constants
let spacing = bodyMetrics.scaledValue(for: 20.0)
// SwiftUI - .font(.custom(_:relativeTo:))
Text("Custom scaled text")
    .font(.custom("Avenir-Medium", size: 34, relativeTo: .body))

// @ScaledMetric for values
@ScaledMetric(relativeTo: .body) var padding: CGFloat = 20

Platform Differences

macOS

  • No Dynamic Type support in AppKit
  • Text style sizes optimized for macOS control sizes
  • Catalyst apps use iOS sizes × 77% (legacy) or macOS-optimized sizes ("Optimize Interface for Mac")

watchOS

  • Smaller text styles optimized for watch faces
  • Tight leading default for compact displays

visionOS

  • System fonts work identically to iOS
  • Dynamic Type support included

Tracking & Leading

Tracking (Letter Spacing)

Tracking adjusts space between letters. Essential for optical size behavior.

Size-Specific Tracking Tables:

SF Pro includes tracking values that vary by point size to maintain optimal spacing:

  • Larger sizes: tighter tracking
  • Smaller sizes: looser tracking

Example from Apple Design Resources:

  • 34pt (largeTitle): +0.016 tracking
  • 17pt (body): +0.008 tracking
  • 11pt (caption2): +0.06 tracking

Tight Tracking API (for fitting text):

// UIKit
textView.allowsDefaultTightening(for: .byTruncatingTail)

// SwiftUI
Text("Long text that needs to fit")
    .lineLimit(1)
    .minimumScaleFactor(0.5) // Allows tight tracking

Manual Tracking:

// UIKit
let attributes: [NSAttributedString.Key: Any] = [
    .font: UIFont.preferredFont(forTextStyle: .body),
    .kern: 2.0 // 2pt tracking
]

// SwiftUI
Text("Tracked text")
    .tracking(2.0)
    .kerning(2.0) // Alternative API

Important: Use .tracking() not .kerning() API for semantic correctness. Tracking disables ligatures when necessary; kerning does not.

Leading (Line Spacing)

Default Line Height: Calculated from font's built-in metrics (ascender + descender + line gap).

Language-Aware Adjustments: iOS 17+ automatically increases line height for scripts with tall ascenders/descenders:

  • Arabic
  • Thai, Lao
  • Hindi, Bengali, Telugu

From WWDC 2023:

"Automatic line height adjustment for scripts with variable heights"

Manual Leading:

// UIKit
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 8.0 // 8pt additional space

// SwiftUI (iOS 13+)
Text("Custom spacing")
    .lineSpacing(8.0)

Line Height (iOS 26+):

.lineHeight() sets baseline-to-baseline distance directly — more intuitive than .lineSpacing() (which measures bottom-to-top).

// Presets
Text("Open layout").lineHeight(.loose)
Text("Compact layout").lineHeight(.tight)

// Precise control
Text("Scaled").lineHeight(.multiple(factor: 1.5))
Text("Fixed").lineHeight(.exact(points: 30)) // Does NOT scale with Dynamic Type

Also available as AttributedString.lineHeight for styled strings. See axiom-swiftui-26-ref for full API details.

Third-Party Font Tracking

New in iOS 18: Font vendors can embed tracking tables in custom fonts using STAT table + CTFont optical size attribute.

let attributes: [String: Any] = [
    kCTFontOpticalSizeAttribute as String: pointSize
]
let descriptor = CTFontDescriptorCreateWithAttributes(attributes as CFDictionary)
let font = CTFontCreateWithFontDescriptor(descriptor, pointSize, nil)

SwiftUI AttributedString Typography

Font Environment Interaction

Critical Pattern When using AttributedString with SwiftUI's Text, paragraph styles (like lineHeightMultiple) can be lost if fonts come from the environment instead of the attributed content.

From WWDC 2025-280:

"TextEditor substitutes the default value calculated from the environment for any AttributedStringKeys with a value of nil."

This same principle applies to Text—when your AttributedString doesn't specify a font, SwiftUI applies the environment font, which can cause it to rebuild text runs and drop or normalize paragraph style details.

The Problem

// ❌ WRONG - .font() modifier can override and drop paragraph styles
var s = AttributedString(longString)

// Set paragraph style
var p = AttributedString.ParagraphStyle()
p.lineHeightMultiple = 0.92
s.paragraphStyle = p
// ⚠️ No font set in AttributedString

Text(s)
    .font(.body) // ⚠️ May rebuild runs, lose lineHeightMultiple

Why this fails:

  1. AttributedString has no font attribute set (value is nil)
  2. SwiftUI's .font(.body) modifier tells it "use this font for the whole run"
  3. SwiftUI rebuilds text runs with the environment font
  4. Paragraph styles get dropped or normalized during rebuild

The Solution

Keep typography inside the AttributedString when you need fine control:

// ✅ CORRECT - Font in AttributedString, no environment override
var s = AttributedString(longString)

// Set font INSIDE the attributed content
s.font = .system(.body) // ✅ Typography inside AttributedString

// Set paragraph style
var p = AttributedString.ParagraphStyle()
p.lineHeightMultiple = 0.92
s.paragraphStyle = p

Text(s) // ✅ No .font() modifier

Why this works:

  1. Font is part of the attributed content (not nil)
  2. No environment override from .font() modifier
  3. SwiftUI preserves both font AND paragraph styles
  4. Text runs remain intact with all attributes

When to Use Each Approach

Use Font in AttributedString (Fine Control)

var s = AttributedString("Carefully styled text")
s.font = .system(.body)

var p = AttributedString.ParagraphStyle()
p.lineHeightMultiple = 0.92
p.alignment = .leading
s.paragraphStyle = p

Text(s) // No modifier

When to use:

  • Need precise paragraph styling (line height, alignment)
  • Mixing multiple fo

Content truncated.

axiom-swiftui-nav-diag

CharlesWiltgen

Use when debugging navigation not responding, unexpected pops, deep links showing wrong screen, state lost on tab switch or background, crashes in navigationDestination, or any SwiftUI navigation failure - systematic diagnostics with production crisis defense

54

axiom-swiftui-26-ref

CharlesWiltgen

Use when implementing iOS 26 SwiftUI features - covers Liquid Glass design system, performance improvements, @Animatable macro, 3D spatial layout, scene bridging, WebView/WebPage, AttributedString rich text editing, drag and drop enhancements, and visionOS integration for iOS 26+

33

axiom-extensions-widgets-ref

CharlesWiltgen

Use when implementing widgets, Live Activities, Control Center controls, or app extensions - comprehensive API reference for WidgetKit, ActivityKit, App Groups, and extension lifecycle for iOS 14+

13

axiom-ios-build

CharlesWiltgen

Use when ANY iOS build fails, test crashes, Xcode misbehaves, or environment issue occurs before debugging code. Covers build failures, compilation errors, dependency conflicts, simulator problems, environment-first diagnostics.

253

axiom-camera-capture-ref

CharlesWiltgen

Reference — AVCaptureSession, AVCapturePhotoSettings, AVCapturePhotoOutput, RotationCoordinator, photoQualityPrioritization, deferred processing, AVCaptureMovieFileOutput, session presets, capture device APIs

42

coreml

CharlesWiltgen

Use when deploying custom ML models on-device, converting PyTorch models, compressing models, implementing LLM inference, or optimizing CoreML performance. Covers model conversion, compression, stateful models, KV-cache, multi-function models, MLTensor.

42

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

1,6881,430

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

1,2721,337

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

1,5451,153

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

1,359809

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

1,268732

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

1,496685