1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-13 09:58:09 +00:00

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

This commit is contained in:
obrusvit 2024-12-08 23:25:40 +01:00
parent 9f98797188
commit 560dd51c71

View File

@ -1,5 +1,4 @@
use crate::{
translations::get_utf8_glyph,
trezorhal::display,
ui::{
constant,
@ -9,6 +8,9 @@ use crate::{
};
use core::slice;
#[cfg(feature = "translations")]
use crate::translations::get_utf8_glyph;
/// Representation of a single glyph.
/// We use standard typographic terms. For a nice explanation, see, e.g.,
/// the FreeType docs at https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html
@ -249,10 +251,15 @@ impl Font {
fn get_glyph_data(&self, c: u16) -> *const u8 {
display::get_font_info((*self).into()).map_or(core::ptr::null(), |font_info| {
if c >= 0x7F {
// UTF8 character from embedded blob
unsafe { get_utf8_glyph(c, *self) }
} else if c >= ' ' as u16 && c < 0x7F {
#[cfg(feature = "translations")]
{
if c >= 0x7F {
// UTF8 character from embedded blob
return unsafe { get_utf8_glyph(c, *self) };
}
}
if c >= ' ' as u16 && c < 0x7F {
// ASCII character
unsafe { *font_info.glyph_data.offset((c - ' ' as u16) as isize) }
} else {