Don't warn about macOS hidden system fonts such as .SF NS (#1504)

This commit is contained in:
MarekSpodBiedry
2026-10-30 14:59:05 +01:00
parent 3a4e30e10e
commit fe54c0eb3c
2 changed files with 12 additions and 2 deletions
+4 -2
View File
@@ -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<String> {
let db = FontDb::global();
let mut out: Vec<String> = 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);
}
}
+8
View File
@@ -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();