mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
fonts: Use FontInstanceFlags::EMBEDDED_BITMAPS
for color fonts on MacOS (#32203)
This flag ensures that these fonts are rendered full color in WebRender, allowing for full color emoji.
This commit is contained in:
parent
60613e77c5
commit
928214518c
12 changed files with 471 additions and 38 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue