1 | /// Used to perform a cheap conversion to a [`Face`](struct.Face.html) reference. |
2 | pub trait AsFaceRef { |
3 | /// Convert to a [`Face`](struct.Face.html) reference. |
4 | fn as_face_ref(&self) -> &ttf_parser::Face<'_>; |
5 | } |
6 | |
7 | impl AsFaceRef for ttf_parser::Face<'_> { |
8 | #[inline ] |
9 | fn as_face_ref(&self) -> &ttf_parser::Face<'_> { |
10 | self |
11 | } |
12 | } |
13 | |
14 | impl AsFaceRef for &ttf_parser::Face<'_> { |
15 | #[inline ] |
16 | fn as_face_ref(&self) -> &ttf_parser::Face<'_> { |
17 | self |
18 | } |
19 | } |
20 | |
21 | /// Trait exposing mutable operations on a [`ttf_parser::Face`]. |
22 | pub trait FaceMut { |
23 | /// Sets a variation axis coordinate. |
24 | /// |
25 | /// See [`ttf_parser::Face::set_variation`]. |
26 | fn set_variation(&mut self, axis: ttf_parser::Tag, value: f32) -> Option<()>; |
27 | } |
28 | impl FaceMut for ttf_parser::Face<'_> { |
29 | #[inline ] |
30 | fn set_variation(&mut self, axis: ttf_parser::Tag, value: f32) -> Option<()> { |
31 | ttf_parser::Face::set_variation(self, axis, value) |
32 | } |
33 | } |
34 | impl FaceMut for &mut ttf_parser::Face<'_> { |
35 | #[inline ] |
36 | fn set_variation(&mut self, axis: ttf_parser::Tag, value: f32) -> Option<()> { |
37 | ttf_parser::Face::set_variation(self, axis, value) |
38 | } |
39 | } |
40 | |