Skip to content

Commit bafedcb

Browse files
committed
Remove deref polymorphism
1 parent 12a87b5 commit bafedcb

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/hb/face.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use ttf_parser::gdef::GlyphClass;
77
use ttf_parser::{GlyphId, RgbaColor};
88

99
use super::buffer::GlyphPropsFlags;
10-
use super::fonta;
1110
use super::common::TagExt;
11+
use super::fonta;
1212
use super::ot_layout::TableIndex;
1313
use crate::Variation;
1414

@@ -22,15 +22,6 @@ pub struct hb_font_t<'a> {
2222
pub(crate) points_per_em: Option<f32>,
2323
}
2424

25-
impl<'a> core::ops::Deref for hb_font_t<'a> {
26-
type Target = ttf_parser::Face<'a>;
27-
28-
#[inline]
29-
fn deref(&self) -> &Self::Target {
30-
&self.ttfp_face
31-
}
32-
}
33-
3425
impl<'a> hb_font_t<'a> {
3526
/// Creates a new `Face` from data.
3627
///
@@ -79,10 +70,15 @@ impl<'a> hb_font_t<'a> {
7970
self.points_per_em = ptem;
8071
}
8172

73+
pub(crate) fn tables(&self) -> &ttf_parser::FaceTables<'a> {
74+
self.ttfp_face.tables()
75+
}
76+
8277
/// Sets font variations.
8378
pub fn set_variations(&mut self, variations: &[Variation]) {
8479
for variation in variations {
85-
self.ttfp_face.set_variation(ttf_parser::Tag(variation.tag.as_u32()), variation.value);
80+
self.ttfp_face
81+
.set_variation(ttf_parser::Tag(variation.tag.as_u32()), variation.value);
8682
}
8783
self.font.set_coords(self.ttfp_face.variation_coordinates());
8884
}
@@ -215,7 +211,7 @@ impl<'a> hb_font_t<'a> {
215211
return false;
216212
}
217213

218-
if let Some(clip_box) = colr.clip_box(glyph, self.variation_coordinates()) {
214+
if let Some(clip_box) = colr.clip_box(glyph, self.ttfp_face.variation_coordinates()) {
219215
// Floor
220216
glyph_extents.x_bearing = (clip_box.x_min).round() as i32;
221217
glyph_extents.y_bearing = (clip_box.y_max).round() as i32;
@@ -230,7 +226,7 @@ impl<'a> hb_font_t<'a> {
230226
glyph,
231227
0,
232228
&mut extents_data,
233-
self.variation_coordinates(),
229+
self.ttfp_face.variation_coordinates(),
234230
RgbaColor::new(0, 0, 0, 0),
235231
)
236232
.is_some();

0 commit comments

Comments
 (0)