Fonts: read Microsoft Office's bundled fonts on macOS

This commit is contained in:
Deniz Kökden 2026-10-07 21:23:57 +02:00
parent f17397c305
commit 2a3b3e6661
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"));