pango/
glyph_info.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use std::fmt;
4
5use crate::GlyphGeometry;
6
7glib::wrapper! {
8    #[doc(alias = "PangoGlyphInfo")]
9    pub struct GlyphInfo(BoxedInline<crate::ffi::PangoGlyphInfo>);
10}
11
12impl GlyphInfo {
13    #[inline]
14    pub fn glyph(&self) -> u32 {
15        self.inner.glyph
16    }
17
18    #[inline]
19    pub fn set_glyph(&mut self, glyph: u32) {
20        self.inner.glyph = glyph
21    }
22
23    #[inline]
24    pub fn geometry(&self) -> &GlyphGeometry {
25        unsafe { &*(&self.inner.geometry as *const _ as *const GlyphGeometry) }
26    }
27
28    #[inline]
29    pub fn geometry_mut(&mut self) -> &mut GlyphGeometry {
30        unsafe { &mut *(&mut self.inner.geometry as *mut _ as *mut GlyphGeometry) }
31    }
32}
33
34impl fmt::Debug for GlyphInfo {
35    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
36        f.debug_struct("GlyphInfo")
37            .field("glyph", &self.glyph())
38            .field("geometry", &self.geometry())
39            .finish()
40    }
41}