Skip to content

Centralize macOS font authority - #3389

Merged
breznknecht merged 1 commit into
mainfrom
codex/issue-3306-font-authority
Sep 16, 2026
Merged

breznknecht merged 1 commit into
mainfrom
codex/issue-3306-font-authority

Conversation

@breznknecht

Copy link
Copy Markdown
Collaborator

TL;DR

The macOS frontend now resolves and updates its primary font through one FontManager. The editor view and renderer read the same font metrics and resources across startup, font changes, and backing-scale changes.

Closes #3306

Context

The macOS startup and transition paths previously constructed a primary FontFace in AppDelegate and a second one in FontManager. This required procedural synchronization between application, view, and renderer state. This change makes FontManager the sole mutable authority while leaving GPU resource ownership and the existing frontend row-fit contract intact.

Changes

  • Added an immutable primary-font configuration and explicit transition result to FontManager.
  • Removed the duplicate AppDelegate.fontFace, duplicate startup construction, and EditorNSView primary-font state.
  • Routed family, size, weight, ligature, and scale transitions through the manager before renderer setup and view redraw.
  • Preserved configured fallback families and registered secondary font IDs when the primary is rebuilt.
  • Kept completed and in-flight renderer generations isolated across font configuration epochs.
  • Added transition coverage for primary identity, construction counts, unchanged updates, fallback and secondary rebuilds, native resize ordering, row fitting, mouse hit testing, and IME geometry.

Verification

  • xcodebuild test -project macos/Minga.xcodeproj -scheme Minga -configuration Debug -destination 'platform=macOS' -only-testing:MingaTests/FontManagerTests -only-testing:MingaTests/EditorNSViewResizeTests -only-testing:MingaTests/NativeRenderResourcesTests -only-testing:MingaTests/KeyboardInputTests -only-testing:MingaTests/MouseInputTests -only-testing:MingaTests/ContentViewTests -only-testing:MingaTests/LiveResizeWiringTests: 132 tests in 7 suites passed on final commit 983571190.
  • make lint: passed, including compile, strict Credo, Dialyzer, duplication, and architecture checks.
  • mix protocol.gen --check: passed on the final commit.
  • MINGA_NATIVE_RENDER_SWIFT_CONDITIONS='MINGA_SNAPSHOT_RENDERER MINGA_TRANSCRIPT_ACCOUNTING' scripts/check_native_render_performance: passed all unchanged thresholds with 240 of 240 frames presented, 0 failed or discarded frames, 0 warm allocation count, and 1 maximum in-flight generation. Draw CPU was p50 0.172292 ms, p95 0.25525 ms, and p99 0.32925 ms. GPU was p50 0.290041673 ms and p95 2.863874892 ms.
  • Optimized swiftc -O comparison: candidate startup resolved one primary instead of two. Font and scale changes each added exactly one candidate construction. In both primary-only and fallback/secondary fixtures, 10,000 unchanged updates retained a construction count of one. Single-run timing samples were retained as diagnostic evidence, not as a new performance baseline.
  • Independent focused code review: passed with no findings.
  • Final acceptance review: passed with no blockers, warnings, or suggestions.

Acceptance Criteria Addressed

  1. Startup uses one font owner, and the editor view and renderer derive their primary font and metrics from it. ✅
  2. Font and display-scale changes keep rendering, cursor geometry, hit testing, and IME geometry consistent. ✅
  3. Fallback chains and registered secondary families survive primary rebuilds. ✅
  4. Renderer resources update before redraw, while older in-flight resources retain their lifetime. ✅
  5. Native row fitting and ready/resize values and ordering remain unchanged. ✅
  6. Duplicate primary construction and independently synchronized primary-font state are removed and covered by focused tests and optimized construction evidence. ✅

@breznknecht
breznknecht merged commit 637f13c into main Sep 16, 2026
11 checks passed
@breznknecht
breznknecht deleted the codex/issue-3306-font-authority branch September 16, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS font changes use one resolved font authority

1 participant