From 5ade9204e4334dc9d6e74fd232d8d9b61cf6e38c Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Mon, 23 Jun 2025 22:46:57 +0200 Subject: [PATCH] feat(core): add new data mono fonts [no changelog] --- .../src/ui/layout_bolt/component/address_details.rs | 6 +++--- .../embed/rust/src/ui/layout_bolt/component/dialog.rs | 2 +- core/embed/rust/src/ui/layout_bolt/component/fido.rs | 7 +++++-- core/embed/rust/src/ui/layout_bolt/component/page.rs | 2 +- core/embed/rust/src/ui/layout_bolt/theme/mod.rs | 8 +++++--- core/embed/rust/src/ui/layout_bolt/ui_firmware.rs | 8 ++++---- .../rust/src/ui/layout_delizia/flow/get_address.rs | 2 +- core/embed/rust/src/ui/layout_delizia/flow/util.rs | 4 ++-- core/embed/rust/src/ui/layout_delizia/theme/mod.rs | 11 +++++++---- core/embed/rust/src/ui/layout_delizia/ui_firmware.rs | 4 ++-- .../rust/src/ui/layout_eckhart/theme/firmware.rs | 3 +++ core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs | 4 ++-- 12 files changed, 36 insertions(+), 25 deletions(-) diff --git a/core/embed/rust/src/ui/layout_bolt/component/address_details.rs b/core/embed/rust/src/ui/layout_bolt/component/address_details.rs index b80d24f8f5..bb987408bb 100644 --- a/core/embed/rust/src/ui/layout_bolt/component/address_details.rs +++ b/core/embed/rust/src/ui/layout_bolt/component/address_details.rs @@ -43,14 +43,14 @@ impl AddressDetails { &theme::TEXT_NORMAL, TR::words__account_colon, )); - para.add(Paragraph::new(&theme::TEXT_MONO, a)); + para.add(Paragraph::new(&theme::TEXT_MONO_DATA, a)); } if let Some(p) = path { para.add(Paragraph::new( &theme::TEXT_NORMAL, TR::address_details__derivation_path_colon, )); - para.add(Paragraph::new(&theme::TEXT_MONO, p)); + para.add(Paragraph::new(&theme::TEXT_MONO_DATA, p)); } let result = Self { qr_code: Frame::left_aligned( @@ -72,7 +72,7 @@ impl AddressDetails { xpub_view: Frame::left_aligned( theme::label_title(), " \n ".into(), - Paragraph::new(&theme::TEXT_MONO, "").into_paragraphs(), + Paragraph::new(&theme::TEXT_MONO_DATA, "").into_paragraphs(), ) .with_cancel_button() .with_border(theme::borders_horizontal_scroll()), diff --git a/core/embed/rust/src/ui/layout_bolt/component/dialog.rs b/core/embed/rust/src/ui/layout_bolt/component/dialog.rs index 9242de3817..f9020cc274 100644 --- a/core/embed/rust/src/ui/layout_bolt/component/dialog.rs +++ b/core/embed/rust/src/ui/layout_bolt/component/dialog.rs @@ -132,7 +132,7 @@ where } pub fn with_value(self, value: impl Into>) -> Self { - self.with_text(&theme::TEXT_MONO, value) + self.with_text(&theme::TEXT_MONO_DATA, value) } pub fn new_shares(lines: [impl Into>; 4], controls: U) -> Self { diff --git a/core/embed/rust/src/ui/layout_bolt/component/fido.rs b/core/embed/rust/src/ui/layout_bolt/component/fido.rs index 1a9fead294..6cf23c28a8 100644 --- a/core/embed/rust/src/ui/layout_bolt/component/fido.rs +++ b/core/embed/rust/src/ui/layout_bolt/component/fido.rs @@ -71,8 +71,11 @@ where Self { app_name: Label::centered(app_name, theme::TEXT_DEMIBOLD), - account_name: Paragraph::new(&theme::TEXT_MONO, get_account(scrollbar.active_page)) - .into_paragraphs(), + account_name: Paragraph::new( + &theme::TEXT_MONO_DATA, + get_account(scrollbar.active_page), + ) + .into_paragraphs(), page_swipe, icon: Child::new(Image::new(icon_data)), get_account, diff --git a/core/embed/rust/src/ui/layout_bolt/component/page.rs b/core/embed/rust/src/ui/layout_bolt/component/page.rs index 0535284edd..8a7ba5a86d 100644 --- a/core/embed/rust/src/ui/layout_bolt/component/page.rs +++ b/core/embed/rust/src/ui/layout_bolt/component/page.rs @@ -638,7 +638,7 @@ mod tests { "This paragraph is using a bold font. It doesn't need to be all that long.", ), Paragraph::new( - &theme::TEXT_MONO, + &theme::TEXT_MONO_DATA, "And this one is using MONO. Monospace is nice for numbers, they have the same width and can be scanned quickly. Even if they span several pages or something.", ), Paragraph::new( diff --git a/core/embed/rust/src/ui/layout_bolt/theme/mod.rs b/core/embed/rust/src/ui/layout_bolt/theme/mod.rs index 260b40ec40..9adf3e7048 100644 --- a/core/embed/rust/src/ui/layout_bolt/theme/mod.rs +++ b/core/embed/rust/src/ui/layout_bolt/theme/mod.rs @@ -603,10 +603,12 @@ pub const TEXT_DEMIBOLD: TextStyle = pub const TEXT_BOLD: TextStyle = TextStyle::new(fonts::FONT_BOLD_UPPER, FG, BG, GREY_LIGHT, GREY_LIGHT); pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT) - .with_line_breaking(LineBreaking::BreakWordsNoHyphen) + .with_line_breaking(LineBreaking::BreakAtWhitespace) .with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth) .with_ellipsis_icon(ICON_PAGE_NEXT, 0) .with_prev_page_icon(ICON_PAGE_PREV, 0); +pub const TEXT_MONO_DATA: TextStyle = + TEXT_MONO.with_line_breaking(LineBreaking::BreakWordsNoHyphen); pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT) .with_line_breaking(LineBreaking::BreakWordsNoHyphen) @@ -614,13 +616,13 @@ pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle = .with_prev_page_icon(ICON_PAGE_PREV, 0); /// Makes sure that the displayed text (usually address) will get divided into /// smaller chunks. -pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO +pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO_DATA .with_chunks(Chunks::new(4, 9)) .with_line_spacing(5); /// Smaller horizontal chunk offset, used e.g. for long Cardano addresses. /// Also moving the next page ellipsis to the left (as there is a space on the /// left). Last but not least, maximum number of rows is 4 in this case. -pub const TEXT_MONO_ADDRESS_CHUNKS_SMALLER_X_OFFSET: TextStyle = TEXT_MONO +pub const TEXT_MONO_ADDRESS_CHUNKS_SMALLER_X_OFFSET: TextStyle = TEXT_MONO_DATA .with_chunks(Chunks::new(4, 7).with_max_rows(4)) .with_line_spacing(5) .with_ellipsis_icon(ICON_PAGE_NEXT, -12); diff --git a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs index 0892f175ca..0a983aaec2 100644 --- a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs @@ -345,7 +345,7 @@ impl FirmwareUI for UIBolt { let [text, is_data]: [Obj; 2] = util::iter_into_array(para)?; let is_data = is_data.try_into()?; let style: &TextStyle = if is_data { - &theme::TEXT_MONO + &theme::TEXT_MONO_DATA } else { &theme::TEXT_NORMAL }; @@ -383,7 +383,7 @@ impl FirmwareUI for UIBolt { items, &theme::TEXT_NORMAL, &theme::TEXT_MONO, - &theme::TEXT_MONO, + &theme::TEXT_MONO_DATA, )?; let page = if hold { ButtonPage::new(paragraphs.into_paragraphs(), theme::BG).with_hold()? @@ -972,7 +972,7 @@ impl FirmwareUI for UIBolt { value, )); } else { - paragraphs.add(Paragraph::new(&theme::TEXT_MONO, value)); + paragraphs.add(Paragraph::new(&theme::TEXT_MONO_DATA, value)); } } @@ -1360,7 +1360,7 @@ impl ConfirmValue { let value: TString = self.value.try_into()?; theme::get_chunkified_text_style(value.len()) } else if self.text_mono { - &theme::TEXT_MONO + &theme::TEXT_MONO_DATA } else { &theme::TEXT_NORMAL }, diff --git a/core/embed/rust/src/ui/layout_delizia/flow/get_address.rs b/core/embed/rust/src/ui/layout_delizia/flow/get_address.rs index 65fc8f779a..95a9646e61 100644 --- a/core/embed/rust/src/ui/layout_delizia/flow/get_address.rs +++ b/core/embed/rust/src/ui/layout_delizia/flow/get_address.rs @@ -96,7 +96,7 @@ pub fn new_get_address( let address: TString = address.try_into()?; theme::get_chunkified_text_style(address.len()) } else { - &theme::TEXT_MONO + &theme::TEXT_MONO_DATA }, description_font: &theme::TEXT_NORMAL, extra_font: &theme::TEXT_DEMIBOLD, diff --git a/core/embed/rust/src/ui/layout_delizia/flow/util.rs b/core/embed/rust/src/ui/layout_delizia/flow/util.rs index f980e163a5..43dc4da0c0 100644 --- a/core/embed/rust/src/ui/layout_delizia/flow/util.rs +++ b/core/embed/rust/src/ui/layout_delizia/flow/util.rs @@ -233,7 +233,7 @@ impl ConfirmValue { if self.classic_ellipsis { &theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS } else { - &theme::TEXT_MONO + &theme::TEXT_MONO_DATA } } else { &theme::TEXT_NORMAL @@ -287,7 +287,7 @@ impl ConfirmValue { if self.classic_ellipsis { &theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS } else { - &theme::TEXT_MONO + &theme::TEXT_MONO_DATA } } else { &theme::TEXT_NORMAL diff --git a/core/embed/rust/src/ui/layout_delizia/theme/mod.rs b/core/embed/rust/src/ui/layout_delizia/theme/mod.rs index 8770ff0ef0..d976724caa 100644 --- a/core/embed/rust/src/ui/layout_delizia/theme/mod.rs +++ b/core/embed/rust/src/ui/layout_delizia/theme/mod.rs @@ -737,10 +737,13 @@ pub const TEXT_SUB_GREEN_LIME: TextStyle = pub const TEXT_WARNING: TextStyle = TextStyle::new(fonts::FONT_DEMIBOLD, ORANGE_LIGHT, BG, GREY, GREY); pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY) - .with_line_breaking(LineBreaking::BreakWordsNoHyphen) + .with_line_breaking(LineBreaking::BreakAtWhitespace) .with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth) .with_ellipsis_icon(ICON_PAGE_NEXT, 0) .with_prev_page_icon(ICON_PAGE_PREV, 0); +/// Mono data text does not have hyphens +pub const TEXT_MONO_DATA: TextStyle = + TEXT_MONO.with_line_breaking(LineBreaking::BreakWordsNoHyphen); pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle = TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY) .with_line_breaking(LineBreaking::BreakWordsNoHyphen) @@ -748,17 +751,17 @@ pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle = .with_prev_page_icon(ICON_PAGE_PREV, 0); pub const TEXT_MONO_GREY_LIGHT: TextStyle = TextStyle { text_color: GREY_LIGHT, - ..TEXT_MONO + ..TEXT_MONO_DATA }; /// Makes sure that the displayed text (usually address) will get divided into /// smaller chunks. -pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO +pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO_DATA .with_chunks(Chunks::new(4, 9)) .with_line_spacing(5); /// Smaller horizontal chunk offset, used e.g. for long Cardano addresses. /// Also moving the next page ellipsis to the left (as there is a space on the /// left). Last but not least, maximum number of rows is 4 in this case. -pub const TEXT_MONO_ADDRESS_CHUNKS_SMALLER_X_OFFSET: TextStyle = TEXT_MONO +pub const TEXT_MONO_ADDRESS_CHUNKS_SMALLER_X_OFFSET: TextStyle = TEXT_MONO_DATA .with_chunks(Chunks::new(4, 7).with_max_rows(4)) .with_line_spacing(5) .with_ellipsis_icon(ICON_PAGE_NEXT, -12); diff --git a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs index d5c84b47c8..e6b97f9048 100644 --- a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs @@ -423,7 +423,7 @@ impl FirmwareUI for UIDelizia { items, &theme::TEXT_SUB_GREY_LIGHT, &theme::TEXT_MONO, - &theme::TEXT_MONO, + &theme::TEXT_MONO_DATA, )?; let flow = flow::new_confirm_action_simple( @@ -969,7 +969,7 @@ impl FirmwareUI for UIDelizia { value, )); } else { - paragraphs.add(Paragraph::new(&theme::TEXT_MONO, value)); + paragraphs.add(Paragraph::new(&theme::TEXT_MONO_DATA, value)); } } diff --git a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs index 395a967d13..8e95952b64 100644 --- a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs @@ -79,6 +79,9 @@ pub const TEXT_MONO_MEDIUM_LIGHT: TextStyle = TextStyle::new( ) .with_line_breaking(LineBreaking::BreakAtWhitespace); +pub const TEXT_MONO_MEDIUM_LIGHT_DATA: TextStyle = + TEXT_MONO_MEDIUM_LIGHT.with_line_breaking(LineBreaking::BreakWordsNoHyphen); + /// Roboto Mono Light - 30 (Address, data) pub const TEXT_MONO_LIGHT: TextStyle = TextStyle::new( fonts::FONT_MONO_LIGHT_30, diff --git a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs index b9a610d993..4e1b7090e8 100644 --- a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs @@ -369,8 +369,8 @@ impl FirmwareUI for UIEckhart { let paragraphs = PropsList::new( items, &theme::TEXT_SMALL_LIGHT, - &theme::TEXT_MONO_LIGHT, - &theme::TEXT_MONO_LIGHT, + &theme::TEXT_MONO_MEDIUM_LIGHT, + &theme::TEXT_MONO_MEDIUM_LIGHT_DATA, )?; let flow = flow::new_confirm_with_menu(