1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-14 02:18:07 +00:00

fixup! refactor(core): safe iface for get_glyph_data

This commit is contained in:
obrusvit 2024-12-13 15:36:24 +01:00
parent 5ae0e784a2
commit 80fa6c254d

View File

@ -302,17 +302,15 @@ impl Font {
} }
pub fn text_height(self) -> i16 { pub fn text_height(self) -> i16 {
display::get_font_info(self.into()).map_or(i16::MAX, |font| font.height.try_into().unwrap()) unwrap!(display::get_font_info(self.into()).map(|f| f.height.try_into().unwrap()))
} }
pub fn text_max_height(self) -> i16 { pub fn text_max_height(self) -> i16 {
display::get_font_info(self.into()) unwrap!(display::get_font_info(self.into()).map(|f| f.max_height.try_into().unwrap()))
.map_or(i16::MAX, |font| font.max_height.try_into().unwrap())
} }
pub fn text_baseline(self) -> i16 { pub fn text_baseline(self) -> i16 {
display::get_font_info(self.into()) unwrap!(display::get_font_info(self.into()).map(|f| f.baseline.try_into().unwrap()))
.map_or(i16::MAX, |font| font.baseline.try_into().unwrap())
} }
pub fn line_height(self) -> i16 { pub fn line_height(self) -> i16 {