Skip to content

Commit 82f9f6a

Browse files
committed
use TableProvider trait
Signed-off-by: Minghua Wu <[email protected]>
1 parent 2db1142 commit 82f9f6a

File tree

1 file changed

+3
-6
lines changed
  • components/fonts/platform/freetype

1 file changed

+3
-6
lines changed

components/fonts/platform/freetype/font.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ use freetype_sys::{
1616
use log::debug;
1717
use memmap2::Mmap;
1818
use parking_lot::ReentrantMutex;
19-
use read_fonts::tables::os2::Os2;
2019
use read_fonts::types::Tag;
21-
use read_fonts::{FontRead, FontRef, ReadError, TableProvider};
20+
use read_fonts::{FontRef, ReadError, TableProvider};
2221
use servo_arc::Arc;
2322
use skrifa::attribute::Weight;
2423
use style::Zero;
@@ -139,10 +138,8 @@ impl PlatformFontMethods for PlatformFont {
139138
);
140139
let face_is_bold = table_provider_data
141140
.font_ref()
142-
.ok()
143-
.and_then(|font_ref| font_ref.table_data(Tag::new(b"OS/2")))
144-
.and_then(|data| Os2::read(data).ok())
145-
.is_some_and(|table| table.us_weight_class() >= SEMI_BOLD_U16);
141+
.and_then(|font_ref| font_ref.os2())
142+
.is_ok_and(|table| table.us_weight_class() >= SEMI_BOLD_U16);
146143

147144
// Variable fonts do not count as font synthesis and their use is not affected by
148145
// the font-synthesis property.

0 commit comments

Comments
 (0)