mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
font get optimisation
This commit is contained in:
parent
991bb644f9
commit
0cd469866c
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue