mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-31 07:38:16 +00:00
Merge pull request #1568
Don't warn about macOS hidden system fonts such as .SF NS (#1504)
This commit is contained in:
commit
71c5da07eb
2 files changed
+12
-2
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user