From 01e393d774542b23e19b60ca8ff722693ce9386b Mon Sep 17 00:00:00 2001 From: Chad Brokaw Date: Wed, 22 May 2024 17:44:24 +0200 Subject: [PATCH] check self.fonts_id in select_font() Forces a reset after we push a specialized font stack for an emoji cluster --- src/shape.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shape.rs b/src/shape.rs index 66a1036..1b30492 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -10,6 +10,8 @@ use super::style::{Brush, FontFeature, FontVariation}; use crate::util::nearly_eq; #[cfg(feature = "std")] use crate::Font; +#[cfg(feature = "std")] +use fontique::QueryFamily; use fontique::{self, Attributes, Query, QueryFont}; use swash::shape::*; #[cfg(feature = "std")] @@ -211,10 +213,9 @@ impl<'a, 'b, B: Brush> partition::Selector for FontSelector<'a, 'b, B> { type SelectedFont = SelectedFont; fn select_font(&mut self, cluster: &mut CharCluster) -> Option { - use fontique::QueryFamily; let style_index = cluster.user_data() as u16; let is_emoji = cluster.info().is_emoji(); - if style_index != self.style_index || is_emoji { + if style_index != self.style_index || is_emoji || self.fonts_id.is_none() { self.style_index = style_index; let style = &self.styles[style_index as usize].style; let fonts_id = style.font_stack.id();