owned_ttf_parser/
convert.rs

1/// Used to perform a cheap conversion to a [`Face`](struct.Face.html) reference.
2pub trait AsFaceRef {
3    /// Convert to a [`Face`](struct.Face.html) reference.
4    fn as_face_ref(&self) -> &ttf_parser::Face<'_>;
5}
6
7impl AsFaceRef for ttf_parser::Face<'_> {
8    #[inline]
9    fn as_face_ref(&self) -> &ttf_parser::Face<'_> {
10        self
11    }
12}
13
14impl 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`].
22pub 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}
28impl 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}
34impl 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}