mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-08 07:38:11 +00:00
feat(core): add new data mono fonts
[no changelog]
This commit is contained in:
parent
320ee7b044
commit
5ade9204e4
@ -43,14 +43,14 @@ impl AddressDetails {
|
|||||||
&theme::TEXT_NORMAL,
|
&theme::TEXT_NORMAL,
|
||||||
TR::words__account_colon,
|
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 {
|
if let Some(p) = path {
|
||||||
para.add(Paragraph::new(
|
para.add(Paragraph::new(
|
||||||
&theme::TEXT_NORMAL,
|
&theme::TEXT_NORMAL,
|
||||||
TR::address_details__derivation_path_colon,
|
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 {
|
let result = Self {
|
||||||
qr_code: Frame::left_aligned(
|
qr_code: Frame::left_aligned(
|
||||||
@ -72,7 +72,7 @@ impl AddressDetails {
|
|||||||
xpub_view: Frame::left_aligned(
|
xpub_view: Frame::left_aligned(
|
||||||
theme::label_title(),
|
theme::label_title(),
|
||||||
" \n ".into(),
|
" \n ".into(),
|
||||||
Paragraph::new(&theme::TEXT_MONO, "").into_paragraphs(),
|
Paragraph::new(&theme::TEXT_MONO_DATA, "").into_paragraphs(),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_border(theme::borders_horizontal_scroll()),
|
.with_border(theme::borders_horizontal_scroll()),
|
||||||
|
@ -132,7 +132,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_value(self, value: impl Into<TString<'static>>) -> Self {
|
pub fn with_value(self, value: impl Into<TString<'static>>) -> Self {
|
||||||
self.with_text(&theme::TEXT_MONO, value)
|
self.with_text(&theme::TEXT_MONO_DATA, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_shares(lines: [impl Into<TString<'static>>; 4], controls: U) -> Self {
|
pub fn new_shares(lines: [impl Into<TString<'static>>; 4], controls: U) -> Self {
|
||||||
|
@ -71,8 +71,11 @@ where
|
|||||||
|
|
||||||
Self {
|
Self {
|
||||||
app_name: Label::centered(app_name, theme::TEXT_DEMIBOLD),
|
app_name: Label::centered(app_name, theme::TEXT_DEMIBOLD),
|
||||||
account_name: Paragraph::new(&theme::TEXT_MONO, get_account(scrollbar.active_page))
|
account_name: Paragraph::new(
|
||||||
.into_paragraphs(),
|
&theme::TEXT_MONO_DATA,
|
||||||
|
get_account(scrollbar.active_page),
|
||||||
|
)
|
||||||
|
.into_paragraphs(),
|
||||||
page_swipe,
|
page_swipe,
|
||||||
icon: Child::new(Image::new(icon_data)),
|
icon: Child::new(Image::new(icon_data)),
|
||||||
get_account,
|
get_account,
|
||||||
|
@ -638,7 +638,7 @@ mod tests {
|
|||||||
"This paragraph is using a bold font. It doesn't need to be all that long.",
|
"This paragraph is using a bold font. It doesn't need to be all that long.",
|
||||||
),
|
),
|
||||||
Paragraph::new(
|
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.",
|
"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(
|
Paragraph::new(
|
||||||
|
@ -603,10 +603,12 @@ pub const TEXT_DEMIBOLD: TextStyle =
|
|||||||
pub const TEXT_BOLD: TextStyle =
|
pub const TEXT_BOLD: TextStyle =
|
||||||
TextStyle::new(fonts::FONT_BOLD_UPPER, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
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)
|
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_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
||||||
.with_prev_page_icon(ICON_PAGE_PREV, 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 =
|
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
|
||||||
TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
|
TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
|
||||||
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
.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);
|
.with_prev_page_icon(ICON_PAGE_PREV, 0);
|
||||||
/// Makes sure that the displayed text (usually address) will get divided into
|
/// Makes sure that the displayed text (usually address) will get divided into
|
||||||
/// smaller chunks.
|
/// 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_chunks(Chunks::new(4, 9))
|
||||||
.with_line_spacing(5);
|
.with_line_spacing(5);
|
||||||
/// Smaller horizontal chunk offset, used e.g. for long Cardano addresses.
|
/// 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
|
/// 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.
|
/// 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_chunks(Chunks::new(4, 7).with_max_rows(4))
|
||||||
.with_line_spacing(5)
|
.with_line_spacing(5)
|
||||||
.with_ellipsis_icon(ICON_PAGE_NEXT, -12);
|
.with_ellipsis_icon(ICON_PAGE_NEXT, -12);
|
||||||
|
@ -345,7 +345,7 @@ impl FirmwareUI for UIBolt {
|
|||||||
let [text, is_data]: [Obj; 2] = util::iter_into_array(para)?;
|
let [text, is_data]: [Obj; 2] = util::iter_into_array(para)?;
|
||||||
let is_data = is_data.try_into()?;
|
let is_data = is_data.try_into()?;
|
||||||
let style: &TextStyle = if is_data {
|
let style: &TextStyle = if is_data {
|
||||||
&theme::TEXT_MONO
|
&theme::TEXT_MONO_DATA
|
||||||
} else {
|
} else {
|
||||||
&theme::TEXT_NORMAL
|
&theme::TEXT_NORMAL
|
||||||
};
|
};
|
||||||
@ -383,7 +383,7 @@ impl FirmwareUI for UIBolt {
|
|||||||
items,
|
items,
|
||||||
&theme::TEXT_NORMAL,
|
&theme::TEXT_NORMAL,
|
||||||
&theme::TEXT_MONO,
|
&theme::TEXT_MONO,
|
||||||
&theme::TEXT_MONO,
|
&theme::TEXT_MONO_DATA,
|
||||||
)?;
|
)?;
|
||||||
let page = if hold {
|
let page = if hold {
|
||||||
ButtonPage::new(paragraphs.into_paragraphs(), theme::BG).with_hold()?
|
ButtonPage::new(paragraphs.into_paragraphs(), theme::BG).with_hold()?
|
||||||
@ -972,7 +972,7 @@ impl FirmwareUI for UIBolt {
|
|||||||
value,
|
value,
|
||||||
));
|
));
|
||||||
} else {
|
} 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()?;
|
let value: TString = self.value.try_into()?;
|
||||||
theme::get_chunkified_text_style(value.len())
|
theme::get_chunkified_text_style(value.len())
|
||||||
} else if self.text_mono {
|
} else if self.text_mono {
|
||||||
&theme::TEXT_MONO
|
&theme::TEXT_MONO_DATA
|
||||||
} else {
|
} else {
|
||||||
&theme::TEXT_NORMAL
|
&theme::TEXT_NORMAL
|
||||||
},
|
},
|
||||||
|
@ -96,7 +96,7 @@ pub fn new_get_address(
|
|||||||
let address: TString = address.try_into()?;
|
let address: TString = address.try_into()?;
|
||||||
theme::get_chunkified_text_style(address.len())
|
theme::get_chunkified_text_style(address.len())
|
||||||
} else {
|
} else {
|
||||||
&theme::TEXT_MONO
|
&theme::TEXT_MONO_DATA
|
||||||
},
|
},
|
||||||
description_font: &theme::TEXT_NORMAL,
|
description_font: &theme::TEXT_NORMAL,
|
||||||
extra_font: &theme::TEXT_DEMIBOLD,
|
extra_font: &theme::TEXT_DEMIBOLD,
|
||||||
|
@ -233,7 +233,7 @@ impl ConfirmValue {
|
|||||||
if self.classic_ellipsis {
|
if self.classic_ellipsis {
|
||||||
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
|
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
|
||||||
} else {
|
} else {
|
||||||
&theme::TEXT_MONO
|
&theme::TEXT_MONO_DATA
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
&theme::TEXT_NORMAL
|
&theme::TEXT_NORMAL
|
||||||
@ -287,7 +287,7 @@ impl ConfirmValue {
|
|||||||
if self.classic_ellipsis {
|
if self.classic_ellipsis {
|
||||||
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
|
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
|
||||||
} else {
|
} else {
|
||||||
&theme::TEXT_MONO
|
&theme::TEXT_MONO_DATA
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
&theme::TEXT_NORMAL
|
&theme::TEXT_NORMAL
|
||||||
|
@ -737,10 +737,13 @@ pub const TEXT_SUB_GREEN_LIME: TextStyle =
|
|||||||
pub const TEXT_WARNING: TextStyle =
|
pub const TEXT_WARNING: TextStyle =
|
||||||
TextStyle::new(fonts::FONT_DEMIBOLD, ORANGE_LIGHT, BG, GREY, GREY);
|
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)
|
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_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||||
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
||||||
.with_prev_page_icon(ICON_PAGE_PREV, 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 =
|
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
|
||||||
TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
|
TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
|
||||||
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
.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);
|
.with_prev_page_icon(ICON_PAGE_PREV, 0);
|
||||||
pub const TEXT_MONO_GREY_LIGHT: TextStyle = TextStyle {
|
pub const TEXT_MONO_GREY_LIGHT: TextStyle = TextStyle {
|
||||||
text_color: GREY_LIGHT,
|
text_color: GREY_LIGHT,
|
||||||
..TEXT_MONO
|
..TEXT_MONO_DATA
|
||||||
};
|
};
|
||||||
/// Makes sure that the displayed text (usually address) will get divided into
|
/// Makes sure that the displayed text (usually address) will get divided into
|
||||||
/// smaller chunks.
|
/// 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_chunks(Chunks::new(4, 9))
|
||||||
.with_line_spacing(5);
|
.with_line_spacing(5);
|
||||||
/// Smaller horizontal chunk offset, used e.g. for long Cardano addresses.
|
/// 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
|
/// 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.
|
/// 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_chunks(Chunks::new(4, 7).with_max_rows(4))
|
||||||
.with_line_spacing(5)
|
.with_line_spacing(5)
|
||||||
.with_ellipsis_icon(ICON_PAGE_NEXT, -12);
|
.with_ellipsis_icon(ICON_PAGE_NEXT, -12);
|
||||||
|
@ -423,7 +423,7 @@ impl FirmwareUI for UIDelizia {
|
|||||||
items,
|
items,
|
||||||
&theme::TEXT_SUB_GREY_LIGHT,
|
&theme::TEXT_SUB_GREY_LIGHT,
|
||||||
&theme::TEXT_MONO,
|
&theme::TEXT_MONO,
|
||||||
&theme::TEXT_MONO,
|
&theme::TEXT_MONO_DATA,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let flow = flow::new_confirm_action_simple(
|
let flow = flow::new_confirm_action_simple(
|
||||||
@ -969,7 +969,7 @@ impl FirmwareUI for UIDelizia {
|
|||||||
value,
|
value,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
paragraphs.add(Paragraph::new(&theme::TEXT_MONO, value));
|
paragraphs.add(Paragraph::new(&theme::TEXT_MONO_DATA, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,9 @@ pub const TEXT_MONO_MEDIUM_LIGHT: TextStyle = TextStyle::new(
|
|||||||
)
|
)
|
||||||
.with_line_breaking(LineBreaking::BreakAtWhitespace);
|
.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)
|
/// Roboto Mono Light - 30 (Address, data)
|
||||||
pub const TEXT_MONO_LIGHT: TextStyle = TextStyle::new(
|
pub const TEXT_MONO_LIGHT: TextStyle = TextStyle::new(
|
||||||
fonts::FONT_MONO_LIGHT_30,
|
fonts::FONT_MONO_LIGHT_30,
|
||||||
|
@ -369,8 +369,8 @@ impl FirmwareUI for UIEckhart {
|
|||||||
let paragraphs = PropsList::new(
|
let paragraphs = PropsList::new(
|
||||||
items,
|
items,
|
||||||
&theme::TEXT_SMALL_LIGHT,
|
&theme::TEXT_SMALL_LIGHT,
|
||||||
&theme::TEXT_MONO_LIGHT,
|
&theme::TEXT_MONO_MEDIUM_LIGHT,
|
||||||
&theme::TEXT_MONO_LIGHT,
|
&theme::TEXT_MONO_MEDIUM_LIGHT_DATA,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let flow = flow::new_confirm_with_menu(
|
let flow = flow::new_confirm_with_menu(
|
||||||
|
Loading…
Reference in New Issue
Block a user