Handle new FontGlyph bitfields
@@ -5,7 +5,7 @@ use crate::sys;
#[derive(Copy, Clone, Debug, PartialEq)]
#[repr(C)]
pub struct FontGlyph {
- pub codepoint: u16,
+ bitfields: u32,
pub advance_x: f32,
pub x0: f32,
pub y0: f32,
@@ -17,6 +17,21 @@ pub struct FontGlyph {
pub v1: f32,
}
+impl FontGlyph {
+ pub fn codepoint(&self) -> u32 {
+ unsafe { self.raw().Codepoint() }
+ }
+ pub fn set_codepoint(&mut self, codepoint: u32) {
+ unsafe { self.raw_mut().set_Codepoint(codepoint) };
+ }
+ pub fn visible(&self) -> bool {
+ unsafe { self.raw().Visible() != 0 }
+ }
+ pub fn set_visible(&mut self, visible: bool) {
+ unsafe { self.raw_mut().set_Visible(visible as u32) }
+ }
+}
+
unsafe impl RawCast<sys::ImFontGlyph> for FontGlyph {}
#[test]
@@ -37,7 +52,7 @@ fn test_font_glyph_memory_layout() {
assert_eq!(offset_of!(FontGlyph, $l), offset_of!(ImFontGlyph, $r));
};
};
- assert_field_offset!(codepoint, Codepoint);
+ assert_field_offset!(bitfields, _bitfield_1);
assert_field_offset!(advance_x, AdvanceX);
assert_field_offset!(x0, X0);
assert_field_offset!(y0, Y0);
