pub struct Font<'a> { /* private fields */ }Expand description
The font as the one-bit renderer reads it: the glyph map and the one-bit atlas the game gives.
Implementations§
Source§impl<'a> Font<'a>
impl<'a> Font<'a>
Sourcepub fn new(
atlas: &'a FontAtlasDef,
bits: &'a [u8],
) -> Result<Self, &'static str>
pub fn new( atlas: &'a FontAtlasDef, bits: &'a [u8], ) -> Result<Self, &'static str>
The font of glyph map atlas and one-bit atlas bits. Fails if a
cell is wider than 8 pixels or bits lacks a glyph of the map.
Sourcepub fn rows(&self, glyph: char) -> Option<&'a [u8]>
pub fn rows(&self, glyph: char) -> Option<&'a [u8]>
The pixel rows of glyph (a set bit is a pixel of the glyph), or
of the fallback glyph if the font lacks it.
Sourcepub fn cell_rows(&self, buf: &GlyphBuffer, x: i32, y: i32) -> Option<&'a [u8]>
pub fn cell_rows(&self, buf: &GlyphBuffer, x: i32, y: i32) -> Option<&'a [u8]>
The pixel rows drawn in cell (x, y) of buf: its glyph’s
(rows), or a half of a wide glyph’s, the left in
its first cell and the right in its continuation. None for a
space, and for a continuation whose glyph the font has no wide
glyph for.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Font<'a>
impl<'a> RefUnwindSafe for Font<'a>
impl<'a> Send for Font<'a>
impl<'a> Sync for Font<'a>
impl<'a> Unpin for Font<'a>
impl<'a> UnsafeUnpin for Font<'a>
impl<'a> UnwindSafe for Font<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more