MCPcopy Index your code
hub / github.com/endbasic/endbasic / glyph

Method glyph

std/src/gfx/lcd/fonts/mod.rs:53–63  ·  view source on GitHub ↗

Returns the raw font data for `ch`. Each entry in the array corresponds to a row of pixels and is a bitmask indicating which pixels to turn on.

(&self, mut ch: char)

Source from the content-addressed store, hash-verified

51 /// Each entry in the array corresponds to a row of pixels and is a bitmask indicating which
52 /// pixels to turn on.
53 pub(crate) fn glyph(&self, mut ch: char) -> &'static [u8] {
54 if !(' '..='~').contains(&ch) {
55 // TODO(jmmv): Would be nicer to draw an empty box, much like how unknown Unicode
56 // characters are typically displayed.
57 ch = '?';
58 }
59 let height = self.glyph_size.height * self.stride;
60 let offset = ((ch as usize) - (' ' as usize)) * height;
61 debug_assert!(offset < (self.data.len() + height));
62 &self.data[offset..offset + height]
63 }
64
65 /// Computes the number of characters that fit within the given pixels `area`.
66 pub fn chars_in_area(&self, area: SizeInPixels) -> CharsXY {

Callers 3

draw_charFunction · 0.80

Calls

no outgoing calls

Tested by 2