mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
fonts: Make fast shaping determination platform-independent (#33540)
This makes the determination of whether or not to use fast shaping platform independent. Previously it was less stringent for Windows, leading to using it in cases where a font had a GSUB or GPOS table -- which broke proper shaping. In addition, the test is made platform independent and expanded to be more complete. Finally, comments are added indicating that "fast shaping" will be removed. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
6f797709cf
commit
64f32f7ab3
6 changed files with 129 additions and 116 deletions
|
@ -26,7 +26,7 @@ use super::core_text_font_cache::CoreTextFontCache;
|
|||
use crate::{
|
||||
map_platform_values_to_style_values, FontIdentifier, FontMetrics, FontTableMethods,
|
||||
FontTableTag, FontTemplateDescriptor, FractionalPixel, GlyphId, PlatformFontMethods, CBDT,
|
||||
COLR, GPOS, GSUB, KERN, SBIX,
|
||||
COLR, KERN, SBIX,
|
||||
};
|
||||
|
||||
const KERN_PAIR_LEN: usize = 6;
|
||||
|
@ -59,7 +59,6 @@ pub struct PlatformFont {
|
|||
/// data stays alive of the lifetime of this struct.
|
||||
_data: Arc<Vec<u8>>,
|
||||
h_kern_subtable: Option<CachedKernTable>,
|
||||
can_do_fast_shaping: bool,
|
||||
}
|
||||
|
||||
// From https://developer.apple.com/documentation/coretext:
|
||||
|
@ -189,12 +188,8 @@ impl PlatformFontMethods for PlatformFont {
|
|||
_data: data,
|
||||
ctfont: core_text_font.clone_with_font_size(size),
|
||||
h_kern_subtable: None,
|
||||
can_do_fast_shaping: false,
|
||||
};
|
||||
handle.h_kern_subtable = handle.find_h_kern_subtable();
|
||||
handle.can_do_fast_shaping = handle.h_kern_subtable.is_some() &&
|
||||
handle.table_for_tag(GPOS).is_none() &&
|
||||
handle.table_for_tag(GSUB).is_none();
|
||||
Ok(handle)
|
||||
}
|
||||
|
||||
|
@ -239,10 +234,6 @@ impl PlatformFontMethods for PlatformFont {
|
|||
0.0
|
||||
}
|
||||
|
||||
fn can_do_fast_shaping(&self) -> bool {
|
||||
self.can_do_fast_shaping
|
||||
}
|
||||
|
||||
fn glyph_h_advance(&self, glyph: GlyphId) -> Option<FractionalPixel> {
|
||||
let glyphs = [glyph as CGGlyph];
|
||||
let advance = unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue