Skip to content

fontique: enumerate macOS system fonts via CTFontManagerCopyAvailableFontURLs - #2

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1785890375-coretext-font-urls
Open

fontique: enumerate macOS system fonts via CTFontManagerCopyAvailableFontURLs#2
nicoburns wants to merge 1 commit into
mainfrom
devin/1785890375-coretext-font-urls

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Summary

Speeds up system font enumeration in the CoreText backend on macOS. scan_system_fonts() previously did CTFontCollection::from_available_fonts()matching_font_descriptors() → per-descriptor kCTFontURLAttribute lookup, which materializes a font descriptor for every face just to recover file URLs. On macOS this is replaced with CTFontManagerCopyAvailableFontURLs() (already exposed by objc2-core-text behind the CTFontManager feature), which returns the font file URLs directly.

The enumeration is factored into system_font_files() -> Option<HashSet<PathBuf>>:

  • #[cfg(target_os = "macos")]: CTFontManagerCopyAvailableFontURLs → POSIX paths → dedupe.
  • #[cfg(not(target_os = "macos"))] (iOS etc.): the previous descriptor-based path, unchanged — CTFontManagerCopyAvailableFontURLs is macOS-only and referencing it on other Apple targets would fail to link.

Behavior is otherwise unchanged: paths are deduped into a HashSet<PathBuf>, still extended with library_font_files() (Apple hides SFNS.ttf etc. from these APIs), and scan_system_fonts() still returns None on failure/empty so the caller falls back.

Deliberately narrow: parallel scanning and caching are being done separately.

Verified with cargo check/clippy -p fontique --features system for aarch64-apple-darwin and aarch64-apple-ios, plus cargo fmt --check.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/5893bf8aee24455699895691e86d1c32
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 5, 2026
@staging-devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant