We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c929a7 commit 10cdb86Copy full SHA for 10cdb86
src/typography.rs
@@ -450,6 +450,15 @@ impl FontLibrary{
450
}
451
452
fn add_typeface(&mut self, font:Typeface, alias:Option<String>){
453
+ // replace any previously added font with the same metadata/alias
454
+ if let Some(idx) = self.fonts.iter().position(|(old_font, old_alias)|
455
+ match alias.is_some(){
456
+ true => old_alias == &alias,
457
+ false => old_font.family_name() == font.family_name()
458
+ } && old_font.font_style() == font.font_style()
459
+ ){
460
+ self.fonts.remove(idx);
461
+ }
462
self.fonts.push((font, alias));
463
464
let mut assets = TypefaceFontProvider::new();
0 commit comments