1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-31 18:00:58 +00:00

fixup! refactor(core): remove UTF-8 support from C

This commit is contained in:
obrusvit 2024-12-09 11:57:34 +01:00
parent d42cea3818
commit 45d747fa91

View File

@ -249,19 +249,23 @@ impl Font {
(start + end + self.visible_text_height(text)) / 2 (start + end + self.visible_text_height(text)) / 2
} }
fn get_glyph_data(&self, c: u16) -> *const u8 { fn get_glyph_data(&self, codepoint: u16) -> *const u8 {
display::get_font_info((*self).into()).map_or(core::ptr::null(), |font_info| { display::get_font_info((*self).into()).map_or(core::ptr::null(), |font_info| {
#[cfg(feature = "translations")] #[cfg(feature = "translations")]
{ {
if c >= 0x7F { if codepoint >= 0x7F {
// UTF8 character from embedded blob // UTF8 character from embedded blob
return unsafe { get_utf8_glyph(c, *self) }; return unsafe { get_utf8_glyph(codepoint, *self) };
} }
} }
if c >= ' ' as u16 && c < 0x7F { if codepoint >= ' ' as u16 && codepoint < 0x7F {
// ASCII character // ASCII character
unsafe { *font_info.glyph_data.offset((c - ' ' as u16) as isize) } unsafe {
*font_info
.glyph_data
.offset((codepoint - ' ' as u16) as isize)
}
} else { } else {
font_info.glyph_nonprintable font_info.glyph_nonprintable
} }