mirror of
https://github.com/penpot/penpot.git
synced 2025-07-18 21:47:13 +02:00
🐛 Cache emoji font correctly
This commit is contained in:
parent
79e1c29306
commit
8c20159fb0
3 changed files with 21 additions and 7 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