mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-24 21:32:03 +00:00
chore(eckhart): fix button text and subtext rendering
This commit is contained in:
parent
ad80622058
commit
48527cde33
@ -36,7 +36,7 @@ pub struct Button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Button {
|
impl Button {
|
||||||
pub const BASELINE_OFFSET: Offset = Offset::new(2, 6);
|
pub const BASELINE_OFFSET: Offset = Offset::new(12, 6);
|
||||||
const LINE_SPACING: i16 = 7;
|
const LINE_SPACING: i16 = 7;
|
||||||
const SUBTEXT_STYLE: TextStyle = theme::label_menu_item_subtitle();
|
const SUBTEXT_STYLE: TextStyle = theme::label_menu_item_subtitle();
|
||||||
|
|
||||||
@ -249,9 +249,8 @@ impl Button {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
ButtonContent::TextAndSubtext(text, subtext) => {
|
ButtonContent::TextAndSubtext(text, subtext) => {
|
||||||
let text_y_offset = Offset::y(
|
let text_y_offset =
|
||||||
self.content_height() / 2 - self.style().font.allcase_text_height() / 2,
|
Offset::y(self.content_height() / 2 - self.style().font.allcase_text_height());
|
||||||
);
|
|
||||||
let subtext_y_offset = Offset::y(self.content_height() / 2);
|
let subtext_y_offset = Offset::y(self.content_height() / 2);
|
||||||
let start_of_baseline = match self.text_align {
|
let start_of_baseline = match self.text_align {
|
||||||
Alignment::Start => {
|
Alignment::Start => {
|
||||||
@ -271,7 +270,7 @@ impl Button {
|
|||||||
.render(target);
|
.render(target);
|
||||||
});
|
});
|
||||||
|
|
||||||
text.map(|subtext| {
|
subtext.map(|subtext| {
|
||||||
shape::Text::new(subtext_baseline, subtext, Self::SUBTEXT_STYLE.text_font)
|
shape::Text::new(subtext_baseline, subtext, Self::SUBTEXT_STYLE.text_font)
|
||||||
.with_fg(Self::SUBTEXT_STYLE.text_color)
|
.with_fg(Self::SUBTEXT_STYLE.text_color)
|
||||||
.with_align(self.text_align)
|
.with_align(self.text_align)
|
||||||
|
Loading…
Reference in New Issue
Block a user