Merge pull request #97 from denizkoekden/feat/office-fonts-macos

Fonts: read Microsoft Office's bundled fonts on macOS
This commit is contained in:
Brandon Thomas 2026-10-07 22:03:51 -04:00 committed by GitHub
commit 3b8a58fcc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -356,6 +356,13 @@ pub fn system_font_dirs() -> Vec<std::path::PathBuf> {
}
}
}
// Microsoft Office bundles its fonts (Calibri, Cambria, …) inside each app; read them in
// place from the first installed one (they share the same set).
let office = ["Microsoft Word", "Microsoft Excel", "Microsoft PowerPoint", "Microsoft Outlook"]
.iter()
.map(|app| std::path::PathBuf::from(format!("/Applications/{app}.app/Contents/Resources/DFonts")))
.find(|p| p.is_dir());
dirs.extend(office);
} else if cfg!(windows) {
let root = std::env::var_os("WINDIR").map(std::path::PathBuf::from).unwrap_or_else(|| "C:\\Windows".into());
dirs.push(root.join("Fonts"));