mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 10:13:09 -06:00
Merge branch 'merge-app/fonts' into merge-app/main
This commit is contained in:
@@ -886,6 +886,14 @@ impl FontDb {
|
||||
for face in loaded.iter() {
|
||||
self.add_catalog_face(&face.info, &face.data);
|
||||
}
|
||||
if loaded.is_empty() {
|
||||
// A Windows family name: only the files of its faces, not their whole family.
|
||||
for info in self.legacy_faces(family) {
|
||||
if let Ok(data) = self.catalog.load(&info) {
|
||||
self.add_catalog_face(&info, &data);
|
||||
}
|
||||
}
|
||||
}
|
||||
self.is_loaded(family)
|
||||
}
|
||||
|
||||
@@ -989,7 +997,14 @@ impl FontDb {
|
||||
if self.is_loaded(family) {
|
||||
return true;
|
||||
}
|
||||
self.catalog.family(family).is_some()
|
||||
self.catalog.family(family).is_some() || !self.legacy_faces(family).is_empty()
|
||||
}
|
||||
|
||||
/// The cataloged faces whose Windows family is `family` ("Segoe UI Semibold"): the catalogue
|
||||
/// lists them under their typographic family only.
|
||||
fn legacy_faces(&self, family: &str) -> Vec<craft::font_catalog::FaceInfo> {
|
||||
let key = norm(family);
|
||||
self.catalog.faces().iter().filter(|f| f.legacy_family.as_deref().is_some_and(|lf| norm(lf) == key)).cloned().collect()
|
||||
}
|
||||
|
||||
pub(crate) fn is_loaded(&self, family: &str) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user