use crate::sys;
#[derive(Debug, Clone, Copy)]
pub struct Glyph {
codepoint: u32,
visible: bool,
advance_x: f32,
min: [f32; 2],
max: [f32; 2],
}
impl Glyph {
pub(crate) fn from_raw(raw: sys::ImFontGlyph) -> Self {
Self {
codepoint: raw.Codepoint(),
visible: raw.Visible() != 0,
advance_x: raw.AdvanceX,
min: [raw.X0, raw.Y0],
max: [raw.X1, raw.Y1],
}
}
pub fn codepoint(&self) -> u32 {
self.codepoint
}
pub fn visible(&self) -> bool {
self.visible
}
pub fn advance_x(&self) -> f32 {
self.advance_x
}
pub fn position_and_size(&self) -> ([f32; 2], [f32; 2]) {
(self.min, self.max)
}
}