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 33 34 35 36 37 38 39 40 41 42
use { ffi, Bitmap }; #[derive(Copy, Clone)] pub struct BitmapGlyph { raw: ffi::FT_BitmapGlyph } impl BitmapGlyph { pub fn from_raw(raw: ffi::FT_BitmapGlyph) -> Self { BitmapGlyph { raw: raw } } #[inline(always)] pub fn left(&self) -> i32 { unsafe { (*self.raw).left } } #[inline(always)] pub fn top(&self) -> i32 { unsafe { (*self.raw).top } } #[inline(always)] pub fn bitmap(&self) -> Bitmap { let bitmap = unsafe { &(*self.raw).bitmap }; Bitmap::from_raw(bitmap) } #[inline(always)] pub fn raw(&self) -> &ffi::FT_BitmapGlyphRec { unsafe { &*self.raw } } }