1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::GlyphGeometry;
use std::fmt;

glib::wrapper! {
    #[doc(alias = "PangoGlyphInfo")]
    pub struct GlyphInfo(BoxedInline<ffi::PangoGlyphInfo>);
}

impl GlyphInfo {
    pub fn glyph(&self) -> u32 {
        self.inner.glyph
    }

    pub fn geometry(&self) -> &GlyphGeometry {
        unsafe { &*(&self.inner.geometry as *const _ as *const GlyphGeometry) }
    }

    pub fn geometry_mut(&mut self) -> &mut GlyphGeometry {
        unsafe { &mut *(&mut self.inner.geometry as *mut _ as *mut GlyphGeometry) }
    }
}

impl fmt::Debug for GlyphInfo {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.debug_struct("GlyphInfo")
            .field("glyph", &self.glyph())
            .field("geometry", &self.geometry())
            .finish()
    }
}