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 {
|
pub struct Font {
|
||||||
letters: &'static [FontLetter],
|
letters: &'static [FontLetter; 128],
|
||||||
line_height: i32,
|
line_height: i32,
|
||||||
ascent: i32,
|
ascent: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Font {
|
impl Font {
|
||||||
#[must_use]
|
#[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 {
|
Self {
|
||||||
letters,
|
letters,
|
||||||
line_height,
|
line_height,
|
||||||
|
@ -63,7 +63,7 @@ impl Font {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn letter(&self, letter: char) -> &'static FontLetter {
|
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 {
|
pub(crate) fn ascent(&self) -> i32 {
|
||||||
|
|
Loading…
Reference in a new issue