diff --git a/agb/src/display/font.rs b/agb/src/display/font.rs index 17bd184a..e37a77a2 100644 --- a/agb/src/display/font.rs +++ b/agb/src/display/font.rs @@ -47,14 +47,14 @@ impl FontLetter { } pub struct Font { - letters: &'static [FontLetter], + letters: &'static [FontLetter; 128], line_height: i32, ascent: i32, } impl Font { #[must_use] - pub const fn new(letters: &'static [FontLetter], line_height: i32, ascent: i32) -> Self { + pub const fn new(letters: &'static [FontLetter; 128], line_height: i32, ascent: i32) -> Self { Self { letters, line_height, @@ -63,7 +63,7 @@ impl Font { } pub(crate) fn letter(&self, letter: char) -> &'static FontLetter { - &self.letters[letter as usize] + &self.letters[letter as usize & (128 - 1)] } pub(crate) fn ascent(&self) -> i32 {