diff options
Diffstat (limited to 'components/gfx/platform/macos/font.rs')
-rw-r--r-- | components/gfx/platform/macos/font.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs index dcb5d08f6a9..7844ecb9089 100644 --- a/components/gfx/platform/macos/font.rs +++ b/components/gfx/platform/macos/font.rs @@ -19,11 +19,12 @@ use core_text::font_descriptor::{ }; use log::debug; use style::values::computed::font::{FontStretch, FontStyle, FontWeight}; +use webrender_api::FontInstanceFlags; use super::core_text_font_cache::CoreTextFontCache; use crate::font::{ map_platform_values_to_style_values, FontMetrics, FontTableMethods, FontTableTag, - FractionalPixel, PlatformFontMethods, GPOS, GSUB, KERN, + FractionalPixel, PlatformFontMethods, CBDT, COLR, GPOS, GSUB, KERN, SBIX, }; use crate::font_cache_thread::FontIdentifier; use crate::font_template::FontTemplateDescriptor; @@ -298,6 +299,18 @@ impl PlatformFontMethods for PlatformFont { let result: Option<CFData> = self.ctfont.get_font_table(tag); result.map(FontTable::wrap) } + + /// Get the necessary [`FontInstanceFlags`]` for this font. + fn webrender_font_instance_flags(&self) -> FontInstanceFlags { + // TODO: Should this also validate these tables? + if self.table_for_tag(COLR).is_some() || + self.table_for_tag(CBDT).is_some() || + self.table_for_tag(SBIX).is_some() + { + return FontInstanceFlags::EMBEDDED_BITMAPS; + } + FontInstanceFlags::empty() + } } pub(super) trait CoreTextFontTraitsMapping { |