diff --git a/crates/engine/src/fonts.rs b/crates/engine/src/fonts.rs index 5d5449bb..e208f72c 100644 --- a/crates/engine/src/fonts.rs +++ b/crates/engine/src/fonts.rs @@ -22,12 +22,14 @@ pub fn install_embedded_fonts(p: &Presentation) { } /// The font families the slides' text is drawn in (theme fonts resolved, bullet fonts included) -/// that aren't installed or bundled, sorted, without duplicates (case-insensitive). +/// that aren't installed or bundled, sorted, without duplicates (case-insensitive). Names that +/// start with a dot are macOS hidden system fonts (`.SF NS`); they never appear in a font list +/// and can't be installed, so they aren't reported. pub fn missing_fonts(p: &Presentation) -> Vec { let db = FontDb::global(); let mut out: Vec = Vec::new(); for family in used_fonts(p) { - if !db.has_family(&family) && !out.iter().any(|f| f.eq_ignore_ascii_case(&family)) { + if !family.starts_with('.') && !db.has_family(&family) && !out.iter().any(|f| f.eq_ignore_ascii_case(&family)) { out.push(family); } } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 38832a7f..49fdbc27 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -1425,6 +1425,14 @@ fn opening_a_file_lists_the_fonts_it_uses_that_are_missing() { assert!(s.doc().unwrap().missing_fonts.is_empty()); } +#[test] +fn a_macos_hidden_system_font_is_not_reported_missing() { + let mut s = Session::with_new(); + let r = s.execute("file.openBytes", &json!({"name": "a.pptx", "data": deck_in_font(".SF NS")})).unwrap(); + assert_eq!(r["missingFonts"], json!([])); + assert!(s.doc().unwrap().missing_fonts.is_empty()); +} + #[test] fn an_embedded_face_is_used_when_the_machine_lacks_it() { let mut p = deckcraft_model::Presentation::default();