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
|
@ -26,7 +26,7 @@ use winapi::shared::minwindef::{BOOL, FALSE};
|
|||
|
||||
use super::font_list::LocalFontIdentifier;
|
||||
use crate::{
|
||||
FontData, FontIdentifier, FontMetrics, FontTableMethods, FontTableTag, FontTemplateDescriptor,
|
||||
FontData, FontIdentifier, FontMetrics, FontTableMethods, FontTemplateDescriptor,
|
||||
FractionalPixel, GlyphId, PlatformFontMethods,
|
||||
};
|
||||
|
||||
|
@ -282,12 +282,12 @@ impl PlatformFontMethods for PlatformFont {
|
|||
metrics
|
||||
}
|
||||
|
||||
fn table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> {
|
||||
fn table_for_tag(&self, tag: Tag) -> Option<FontTable> {
|
||||
// dwrote (and presumably the Windows APIs) accept a reversed version of the table
|
||||
// tag bytes, which means that `u32::swap_bytes` must be called here in order to
|
||||
// use a byte order compatible with the rest of Servo.
|
||||
self.face
|
||||
.font_table(u32::swap_bytes(tag))
|
||||
.font_table(u32::from_be_bytes(tag.to_be_bytes()).swap_bytes())
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|bytes| FontTable { data: bytes })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue