Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/usvg/src/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl FontResolver<'_> {
pub fn default_fallback_selector() -> FallbackSelectionFn<'static> {
Box::new(|c, exclude_fonts, fontdb| {
let base_font_id = exclude_fonts[0];
let base_face = fontdb.face(base_font_id)?;

// Iterate over fonts and check if any of them support the specified char.
for face in fontdb.faces() {
Expand All @@ -170,7 +171,6 @@ impl FontResolver<'_> {
}

// Check that the new face has the same style.
let base_face = fontdb.face(base_font_id)?;
if base_face.style != face.style
&& base_face.weight != face.weight
&& base_face.stretch != face.stretch
Expand All @@ -192,7 +192,7 @@ impl FontResolver<'_> {
.families
.iter()
.find(|f| f.1 == fontdb::Language::English_UnitedStates)
.unwrap_or(&base_face.families[0]);
.unwrap_or(&face.families[0]);

log::warn!("Fallback from {} to {}.", base_family.0, new_family.0);
return Some(face.id);
Expand Down
Loading