mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 00:17:20 +02:00
Merge pull request #6652 from penpot/elenatorro-fix-load-fonts
🐛 Fix fonts initialization
This commit is contained in:
commit
d008ea9edd
5 changed files with 67 additions and 54 deletions
|
@ -66,7 +66,7 @@ impl FontStore {
|
|||
is_emoji: bool,
|
||||
is_fallback: bool,
|
||||
) -> Result<(), String> {
|
||||
if self.has_family(&family) {
|
||||
if self.has_family(&family, is_emoji) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
@ -92,9 +92,14 @@ impl FontStore {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn has_family(&self, family: &FontFamily) -> bool {
|
||||
let serialized = format!("{}", family);
|
||||
self.font_provider.family_names().any(|x| x == serialized)
|
||||
pub fn has_family(&self, family: &FontFamily, is_emoji: bool) -> bool {
|
||||
let alias = format!("{}", family);
|
||||
let font_name = if is_emoji {
|
||||
DEFAULT_EMOJI_FONT
|
||||
} else {
|
||||
alias.as_str()
|
||||
};
|
||||
self.font_provider.family_names().any(|x| x == font_name)
|
||||
}
|
||||
|
||||
pub fn get_fallback(&self) -> &HashSet<String> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue