mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
Use Tag
type from font-types crate to represent opentype tags (#38870)
The `font-types` crate is the tiny type-only base crate of `fontations`. This uses a strongly typed representation of open type tags, and allows us to remove our custom macro for creating them. --------- Signed-off-by: Nico Burns <nico@nicoburns.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
0a8146143a
commit
1fc857865f
5 changed files with 31 additions and 57 deletions
|
@ -18,15 +18,15 @@ use core_text::font_descriptor::{
|
|||
};
|
||||
use euclid::default::{Point2D, Rect, Size2D};
|
||||
use log::debug;
|
||||
use skrifa::Tag;
|
||||
use style::values::computed::font::{FontStretch, FontStyle, FontWeight};
|
||||
use webrender_api::{FontInstanceFlags, FontVariation};
|
||||
|
||||
use super::core_text_font_cache::CoreTextFontCache;
|
||||
use super::font_list::LocalFontIdentifier;
|
||||
use crate::{
|
||||
CBDT, COLR, FontData, FontIdentifier, FontMetrics, FontTableMethods, FontTableTag,
|
||||
FontTemplateDescriptor, FractionalPixel, GlyphId, KERN, PlatformFontMethods, SBIX,
|
||||
map_platform_values_to_style_values,
|
||||
CBDT, COLR, FontData, FontIdentifier, FontMetrics, FontTableMethods, FontTemplateDescriptor,
|
||||
FractionalPixel, GlyphId, KERN, PlatformFontMethods, SBIX, map_platform_values_to_style_values,
|
||||
};
|
||||
|
||||
const KERN_PAIR_LEN: usize = 6;
|
||||
|
@ -346,8 +346,9 @@ impl PlatformFontMethods for PlatformFont {
|
|||
metrics
|
||||
}
|
||||
|
||||
fn table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> {
|
||||
let result: Option<CFData> = self.ctfont.get_font_table(tag);
|
||||
fn table_for_tag(&self, tag: Tag) -> Option<FontTable> {
|
||||
let tag_u32 = u32::from_be_bytes(tag.to_be_bytes());
|
||||
let result: Option<CFData> = self.ctfont.get_font_table(tag_u32);
|
||||
result.map(FontTable::wrap)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue