From 4660ea4d48725ac94a70b862201cc815abb63d10 Mon Sep 17 00:00:00 2001 From: obrusvit Date: Mon, 9 Dec 2024 11:57:52 +0100 Subject: [PATCH] fixup! refactor(core): remove UTF-8 support from C --- core/embed/rust/src/ui/display/font.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/embed/rust/src/ui/display/font.rs b/core/embed/rust/src/ui/display/font.rs index 5c14f2b6c5..0e55786c9b 100644 --- a/core/embed/rust/src/ui/display/font.rs +++ b/core/embed/rust/src/ui/display/font.rs @@ -134,7 +134,7 @@ impl From for i32 { impl Font { /// Supports UTF8 characters pub fn text_width(self, text: &str) -> i16 { - text.chars().fold(0, |acc, c| acc + self.get_glyph(c).adv) + text.chars().fold(0, |acc, c| acc + self.char_width(c)) } /// Supports UTF8 characters @@ -207,9 +207,7 @@ impl Font { } pub fn char_width(self, ch: char) -> i16 { - let mut buf = [0u8; 4]; - let encoding = ch.encode_utf8(&mut buf); - self.text_width(encoding) + self.get_glyph(ch).adv } pub fn text_height(self) -> i16 {