mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-12 07:32:48 +00:00
refactor(core): switch fonts from C to Rust
- switch common and individual layout components to Rust fonts - font usage changed from enum Font to pointers to FontInfo structs [no changelog]
This commit is contained in:
parent
9638c7e28a
commit
be459019b8
@ -358,10 +358,6 @@ fn generate_trezorhal_bindings() {
|
||||
.allowlist_function("gfx_mono8_blend_mono1p")
|
||||
.allowlist_function("gfx_mono8_blend_mono4")
|
||||
.allowlist_function("gfx_bitblt_wait")
|
||||
// fonts
|
||||
.allowlist_type("font_info_t")
|
||||
.allowlist_function("get_font_info")
|
||||
// .allowlist_function("font_get_glyph")
|
||||
// uzlib
|
||||
.allowlist_function("uzlib_uncompress_init")
|
||||
.allowlist_function("uzlib_uncompress")
|
||||
|
@ -8,25 +8,10 @@ use ffi::{DISPLAY_RESX_, DISPLAY_RESY_};
|
||||
pub const DISPLAY_RESX: u32 = DISPLAY_RESX_;
|
||||
pub const DISPLAY_RESY: u32 = DISPLAY_RESY_;
|
||||
|
||||
pub type FontInfo = ffi::font_info_t;
|
||||
|
||||
pub fn backlight(val: i32) -> i32 {
|
||||
unsafe { ffi::display_set_backlight(val) }
|
||||
}
|
||||
|
||||
pub fn get_font_info(font: i32) -> Option<FontInfo> {
|
||||
// SAFETY:
|
||||
// - `ffi::get_font_info` returns either null (for invalid fonts) or a pointer
|
||||
// to a static font_info_t struct
|
||||
// - The font_info_t data is in ROM, making it immutable and static
|
||||
// - The font_info_t contains pointers to static glyph data arrays also in ROM
|
||||
// - All font data is generated at compile time and included in the binary
|
||||
unsafe {
|
||||
let font = ffi::get_font_info(font as _);
|
||||
Some(*font.as_ref()?)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sync() {
|
||||
// NOTE: The sync operation is not called for tests because the linker
|
||||
// would otherwise report missing symbols if the tests are built with ASAN.
|
||||
|
@ -2,7 +2,7 @@ use crate::{
|
||||
strutil::TString,
|
||||
ui::{
|
||||
component::{Component, Event, EventCtx, Never, Pad},
|
||||
display::{Color, Font},
|
||||
display::{font::FONT_NORMAL, Color},
|
||||
geometry::{Alignment, Offset, Rect},
|
||||
shape::{self, Renderer},
|
||||
},
|
||||
@ -43,7 +43,7 @@ impl Component for Connect {
|
||||
}
|
||||
|
||||
fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
|
||||
let font = Font::NORMAL;
|
||||
let font = FONT_NORMAL;
|
||||
|
||||
self.bg.render(target);
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
use crate::{
|
||||
strutil::TString,
|
||||
ui::{
|
||||
display::{Color, Font},
|
||||
display::{
|
||||
font::{FONT_BOLD, FONT_BOLD_UPPER, FONT_DEMIBOLD, FONT_MONO, FONT_NORMAL},
|
||||
Color, Font,
|
||||
},
|
||||
geometry::{Alignment, Offset, Rect},
|
||||
util::ResultExt,
|
||||
},
|
||||
@ -241,24 +244,26 @@ impl<'a> OpTextLayout<'a> {
|
||||
|
||||
// Op-adding aggregation operations
|
||||
impl<'a> OpTextLayout<'a> {
|
||||
// TODO: use TextStyle instead because we do not want e.g. BOLD_UPPER in all
|
||||
// layouts
|
||||
pub fn text_normal(self, text: impl Into<TString<'a>>) -> Self {
|
||||
self.font(Font::NORMAL).text(text.into())
|
||||
self.font(FONT_NORMAL).text(text.into())
|
||||
}
|
||||
|
||||
pub fn text_mono(self, text: impl Into<TString<'a>>) -> Self {
|
||||
self.font(Font::MONO).text(text.into())
|
||||
self.font(FONT_MONO).text(text.into())
|
||||
}
|
||||
|
||||
pub fn text_bold(self, text: impl Into<TString<'a>>) -> Self {
|
||||
self.font(Font::BOLD).text(text.into())
|
||||
self.font(FONT_BOLD).text(text.into())
|
||||
}
|
||||
|
||||
pub fn text_bold_upper(self, text: impl Into<TString<'a>>) -> Self {
|
||||
self.font(Font::BOLD_UPPER).text(text.into())
|
||||
self.font(FONT_BOLD_UPPER).text(text.into())
|
||||
}
|
||||
|
||||
pub fn text_demibold(self, text: impl Into<TString<'a>>) -> Self {
|
||||
self.font(Font::DEMIBOLD).text(text.into())
|
||||
self.font(FONT_DEMIBOLD).text(text.into())
|
||||
}
|
||||
|
||||
pub fn chunkify_text(self, chunks: Option<(Chunks, i16)>) -> Self {
|
||||
|
@ -4,10 +4,13 @@ use crate::{
|
||||
strutil::TString,
|
||||
ui::{
|
||||
component::{Component, Event, EventCtx, Never, Paginate},
|
||||
display::{toif::Icon, Color, Font},
|
||||
display::{
|
||||
font::{FONT_NORMAL, FONT_SUB},
|
||||
toif::Icon,
|
||||
Color,
|
||||
},
|
||||
geometry::{Alignment, Dimensions, Insets, LinearPlacement, Offset, Point, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
shape::{self, Renderer},
|
||||
},
|
||||
};
|
||||
|
||||
@ -626,7 +629,7 @@ where
|
||||
} else {
|
||||
// current and future tasks - ordinal numbers or icon on current task
|
||||
if self.show_numerals {
|
||||
let num_offset = Offset::new(4, Font::NORMAL.visible_text_height("1"));
|
||||
let num_offset = Offset::new(4, FONT_NORMAL.visible_text_height("1"));
|
||||
self.render_numeral(base + num_offset, i, l.style.text_color, target);
|
||||
} else if i == current_visible {
|
||||
let color = l.style.text_color;
|
||||
@ -645,7 +648,7 @@ where
|
||||
) {
|
||||
let numeral = uformat!("{}.", n + 1);
|
||||
shape::Text::new(base_point, numeral.as_str())
|
||||
.with_font(Font::SUB)
|
||||
.with_font(FONT_SUB)
|
||||
.with_fg(color)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -1,15 +1,11 @@
|
||||
#[cfg(feature = "translations")]
|
||||
use spin::RwLockReadGuard;
|
||||
|
||||
use crate::{
|
||||
trezorhal::display::{self},
|
||||
ui::{
|
||||
constant,
|
||||
geometry::Offset,
|
||||
shape::{Bitmap, BitmapFormat},
|
||||
},
|
||||
use crate::ui::{
|
||||
constant,
|
||||
geometry::Offset,
|
||||
shape::{Bitmap, BitmapFormat},
|
||||
};
|
||||
use core::slice;
|
||||
|
||||
pub use super::super::fonts::*;
|
||||
|
||||
@ -18,6 +14,21 @@ use crate::translations::flash;
|
||||
#[cfg(feature = "translations")]
|
||||
use crate::translations::Translations;
|
||||
|
||||
/// Font information structure containing metadata and pointers to font data
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub struct FontInfo {
|
||||
pub height: i16,
|
||||
pub max_height: i16,
|
||||
pub baseline: i16,
|
||||
pub glyph_data: &'static [&'static [u8]],
|
||||
pub glyph_nonprintable: &'static [u8],
|
||||
}
|
||||
/// Convenience type for font references defined in the `fonts` module.
|
||||
pub type Font = &'static FontInfo;
|
||||
|
||||
// SAFETY: We are in a single-threaded environment.
|
||||
unsafe impl Sync for FontInfo {}
|
||||
|
||||
/// Representation of a single glyph.
|
||||
/// We use standard typographic terms. For a nice explanation, see, e.g.,
|
||||
/// the FreeType docs at https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html
|
||||
@ -115,12 +126,12 @@ impl<'a> Glyph<'a> {
|
||||
/// Manages access to font resources and handles UTF-8 character glyphs
|
||||
///
|
||||
/// The provider holds necessary lock for accessing translation data
|
||||
/// and is typically used through the `Font::with_glyph_data` method
|
||||
/// and is typically used through the `FontInfo::with_glyph_data` method
|
||||
/// to ensure proper resource cleanup.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// let font = Font::NORMAL;
|
||||
/// let font = FONT_NORMAL;
|
||||
/// font.with_glyph_data(|data| {
|
||||
/// let glyph = data.get_glyph('A');
|
||||
/// // use glyph...
|
||||
@ -150,57 +161,36 @@ impl GlyphData {
|
||||
c => c,
|
||||
};
|
||||
let gl_data = self.get_glyph_data(ch as u16);
|
||||
|
||||
Glyph::load(unwrap!(gl_data, "Failed to load glyph"))
|
||||
Glyph::load(gl_data)
|
||||
}
|
||||
|
||||
fn get_glyph_data(&self, codepoint: u16) -> Option<&[u8]> {
|
||||
display::get_font_info(self.font.into()).map(|font_info| {
|
||||
if codepoint >= ' ' as u16 && codepoint < 0x7F {
|
||||
// ASCII character
|
||||
let offset = codepoint - ' ' as u16;
|
||||
unsafe {
|
||||
let ptr = *font_info.glyph_data.offset(offset as isize);
|
||||
self.load_glyph_from_ptr(ptr)
|
||||
}
|
||||
} else {
|
||||
#[cfg(feature = "translations")]
|
||||
{
|
||||
if codepoint >= 0x7F {
|
||||
// UTF8 character from embedded blob
|
||||
if let Some(glyph) = self
|
||||
.translations_guard
|
||||
.as_ref()
|
||||
.and_then(|guard| guard.as_ref())
|
||||
.and_then(|translations| {
|
||||
translations.get_utf8_glyph(codepoint, self.font as u16)
|
||||
})
|
||||
{
|
||||
return glyph;
|
||||
}
|
||||
fn get_glyph_data(&self, codepoint: u16) -> &[u8] {
|
||||
if codepoint >= ' ' as u16 && codepoint < 0x7F {
|
||||
// ASCII character
|
||||
let offset = codepoint - ' ' as u16;
|
||||
self.font.glyph_data[offset as usize]
|
||||
} else {
|
||||
#[cfg(feature = "translations")]
|
||||
{
|
||||
if codepoint >= 0x7F {
|
||||
// UTF8 character from embedded blob
|
||||
if let Some(glyph) = self
|
||||
.translations_guard
|
||||
.as_ref()
|
||||
.and_then(|guard| guard.as_ref())
|
||||
.and_then(|translations| {
|
||||
// let font_id = font_to_font_id(self.font);
|
||||
let font_id = 1;
|
||||
translations.get_utf8_glyph(codepoint, font_id)
|
||||
})
|
||||
{
|
||||
return glyph;
|
||||
}
|
||||
}
|
||||
self.glyph_nonprintable()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns glyph data slice from a raw pointer by reading the header and
|
||||
/// calculating full size.
|
||||
unsafe fn load_glyph_from_ptr(&self, ptr: *const u8) -> &[u8] {
|
||||
unsafe {
|
||||
let header = slice::from_raw_parts(ptr, 2);
|
||||
let full_size = calculate_glyph_size(header);
|
||||
slice::from_raw_parts(ptr, full_size)
|
||||
self.font.glyph_nonprintable
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns glyph data slize for non-printable characters.
|
||||
fn glyph_nonprintable(&self) -> &[u8] {
|
||||
display::get_font_info(self.font.into())
|
||||
.map(|font_info| unsafe { self.load_glyph_from_ptr(font_info.glyph_nonprintable) })
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
fn calculate_glyph_size(header: &[u8]) -> usize {
|
||||
@ -218,31 +208,9 @@ fn calculate_glyph_size(header: &[u8]) -> usize {
|
||||
5 + data_bytes as usize // header (5 bytes) + bitmap data
|
||||
}
|
||||
|
||||
/// Font constants. Keep in sync with `font_id_t` definition in
|
||||
/// `core/embed/gfx/fonts/fonts.h`.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, FromPrimitive)]
|
||||
#[repr(u8)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum Font {
|
||||
NORMAL = 1,
|
||||
BOLD = 2,
|
||||
MONO = 3,
|
||||
BIG = 4,
|
||||
DEMIBOLD = 5,
|
||||
NORMAL_UPPER = 6,
|
||||
BOLD_UPPER = 7,
|
||||
SUB = 8,
|
||||
}
|
||||
|
||||
impl From<Font> for i32 {
|
||||
fn from(font: Font) -> i32 {
|
||||
-(font as i32)
|
||||
}
|
||||
}
|
||||
|
||||
impl Font {
|
||||
impl FontInfo {
|
||||
/// Supports UTF8 characters
|
||||
pub fn text_width(self, text: &str) -> i16 {
|
||||
pub fn text_width(&'static self, text: &str) -> i16 {
|
||||
self.with_glyph_data(|data| {
|
||||
text.chars().fold(0, |acc, c| {
|
||||
let char_width = data.get_glyph(c).adv;
|
||||
@ -253,7 +221,7 @@ impl Font {
|
||||
|
||||
/// Width of the text that is visible.
|
||||
/// Not including the spaces before the first and after the last character.
|
||||
pub fn visible_text_width(self, text: &str) -> i16 {
|
||||
pub fn visible_text_width(&'static self, text: &str) -> i16 {
|
||||
if text.is_empty() {
|
||||
// No text, no width.
|
||||
return 0;
|
||||
@ -280,7 +248,7 @@ impl Font {
|
||||
/// It determines this height by finding the highest
|
||||
/// pixel above the baseline and the lowest pixel below the baseline among
|
||||
/// the glyphs representing the characters in the provided text.
|
||||
pub fn visible_text_height(self, text: &str) -> i16 {
|
||||
pub fn visible_text_height(&'static self, text: &str) -> i16 {
|
||||
let (mut ascent, mut descent) = (0, 0);
|
||||
self.with_glyph_data(|data| {
|
||||
for c in text.chars() {
|
||||
@ -297,13 +265,13 @@ impl Font {
|
||||
///
|
||||
/// This function computes the height of a string containing both
|
||||
/// uppercase and lowercase characters of the given font.
|
||||
pub fn allcase_text_height(self) -> i16 {
|
||||
pub fn allcase_text_height(&'static self) -> i16 {
|
||||
self.visible_text_height("Ay")
|
||||
}
|
||||
|
||||
/// Returning the x-bearing (offset) of the first character.
|
||||
/// Useful to enforce that the text is positioned correctly (e.g. centered).
|
||||
pub fn start_x_bearing(self, text: &str) -> i16 {
|
||||
pub fn start_x_bearing(&'static self, text: &str) -> i16 {
|
||||
if text.is_empty() {
|
||||
return 0;
|
||||
}
|
||||
@ -313,23 +281,23 @@ impl Font {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn char_width(self, ch: char) -> i16 {
|
||||
pub fn char_width(&'static self, ch: char) -> i16 {
|
||||
self.with_glyph_data(|data| data.get_glyph(ch).adv)
|
||||
}
|
||||
|
||||
pub fn text_height(self) -> i16 {
|
||||
unwrap!(display::get_font_info(self.into())).height as i16
|
||||
pub fn text_height(&'static self) -> i16 {
|
||||
self.height
|
||||
}
|
||||
|
||||
pub fn text_max_height(self) -> i16 {
|
||||
unwrap!(display::get_font_info(self.into())).max_height as i16
|
||||
pub fn text_max_height(&'static self) -> i16 {
|
||||
self.max_height
|
||||
}
|
||||
|
||||
pub fn text_baseline(self) -> i16 {
|
||||
unwrap!(display::get_font_info(self.into())).baseline as i16
|
||||
pub fn text_baseline(&'static self) -> i16 {
|
||||
self.baseline
|
||||
}
|
||||
|
||||
pub fn line_height(self) -> i16 {
|
||||
pub fn line_height(&'static self) -> i16 {
|
||||
constant::LINE_SPACE + self.text_height()
|
||||
}
|
||||
|
||||
@ -339,7 +307,7 @@ impl Font {
|
||||
///
|
||||
/// Returns x-coordinate of the centered text start (including left
|
||||
/// bearing).
|
||||
pub fn horz_center(&self, start: i16, end: i16, text: &str) -> i16 {
|
||||
pub fn horz_center(&'static self, start: i16, end: i16, text: &str) -> i16 {
|
||||
(start + end - self.visible_text_width(text)) / 2 - self.start_x_bearing(text)
|
||||
}
|
||||
|
||||
@ -348,25 +316,25 @@ impl Font {
|
||||
/// The `text` is centered between `start` and `end`.
|
||||
///
|
||||
/// Returns y-coordinate of the centered text baseline.
|
||||
pub fn vert_center(&self, start: i16, end: i16, text: &str) -> i16 {
|
||||
pub fn vert_center(&'static self, start: i16, end: i16, text: &str) -> i16 {
|
||||
(start + end + self.visible_text_height(text)) / 2
|
||||
}
|
||||
|
||||
/// Safely manages temporary access to glyph data without risking
|
||||
/// translation lock deadlocks. See `GlyphData` for more details.
|
||||
pub fn with_glyph_data<T, F>(&self, f: F) -> T
|
||||
pub fn with_glyph_data<T, F>(&'static self, f: F) -> T
|
||||
where
|
||||
F: FnOnce(&GlyphData) -> T,
|
||||
{
|
||||
// Create a new GlyphData instance that will be dropped at the end of this
|
||||
// function, releasing any translations lock
|
||||
let glyph_data = GlyphData::new(*self);
|
||||
let glyph_data = GlyphData::new(self);
|
||||
f(&glyph_data)
|
||||
}
|
||||
|
||||
/// Get the longest prefix of a given `text` (breaking at word boundaries)
|
||||
/// that will fit into the area `width` pixels wide.
|
||||
pub fn longest_prefix(self, width: i16, text: &str) -> &str {
|
||||
pub fn longest_prefix<'a>(&'static self, width: i16, text: &'a str) -> &'a str {
|
||||
let mut prev_word_boundary = 0;
|
||||
let mut text_width = 0;
|
||||
self.with_glyph_data(|data| {
|
||||
@ -388,7 +356,7 @@ impl Font {
|
||||
|
||||
/// Get the length of the longest suffix from a given `text`
|
||||
/// that will fit into the area `width` pixels wide.
|
||||
pub fn longest_suffix(self, width: i16, text: &str) -> usize {
|
||||
pub fn longest_suffix(&'static self, width: i16, text: &str) -> usize {
|
||||
let mut text_width = 0;
|
||||
|
||||
self.with_glyph_data(|data| {
|
||||
@ -404,7 +372,7 @@ impl Font {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn visible_text_height_ex(&self, text: &str) -> (i16, i16) {
|
||||
pub fn visible_text_height_ex(&'static self, text: &str) -> (i16, i16) {
|
||||
let (mut ascent, mut descent) = (0, 0);
|
||||
self.with_glyph_data(|data| {
|
||||
for c in text.chars() {
|
||||
@ -425,14 +393,14 @@ pub trait GlyphMetrics {
|
||||
|
||||
impl GlyphMetrics for Font {
|
||||
fn char_width(&self, ch: char) -> i16 {
|
||||
Font::char_width(*self, ch)
|
||||
FontInfo::char_width(self, ch)
|
||||
}
|
||||
|
||||
fn text_width(&self, text: &str) -> i16 {
|
||||
Font::text_width(*self, text)
|
||||
FontInfo::text_width(self, text)
|
||||
}
|
||||
|
||||
fn line_height(&self) -> i16 {
|
||||
Font::line_height(*self)
|
||||
FontInfo::line_height(self)
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
trezorhal::secbool::secbool,
|
||||
ui::{
|
||||
component::{connect::Connect, Label},
|
||||
display::{self, Color, Font, Icon},
|
||||
display::{self, font, Color, Icon},
|
||||
geometry::{Point, Rect},
|
||||
layout::simplified::{run, show},
|
||||
},
|
||||
@ -75,7 +75,7 @@ impl UIBolt {
|
||||
render_on_display(None, Some(bg_color), |target| {
|
||||
shape::Text::new(Point::new(SCREEN.width() / 2, SCREEN.height() - 45), text)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(fg_color)
|
||||
.render(target);
|
||||
|
||||
@ -385,7 +385,7 @@ impl BootloaderUI for UIBolt {
|
||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5 - 50);
|
||||
shape::Text::new(pos, text)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG) //COLOR_BL_BG
|
||||
.render(target);
|
||||
|
||||
@ -402,7 +402,7 @@ impl BootloaderUI for UIBolt {
|
||||
|
||||
shape::Text::new(pos, version_text.as_str())
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
@ -417,7 +417,7 @@ impl BootloaderUI for UIBolt {
|
||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||
shape::Text::new(pos, text.as_str())
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
@ -425,7 +425,7 @@ impl BootloaderUI for UIBolt {
|
||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||
shape::Text::new(pos, "click to continue ...")
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::ui::{
|
||||
component::{Component, Event, EventCtx, Never, Pad},
|
||||
constant::screen,
|
||||
display::{toif::Toif, Font},
|
||||
display::{font, toif::Toif},
|
||||
geometry::{Alignment, Alignment2D, Offset, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
@ -41,13 +41,13 @@ impl Component for Welcome {
|
||||
|
||||
shape::Text::new(screen().top_center() + Offset::y(102), "Get started with")
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(GREY_MEDIUM)
|
||||
.render(target);
|
||||
|
||||
shape::Text::new(screen().top_center() + Offset::y(126), "your Trezor at")
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(GREY_MEDIUM)
|
||||
.render(target);
|
||||
|
||||
|
@ -7,9 +7,10 @@ use crate::{
|
||||
ui::{
|
||||
component::{text::TextStyle, Component, Event, EventCtx, Pad, Timer},
|
||||
display::{
|
||||
font,
|
||||
image::{ImageInfo, ToifFormat},
|
||||
toif::Icon,
|
||||
Color, Font,
|
||||
Color,
|
||||
},
|
||||
event::TouchEvent,
|
||||
geometry::{Alignment, Alignment2D, Insets, Offset, Point, Rect},
|
||||
@ -121,7 +122,7 @@ impl Homescreen {
|
||||
TR::progress__locking_device.map_translated(|t| {
|
||||
shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(theme::FG);
|
||||
});
|
||||
self.loader.render(target)
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
base::ComponentExt, text::TextStyle, Child, Component, Event, EventCtx, Label, Maybe,
|
||||
Never, Pad, Timer,
|
||||
},
|
||||
display::Font,
|
||||
display::font,
|
||||
event::TouchEvent,
|
||||
geometry::{Alignment, Alignment2D, Grid, Insets, Offset, Rect},
|
||||
shape::{self, Renderer},
|
||||
@ -363,21 +363,22 @@ impl PinDots {
|
||||
}
|
||||
|
||||
fn render_digits<'s>(&self, area: Rect, target: &mut impl Renderer<'s>) {
|
||||
let center = area.center() + Offset::y(Font::MONO.text_height() / 2);
|
||||
let right = center + Offset::x(Font::MONO.text_width("0") * (MAX_VISIBLE_DOTS as i16) / 2);
|
||||
let center = area.center() + Offset::y(font::FONT_MONO.text_height() / 2);
|
||||
let right =
|
||||
center + Offset::x(font::FONT_MONO.text_width("0") * (MAX_VISIBLE_DOTS as i16) / 2);
|
||||
let digits = self.digits.len();
|
||||
|
||||
if digits <= MAX_VISIBLE_DOTS {
|
||||
shape::Text::new(center, &self.digits)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::MONO)
|
||||
.with_font(font::FONT_MONO)
|
||||
.with_fg(self.style.text_color)
|
||||
.render(target);
|
||||
} else {
|
||||
let offset: usize = digits.saturating_sub(MAX_VISIBLE_DIGITS);
|
||||
shape::Text::new(right, &self.digits[offset..])
|
||||
.with_align(Alignment::End)
|
||||
.with_font(Font::MONO)
|
||||
.with_font(font::FONT_MONO)
|
||||
.with_fg(self.style.text_color)
|
||||
.render(target);
|
||||
}
|
||||
@ -421,11 +422,11 @@ impl PinDots {
|
||||
}
|
||||
if last_digit && digits > 0 {
|
||||
let last = &self.digits[(digits - 1)..digits];
|
||||
cursor.y = area.center().y + (Font::MONO.text_height() / 2);
|
||||
cursor.y = area.center().y + (font::FONT_MONO.text_height() / 2);
|
||||
let offset = Offset::x(Self::DOT / 2);
|
||||
shape::Text::new(cursor + offset, last)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::MONO)
|
||||
.with_font(font::FONT_MONO)
|
||||
.with_fg(self.style.text_color)
|
||||
.render(target);
|
||||
} else {
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
text::paragraphs::{Paragraph, Paragraphs},
|
||||
Child, Component, Event, EventCtx, Pad,
|
||||
},
|
||||
display::Font,
|
||||
display::font,
|
||||
geometry::{Alignment, Grid, Insets, Offset, Rect},
|
||||
shape::{self, Renderer},
|
||||
},
|
||||
@ -206,7 +206,7 @@ impl Component for NumberInput {
|
||||
let mut buf = [0u8; 10];
|
||||
|
||||
if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) {
|
||||
let digit_font = Font::DEMIBOLD;
|
||||
let digit_font = font::FONT_DEMIBOLD;
|
||||
let y_offset = digit_font.text_height() / 2 + Button::BASELINE_OFFSET;
|
||||
|
||||
shape::Bar::new(self.area).with_bg(theme::BG).render(target);
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
text::paragraphs::{Paragraph, Paragraphs},
|
||||
Child, Component, Event, EventCtx, Label, Never, Pad,
|
||||
},
|
||||
display::{Font, LOADER_MAX},
|
||||
display::{font, LOADER_MAX},
|
||||
geometry::{Insets, Offset, Rect},
|
||||
shape::Renderer,
|
||||
util::animation_disabled,
|
||||
@ -65,7 +65,7 @@ impl Component for Progress {
|
||||
.map(|t| t.chars().filter(|c| *c == '\n').count() as i16);
|
||||
let (title, rest) = Self::AREA.split_top(self.title.inner().max_size().y);
|
||||
let (loader, description) =
|
||||
rest.split_bottom(Font::NORMAL.line_height() * description_lines);
|
||||
rest.split_bottom(font::FONT_NORMAL.line_height() * description_lines);
|
||||
let loader = loader.inset(Insets::top(theme::CONTENT_BORDER));
|
||||
self.title.place(title);
|
||||
self.loader_y_offset = loader.center().y - constant::screen().center().y;
|
||||
|
@ -3,7 +3,7 @@ use crate::{
|
||||
ui::{
|
||||
component::{text::TextStyle, Child, Component, Event, EventCtx, Label, Never, Pad},
|
||||
constant::screen,
|
||||
display::{Color, Font, Icon},
|
||||
display::{font, Color, Icon},
|
||||
geometry::{Alignment2D, Insets, Offset, Point, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
@ -34,11 +34,11 @@ impl ResultStyle {
|
||||
}
|
||||
|
||||
pub const fn message_style(&self) -> TextStyle {
|
||||
TextStyle::new(Font::NORMAL, self.fg_color, self.bg_color, FG, FG)
|
||||
TextStyle::new(font::FONT_NORMAL, self.fg_color, self.bg_color, FG, FG)
|
||||
}
|
||||
|
||||
pub const fn title_style(&self) -> TextStyle {
|
||||
TextStyle::new(Font::BOLD_UPPER, self.fg_color, self.bg_color, FG, FG)
|
||||
TextStyle::new(font::FONT_BOLD_UPPER, self.fg_color, self.bg_color, FG, FG)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ use crate::{
|
||||
strutil::TString,
|
||||
ui::{
|
||||
component::{Component, Event, EventCtx, Never, Paginate},
|
||||
display::Font,
|
||||
display::{font, Font},
|
||||
geometry::{Offset, Rect},
|
||||
shape::{self, Renderer},
|
||||
},
|
||||
@ -16,7 +16,7 @@ use ufmt::uwrite;
|
||||
|
||||
const WORDS_PER_PAGE: usize = 4;
|
||||
const TOP_PADDING_OFFSET: i16 = 13;
|
||||
const WORD_FONT: Font = Font::MONO;
|
||||
const WORD_FONT: Font = font::FONT_MONO;
|
||||
const MAX_WORDS: usize = 33; // super-shamir has 33 words, all other have less
|
||||
|
||||
/// Showing the given share words.
|
||||
|
@ -14,12 +14,12 @@ use crate::ui::display::toif::Toif;
|
||||
const TEXT_BOTTOM_MARGIN: i16 = 24; // matching the homescreen label margin
|
||||
const ICON_TOP_MARGIN: i16 = 48;
|
||||
#[cfg(not(feature = "bootloader"))]
|
||||
const MODEL_NAME_FONT: display::Font = display::Font::DEMIBOLD;
|
||||
#[cfg(not(feature = "bootloader"))]
|
||||
use crate::{
|
||||
trezorhal::model,
|
||||
ui::{display, geometry::Alignment},
|
||||
};
|
||||
#[cfg(not(feature = "bootloader"))]
|
||||
const MODEL_NAME_FONT: display::Font = display::font::FONT_DEMIBOLD;
|
||||
|
||||
pub struct WelcomeScreen {
|
||||
area: Rect,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::ui::{
|
||||
component::{text::TextStyle, LineBreaking::BreakWordsNoHyphen},
|
||||
constant::{HEIGHT, WIDTH},
|
||||
display::{Color, Font},
|
||||
display::{font, Color},
|
||||
geometry::{Offset, Point, Rect},
|
||||
util::include_res,
|
||||
};
|
||||
@ -76,7 +76,7 @@ pub const START_URL: &[u8] = include_res!("layout_bolt/res/start.toif");
|
||||
pub fn button_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_BG,
|
||||
button_color: WHITE,
|
||||
background_color: BLD_BG,
|
||||
@ -85,7 +85,7 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_BG,
|
||||
button_color: BLD_INSTALL_BTN_COLOR_ACTIVE,
|
||||
background_color: BLD_BG,
|
||||
@ -94,7 +94,7 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK,
|
||||
background_color: FG,
|
||||
@ -108,7 +108,7 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
||||
pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: WHITE,
|
||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
@ -117,7 +117,7 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: WHITE,
|
||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR_ACTIVE,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
@ -126,7 +126,7 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
background_color: WHITE,
|
||||
@ -140,7 +140,7 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||
pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_WIPE_COLOR,
|
||||
button_color: BLD_WIPE_BTN_COLOR,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
@ -149,7 +149,7 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_WIPE_COLOR,
|
||||
button_color: BLD_WIPE_BTN_COLOR_ACTIVE,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
@ -158,7 +158,7 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK,
|
||||
background_color: FG,
|
||||
@ -172,7 +172,7 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||
pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BG,
|
||||
background_color: BLD_BG,
|
||||
@ -181,7 +181,7 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||
border_width: 2,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BG,
|
||||
background_color: BLD_BG,
|
||||
@ -190,7 +190,7 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||
border_width: 2,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BLD_BG,
|
||||
background_color: BLD_BG,
|
||||
@ -204,7 +204,7 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||
pub fn button_bld() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BTN_COLOR,
|
||||
background_color: BLD_BG,
|
||||
@ -213,7 +213,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BTN_COLOR_ACTIVE,
|
||||
background_color: BLD_BG,
|
||||
@ -222,7 +222,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BLD_BTN_COLOR,
|
||||
background_color: BLD_BG,
|
||||
@ -235,7 +235,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
||||
|
||||
pub const fn text_title(bg: Color) -> TextStyle {
|
||||
TextStyle::new(
|
||||
Font::BOLD_UPPER,
|
||||
font::FONT_BOLD_UPPER,
|
||||
BLD_TITLE_COLOR,
|
||||
bg,
|
||||
BLD_TITLE_COLOR,
|
||||
@ -243,27 +243,30 @@ pub const fn text_title(bg: Color) -> TextStyle {
|
||||
)
|
||||
}
|
||||
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_NORMAL: TextStyle =
|
||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_WARNING: TextStyle = TextStyle::new(
|
||||
Font::BOLD_UPPER,
|
||||
font::FONT_BOLD_UPPER,
|
||||
BLD_WARN_COLOR,
|
||||
BLD_BG,
|
||||
BLD_WARN_COLOR,
|
||||
BLD_WARN_COLOR,
|
||||
);
|
||||
pub const fn text_fingerprint(bg: Color) -> TextStyle {
|
||||
TextStyle::new(Font::NORMAL, BLD_FG, bg, BLD_FG, BLD_FG).with_line_breaking(BreakWordsNoHyphen)
|
||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, bg, BLD_FG, BLD_FG)
|
||||
.with_line_breaking(BreakWordsNoHyphen)
|
||||
}
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD_UPPER, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_BOLD: TextStyle =
|
||||
TextStyle::new(font::FONT_BOLD_UPPER, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_WIPE_BOLD: TextStyle = TextStyle::new(
|
||||
Font::BOLD_UPPER,
|
||||
font::FONT_BOLD_UPPER,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
BLD_WIPE_COLOR,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
);
|
||||
pub const TEXT_WIPE_NORMAL: TextStyle = TextStyle::new(
|
||||
Font::NORMAL,
|
||||
font::FONT_NORMAL,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
BLD_WIPE_COLOR,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
|
@ -8,7 +8,7 @@ use crate::{
|
||||
text::{layout::Chunks, LineBreaking, PageBreaking, TextStyle},
|
||||
FixedHeightBar,
|
||||
},
|
||||
display::{Color, Font},
|
||||
display::{font, Color},
|
||||
geometry::{Insets, Offset},
|
||||
util::{include_icon, include_res},
|
||||
},
|
||||
@ -118,15 +118,15 @@ pub const fn label_default() -> TextStyle {
|
||||
}
|
||||
|
||||
pub const fn label_keyboard() -> TextStyle {
|
||||
TextStyle::new(Font::DEMIBOLD, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(font::FONT_DEMIBOLD, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_keyboard_prompt() -> TextStyle {
|
||||
TextStyle::new(Font::DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(font::FONT_DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_keyboard_warning() -> TextStyle {
|
||||
TextStyle::new(Font::DEMIBOLD, RED, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(font::FONT_DEMIBOLD, RED, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_keyboard_minor() -> TextStyle {
|
||||
@ -154,21 +154,27 @@ pub const fn label_progress() -> TextStyle {
|
||||
}
|
||||
|
||||
pub const fn label_title() -> TextStyle {
|
||||
TextStyle::new(Font::BOLD_UPPER, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(
|
||||
font::FONT_BOLD_UPPER,
|
||||
GREY_LIGHT,
|
||||
BG,
|
||||
GREY_LIGHT,
|
||||
GREY_LIGHT,
|
||||
)
|
||||
}
|
||||
|
||||
pub const fn label_subtitle() -> TextStyle {
|
||||
TextStyle::new(Font::MONO, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(font::FONT_MONO, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_coinjoin_progress() -> TextStyle {
|
||||
TextStyle::new(Font::BOLD_UPPER, FG, YELLOW, FG, FG)
|
||||
TextStyle::new(font::FONT_BOLD_UPPER, FG, YELLOW, FG, FG)
|
||||
}
|
||||
|
||||
pub const fn button_default() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
@ -177,7 +183,7 @@ pub const fn button_default() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: GREY_MEDIUM,
|
||||
background_color: BG,
|
||||
@ -186,7 +192,7 @@ pub const fn button_default() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
@ -200,7 +206,7 @@ pub const fn button_default() -> ButtonStyleSheet {
|
||||
pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: GREEN,
|
||||
background_color: BG,
|
||||
@ -209,7 +215,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: GREEN_DARK,
|
||||
background_color: BG,
|
||||
@ -218,7 +224,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREEN_DARK,
|
||||
background_color: BG,
|
||||
@ -232,7 +238,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: RED,
|
||||
background_color: BG,
|
||||
@ -241,7 +247,7 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: RED_DARK,
|
||||
background_color: BG,
|
||||
@ -250,7 +256,7 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: RED,
|
||||
background_color: BG,
|
||||
@ -268,7 +274,7 @@ pub const fn button_danger() -> ButtonStyleSheet {
|
||||
pub const fn button_reset() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: YELLOW,
|
||||
background_color: BG,
|
||||
@ -277,7 +283,7 @@ pub const fn button_reset() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: YELLOW_DARK,
|
||||
background_color: BG,
|
||||
@ -286,7 +292,7 @@ pub const fn button_reset() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: YELLOW,
|
||||
background_color: BG,
|
||||
@ -300,7 +306,7 @@ pub const fn button_reset() -> ButtonStyleSheet {
|
||||
pub const fn button_moreinfo() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: BG,
|
||||
background_color: BG,
|
||||
@ -309,7 +315,7 @@ pub const fn button_moreinfo() -> ButtonStyleSheet {
|
||||
border_width: 2,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: BG,
|
||||
background_color: BG,
|
||||
@ -318,7 +324,7 @@ pub const fn button_moreinfo() -> ButtonStyleSheet {
|
||||
border_width: 2,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
background_color: BG,
|
||||
@ -332,7 +338,7 @@ pub const fn button_moreinfo() -> ButtonStyleSheet {
|
||||
pub const fn button_info() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: BLUE,
|
||||
background_color: BG,
|
||||
@ -341,7 +347,7 @@ pub const fn button_info() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: FG,
|
||||
button_color: BLUE_DARK,
|
||||
background_color: BG,
|
||||
@ -350,7 +356,7 @@ pub const fn button_info() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD_UPPER,
|
||||
font: font::FONT_BOLD_UPPER,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BLUE,
|
||||
background_color: BG,
|
||||
@ -364,7 +370,7 @@ pub const fn button_info() -> ButtonStyleSheet {
|
||||
pub const fn button_pin() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
@ -373,7 +379,7 @@ pub const fn button_pin() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREY_MEDIUM,
|
||||
background_color: BG,
|
||||
@ -382,7 +388,7 @@ pub const fn button_pin() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG, // so there is no "button" itself, just the text
|
||||
background_color: BG,
|
||||
@ -396,7 +402,7 @@ pub const fn button_pin() -> ButtonStyleSheet {
|
||||
pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREEN,
|
||||
background_color: BG,
|
||||
@ -405,7 +411,7 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREEN_DARK,
|
||||
background_color: BG,
|
||||
@ -414,7 +420,7 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
@ -428,7 +434,7 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK, // same as PIN buttons
|
||||
background_color: BG,
|
||||
@ -437,7 +443,7 @@ pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREEN_DARK,
|
||||
background_color: BG,
|
||||
@ -446,7 +452,7 @@ pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
background_color: BG,
|
||||
@ -460,7 +466,7 @@ pub const fn button_pin_autocomplete() -> ButtonStyleSheet {
|
||||
pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: GREEN_DARK,
|
||||
button_color: GREEN,
|
||||
background_color: BG,
|
||||
@ -469,7 +475,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREEN_DARK,
|
||||
background_color: BG,
|
||||
@ -478,7 +484,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
@ -492,7 +498,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK, // same as PIN buttons
|
||||
background_color: BG,
|
||||
@ -501,7 +507,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREEN_DARK,
|
||||
background_color: BG,
|
||||
@ -510,7 +516,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: font::FONT_MONO,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
background_color: BG,
|
||||
@ -524,7 +530,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||
pub const fn button_counter() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: font::FONT_DEMIBOLD,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
@ -533,7 +539,7 @@ pub const fn button_counter() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: font::FONT_DEMIBOLD,
|
||||
text_color: FG,
|
||||
button_color: GREY_MEDIUM,
|
||||
background_color: BG,
|
||||
@ -542,7 +548,7 @@ pub const fn button_counter() -> ButtonStyleSheet {
|
||||
border_width: 0,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: font::FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
background_color: BG,
|
||||
@ -587,10 +593,13 @@ pub const fn loader_lock_icon() -> LoaderStyleSheet {
|
||||
}
|
||||
}
|
||||
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(Font::DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD_UPPER, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_MONO: TextStyle = TextStyle::new(Font::MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
pub const TEXT_NORMAL: TextStyle =
|
||||
TextStyle::new(font::FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_DEMIBOLD: TextStyle =
|
||||
TextStyle::new(font::FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_BOLD: TextStyle =
|
||||
TextStyle::new(font::FONT_BOLD_UPPER, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_MONO: TextStyle = TextStyle::new(font::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
||||
@ -621,13 +630,13 @@ pub fn get_chunkified_text_style(character_length: usize) -> &'static TextStyle
|
||||
}
|
||||
|
||||
pub const TEXT_NORMAL_OFF_WHITE: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
TextStyle::new(font::FONT_NORMAL, OFF_WHITE, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_CHECKLIST_DEFAULT: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
TextStyle::new(font::FONT_NORMAL, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_CHECKLIST_SELECTED: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
TextStyle::new(font::FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_CHECKLIST_DONE: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, GREEN_DARK, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
TextStyle::new(font::FONT_NORMAL, GREEN_DARK, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
|
||||
pub const CONTENT_BORDER: i16 = 0;
|
||||
pub const BUTTON_HEIGHT: i16 = 50;
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
ui::{
|
||||
component::{Child, Component, Event, EventCtx, Pad},
|
||||
constant::screen,
|
||||
display::{Font, Icon},
|
||||
display::{font, Icon},
|
||||
geometry::{Alignment, Alignment2D, Offset, Point, Rect},
|
||||
layout::simplified::ReturnToC,
|
||||
shape,
|
||||
@ -60,13 +60,13 @@ impl Choice for MenuChoice {
|
||||
|
||||
shape::Text::new(SCREEN_CENTER, self.first_line)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
|
||||
shape::Text::new(SCREEN_CENTER + Offset::y(10), self.second_line)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
component::{connect::Connect, Label, LineBreaking::BreakWordsNoHyphen},
|
||||
constant,
|
||||
constant::{HEIGHT, SCREEN},
|
||||
display::{self, Color, Font, Icon},
|
||||
display::{self, font, Color, Icon},
|
||||
geometry::{Alignment2D, Offset, Point},
|
||||
layout::simplified::{run, show, ReturnToC},
|
||||
},
|
||||
@ -76,13 +76,13 @@ impl UICaesar {
|
||||
|
||||
shape::Text::new(SCREEN.center() + Offset::y(8), text)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::BOLD)
|
||||
.with_font(font::FONT_BOLD)
|
||||
.with_fg(fg_color)
|
||||
.render(target);
|
||||
|
||||
shape::Text::new(SCREEN.center() + Offset::y(20), text2)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::BOLD)
|
||||
.with_font(font::FONT_BOLD)
|
||||
.with_fg(fg_color)
|
||||
.render(target);
|
||||
});
|
||||
@ -326,7 +326,7 @@ impl BootloaderUI for UICaesar {
|
||||
let pos = Point::new(constant::WIDTH / 2, 36);
|
||||
shape::Text::new(pos, text)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG) //COLOR_BL_BG
|
||||
.render(target);
|
||||
|
||||
@ -343,7 +343,7 @@ impl BootloaderUI for UICaesar {
|
||||
|
||||
shape::Text::new(pos, version_text.as_str())
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
@ -358,7 +358,7 @@ impl BootloaderUI for UICaesar {
|
||||
let pos = Point::new(constant::WIDTH / 2, HEIGHT - 5);
|
||||
shape::Text::new(pos, text.as_str())
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::ui::{
|
||||
component::{Component, Event, EventCtx, Never, Pad},
|
||||
display::Font,
|
||||
display::font,
|
||||
geometry::{Alignment, Offset, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
@ -39,19 +39,19 @@ impl Component for Welcome {
|
||||
|
||||
shape::Text::new(top_center + Offset::y(24), "Get started with")
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
|
||||
shape::Text::new(top_center + Offset::y(32), "your Trezor at")
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
|
||||
shape::Text::new(top_center + Offset::y(48), "trezor.io/start")
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::BOLD)
|
||||
.with_font(font::FONT_BOLD)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ use crate::{
|
||||
strutil::TString,
|
||||
ui::{
|
||||
component::{Child, Component, ComponentExt, Event, EventCtx, Label, Pad},
|
||||
display::{Color, Font},
|
||||
display::{font, Color},
|
||||
geometry::{Point, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
@ -201,7 +201,7 @@ impl Component for Confirm<'_> {
|
||||
let mut display_top_left = |text: TString| {
|
||||
text.map(|t| {
|
||||
shape::Text::new(Point::zero(), t)
|
||||
.with_font(Font::BOLD)
|
||||
.with_font(font::FONT_BOLD)
|
||||
.with_fg(WHITE)
|
||||
.render(target);
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
ui::{
|
||||
component::{Component, Event, EventCtx, Never},
|
||||
constant,
|
||||
display::{Color, Font, Icon},
|
||||
display::{font, Color, Font, Icon},
|
||||
event::PhysicalButton,
|
||||
geometry::{Alignment2D, Offset, Point, Rect},
|
||||
shape,
|
||||
@ -367,7 +367,7 @@ impl ButtonDetails {
|
||||
pub fn text(text: TString<'static>) -> Self {
|
||||
Self {
|
||||
content: ButtonContent::Text(text),
|
||||
font: Font::NORMAL_UPPER,
|
||||
font: font::FONT_NORMAL_UPPER,
|
||||
duration: None,
|
||||
with_outline: true,
|
||||
with_arms: false,
|
||||
@ -381,7 +381,7 @@ impl ButtonDetails {
|
||||
pub fn icon(icon: Icon) -> Self {
|
||||
Self {
|
||||
content: ButtonContent::Icon(icon),
|
||||
font: Font::NORMAL_UPPER,
|
||||
font: font::FONT_NORMAL_UPPER,
|
||||
duration: None,
|
||||
with_outline: false,
|
||||
with_arms: false,
|
||||
@ -561,7 +561,7 @@ impl ButtonLayout {
|
||||
Some(
|
||||
ButtonDetails::text("i".into())
|
||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||
.with_font(Font::NORMAL),
|
||||
.with_font(font::FONT_NORMAL),
|
||||
),
|
||||
)
|
||||
}
|
||||
@ -574,7 +574,7 @@ impl ButtonLayout {
|
||||
Some(
|
||||
ButtonDetails::text("i".into())
|
||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||
.with_font(Font::NORMAL),
|
||||
.with_font(font::FONT_NORMAL),
|
||||
),
|
||||
)
|
||||
}
|
||||
@ -695,7 +695,7 @@ impl ButtonLayout {
|
||||
Some(
|
||||
ButtonDetails::text("i".into())
|
||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||
.with_font(Font::NORMAL),
|
||||
.with_font(font::FONT_NORMAL),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ use crate::{
|
||||
strutil::ShortString,
|
||||
ui::{
|
||||
component::{Component, Event, EventCtx, Never, Pad},
|
||||
display::Font,
|
||||
display::{font, Font},
|
||||
geometry::{Alignment, Point, Rect},
|
||||
shape::{self, Renderer},
|
||||
util::long_line_content_with_ellipsis,
|
||||
@ -43,11 +43,11 @@ impl ChangingTextLine {
|
||||
}
|
||||
|
||||
pub fn center_mono(text: &str, max_len: usize) -> Self {
|
||||
Self::new(text, Font::MONO, Alignment::Center, max_len)
|
||||
Self::new(text, font::FONT_MONO, Alignment::Center, max_len)
|
||||
}
|
||||
|
||||
pub fn center_bold(text: &str, max_len: usize) -> Self {
|
||||
Self::new(text, Font::BOLD_UPPER, Alignment::Center, max_len)
|
||||
Self::new(text, font::FONT_BOLD_UPPER, Alignment::Center, max_len)
|
||||
}
|
||||
|
||||
/// Not showing ellipsis at the beginning of longer texts.
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
text::util::{text_multiline, text_multiline_bottom},
|
||||
Component, Event, EventCtx,
|
||||
},
|
||||
display::Font,
|
||||
display::font,
|
||||
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
@ -88,7 +88,7 @@ impl Component for CoinJoinProgress {
|
||||
target,
|
||||
self.area,
|
||||
TR::coinjoin__title_progress.into(),
|
||||
Font::BOLD,
|
||||
font::FONT_BOLD,
|
||||
theme::FG,
|
||||
theme::BG,
|
||||
Alignment::Center,
|
||||
@ -111,7 +111,7 @@ impl Component for CoinJoinProgress {
|
||||
target,
|
||||
self.area,
|
||||
TR::coinjoin__do_not_disconnect.into(),
|
||||
Font::BOLD,
|
||||
font::FONT_BOLD,
|
||||
theme::FG,
|
||||
theme::BG,
|
||||
Alignment::Center,
|
||||
@ -121,7 +121,7 @@ impl Component for CoinJoinProgress {
|
||||
target,
|
||||
rest.inset(Insets::bottom(FOOTER_TEXT_MARGIN)),
|
||||
self.text,
|
||||
Font::NORMAL,
|
||||
font::FONT_NORMAL,
|
||||
theme::FG,
|
||||
theme::BG,
|
||||
Alignment::Center,
|
||||
|
@ -7,6 +7,7 @@ use crate::{
|
||||
component::{Child, Component, Event, EventCtx, Label},
|
||||
constant::{HEIGHT, WIDTH},
|
||||
display::{
|
||||
font,
|
||||
image::{ImageInfo, ToifFormat},
|
||||
Font, Icon,
|
||||
},
|
||||
@ -32,7 +33,7 @@ const LOGO_ICON_TOP_MARGIN: i16 = 12;
|
||||
const LOCK_ICON_TOP_MARGIN: i16 = 12;
|
||||
const NOTIFICATION_HEIGHT: i16 = 12;
|
||||
const LABEL_OUTSET: i16 = 3;
|
||||
const NOTIFICATION_FONT: Font = Font::NORMAL_UPPER;
|
||||
const NOTIFICATION_FONT: Font = font::FONT_NORMAL_UPPER;
|
||||
const NOTIFICATION_ICON: Icon = theme::ICON_WARNING;
|
||||
const COINJOIN_CORNER: Point = AREA.top_right().ofs(Offset::new(-2, 2));
|
||||
|
||||
|
@ -7,7 +7,7 @@ use crate::{
|
||||
component::{
|
||||
text::common::TextBox, Child, Component, ComponentExt, Event, EventCtx, Timer,
|
||||
},
|
||||
display::{Font, Icon},
|
||||
display::{font, Icon},
|
||||
geometry::Rect,
|
||||
shape::Renderer,
|
||||
},
|
||||
@ -164,7 +164,7 @@ impl<'a> PinEntry<'a> {
|
||||
let mut pin_line = pin_line_content
|
||||
.map(|s| ChangingTextLine::center_bold(s, MAX_PIN_LENGTH).without_ellipsis());
|
||||
if show_subprompt {
|
||||
pin_line.update_font(Font::NORMAL);
|
||||
pin_line.update_font(font::FONT_NORMAL);
|
||||
}
|
||||
|
||||
Self {
|
||||
@ -202,10 +202,10 @@ impl<'a> PinEntry<'a> {
|
||||
let s = ShortString::new();
|
||||
s.capacity() >= MAX_PIN_LENGTH
|
||||
});
|
||||
let mut used_font = Font::BOLD;
|
||||
let mut used_font = font::FONT_BOLD;
|
||||
let pin_line_text = if self.is_empty() && !self.subprompt.is_empty() {
|
||||
// Showing the subprompt in NORMAL font
|
||||
used_font = Font::NORMAL;
|
||||
used_font = font::FONT_NORMAL;
|
||||
self.subprompt.map(|s| unwrap!(ShortString::try_from(s)))
|
||||
} else if self.is_empty() {
|
||||
unwrap!(ShortString::try_from(EMPTY_PIN_STR))
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
Child, Component, Event, EventCtx, Label, Never, Pad,
|
||||
},
|
||||
constant,
|
||||
display::{Font, Icon, LOADER_MAX},
|
||||
display::{font, Icon, LOADER_MAX},
|
||||
geometry::{Alignment2D, Offset, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
@ -99,7 +99,7 @@ impl Component for Progress {
|
||||
};
|
||||
|
||||
let (_loader, description) = rest.split_bottom(
|
||||
BOTTOM_DESCRIPTION_MARGIN + Font::NORMAL.line_height() * description_lines,
|
||||
BOTTOM_DESCRIPTION_MARGIN + font::FONT_NORMAL.line_height() * description_lines,
|
||||
);
|
||||
self.title.place(title);
|
||||
self.loader_y_offset = loader_y_offset;
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
component::{
|
||||
text::util::text_multiline, Child, Component, Event, EventCtx, Never, Paginate,
|
||||
},
|
||||
display::Font,
|
||||
display::{font, Font},
|
||||
geometry::{Alignment, Offset, Rect},
|
||||
shape::{self, Renderer},
|
||||
},
|
||||
@ -21,8 +21,8 @@ const WORDS_PER_PAGE: usize = 3;
|
||||
const EXTRA_LINE_HEIGHT: i16 = -2;
|
||||
const NUMBER_X_OFFSET: i16 = 0;
|
||||
const WORD_X_OFFSET: i16 = 25;
|
||||
const NUMBER_FONT: Font = Font::DEMIBOLD;
|
||||
const WORD_FONT: Font = Font::BIG;
|
||||
const NUMBER_FONT: Font = font::FONT_DEMIBOLD;
|
||||
const WORD_FONT: Font = font::FONT_BIG;
|
||||
const INFO_TOP_OFFSET: i16 = 20;
|
||||
const MAX_WORDS: usize = 33; // super-shamir has 33 words, all other have less
|
||||
|
||||
@ -81,7 +81,7 @@ impl<'a> ShareWords<'a> {
|
||||
target,
|
||||
self.area.split_top(INFO_TOP_OFFSET).1,
|
||||
final_text.as_str().into(),
|
||||
Font::NORMAL,
|
||||
font::FONT_NORMAL,
|
||||
theme::FG,
|
||||
theme::BG,
|
||||
Alignment::Start,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::ui::{
|
||||
component::text::TextStyle,
|
||||
display::{Color, Font},
|
||||
display::{font, Color},
|
||||
util::include_icon,
|
||||
};
|
||||
|
||||
@ -16,5 +16,6 @@ include_icon!(ICON_SUCCESS, "layout_caesar/res/success.toif");
|
||||
include_icon!(ICON_REDO, "layout_caesar/res/redo.toif");
|
||||
include_icon!(ICON_EXIT, "layout_caesar/res/exit.toif");
|
||||
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_NORMAL: TextStyle =
|
||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(font::FONT_BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
|
@ -3,7 +3,7 @@ use crate::ui::{
|
||||
text::{layout::Chunks, TextStyle},
|
||||
LineBreaking, PageBreaking,
|
||||
},
|
||||
display::{Color, Font},
|
||||
display::{font, Color, Font},
|
||||
geometry::Offset,
|
||||
util::include_icon,
|
||||
};
|
||||
@ -17,26 +17,26 @@ pub const FG: Color = WHITE; // Default foreground (text & icon) color.
|
||||
pub const BG: Color = BLACK; // Default background color.
|
||||
|
||||
// Font constants.
|
||||
pub const FONT_BUTTON: Font = Font::NORMAL_UPPER;
|
||||
pub const FONT_HEADER: Font = Font::BOLD_UPPER;
|
||||
pub const FONT_CHOICE_ITEMS: Font = Font::BIG;
|
||||
pub const FONT_BUTTON: Font = font::FONT_NORMAL_UPPER;
|
||||
pub const FONT_HEADER: Font = font::FONT_BOLD_UPPER;
|
||||
pub const FONT_CHOICE_ITEMS: Font = font::FONT_BIG;
|
||||
|
||||
// Text constants.
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, FG, BG, FG, FG)
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(font::FONT_NORMAL, FG, BG, FG, FG)
|
||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||
pub const TEXT_BIG: TextStyle = TextStyle::new(Font::BIG, FG, BG, FG, FG);
|
||||
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(Font::DEMIBOLD, FG, BG, FG, FG);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, FG, BG, FG, FG)
|
||||
pub const TEXT_BIG: TextStyle = TextStyle::new(font::FONT_BIG, FG, BG, FG, FG);
|
||||
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(font::FONT_DEMIBOLD, FG, BG, FG, FG);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(font::FONT_BOLD, FG, BG, FG, FG)
|
||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||
pub const TEXT_BOLD_UPPER: TextStyle = TextStyle::new(Font::BOLD_UPPER, FG, BG, FG, FG)
|
||||
pub const TEXT_BOLD_UPPER: TextStyle = TextStyle::new(font::FONT_BOLD_UPPER, FG, BG, FG, FG)
|
||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||
pub const TEXT_MONO: TextStyle = TextStyle::new(Font::MONO, FG, BG, FG, FG)
|
||||
pub const TEXT_MONO: TextStyle = TextStyle::new(font::FONT_MONO, FG, BG, FG, FG)
|
||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
|
||||
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
|
||||
|
@ -20,7 +20,7 @@ use crate::{
|
||||
},
|
||||
Component, ComponentExt, Empty, FormattedText, Label, LineBreaking, Paginate, Timeout,
|
||||
},
|
||||
display::Font,
|
||||
display::font,
|
||||
geometry,
|
||||
layout::{
|
||||
obj::{LayoutMaybeTrace, LayoutObj, RootComponent},
|
||||
@ -514,7 +514,7 @@ impl FirmwareUI for UICaesar {
|
||||
let right_btn = has_pages_after.then(|| {
|
||||
ButtonDetails::text("i".into())
|
||||
.with_fixed_width(theme::BUTTON_ICON_WIDTH)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
});
|
||||
let middle_btn = Some(ButtonDetails::armed_text(TR::buttons__confirm.into()));
|
||||
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
trezorhal::secbool::secbool,
|
||||
ui::{
|
||||
component::{connect::Connect, Label},
|
||||
display::{self, Color, Font, Icon},
|
||||
display::{self, font, Color, Icon},
|
||||
geometry::{Alignment, Offset, Point, Rect},
|
||||
layout::simplified::{run, show},
|
||||
},
|
||||
@ -73,7 +73,7 @@ impl UIDelizia {
|
||||
|
||||
render_on_display(None, Some(bg_color), |target| {
|
||||
shape::Text::new(PROGRESS_TEXT_ORIGIN, text)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
|
||||
@ -109,7 +109,7 @@ impl UIDelizia {
|
||||
center_text,
|
||||
)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(GREY)
|
||||
.render(target);
|
||||
}
|
||||
@ -425,7 +425,7 @@ impl BootloaderUI for UIDelizia {
|
||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5 - 50);
|
||||
shape::Text::new(pos, text)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG) //COLOR_BL_BG
|
||||
.render(target);
|
||||
|
||||
@ -442,7 +442,7 @@ impl BootloaderUI for UIDelizia {
|
||||
|
||||
shape::Text::new(pos, version_text.as_str())
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
@ -457,7 +457,7 @@ impl BootloaderUI for UIDelizia {
|
||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||
shape::Text::new(pos, text.as_str())
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
@ -465,7 +465,7 @@ impl BootloaderUI for UIDelizia {
|
||||
let pos = Point::new(SCREEN.width() / 2, SCREEN.height() - 5);
|
||||
shape::Text::new(pos, "click to continue ...")
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(BLD_FG)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::ui::{
|
||||
component::{Component, Event, EventCtx, Never, Pad},
|
||||
constant::screen,
|
||||
display::Font,
|
||||
display::font,
|
||||
geometry::{Offset, Point, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
shape::{self, Renderer},
|
||||
};
|
||||
|
||||
use super::super::theme::{BLACK, GREY, WHITE};
|
||||
@ -40,27 +39,27 @@ impl Component for Welcome {
|
||||
self.bg.render(target);
|
||||
|
||||
shape::Text::new(TEXT_ORIGIN, "Get started")
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(GREY)
|
||||
.render(target);
|
||||
|
||||
shape::Text::new(TEXT_ORIGIN + Offset::y(STRIDE), "with your Trezor")
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(GREY)
|
||||
.render(target);
|
||||
|
||||
shape::Text::new(TEXT_ORIGIN + Offset::y(2 * STRIDE), "at")
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(GREY)
|
||||
.render(target);
|
||||
|
||||
let at_width = Font::NORMAL.text_width("at ");
|
||||
let at_width = font::FONT_NORMAL.text_width("at ");
|
||||
|
||||
shape::Text::new(
|
||||
TEXT_ORIGIN + Offset::new(at_width, 2 * STRIDE),
|
||||
"trezor.io/start",
|
||||
)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(WHITE)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -2,12 +2,11 @@ use crate::{
|
||||
strutil::TString,
|
||||
ui::{
|
||||
component::{text::TextStyle, Component, Event, EventCtx, Never},
|
||||
display::{Color, Font},
|
||||
display::{font::FONT_SUB, Color, Font},
|
||||
event::SwipeEvent,
|
||||
geometry::{Alignment, Alignment2D, Direction, Offset, Point, Rect},
|
||||
lerp::Lerp,
|
||||
shape,
|
||||
shape::{Renderer, Text},
|
||||
shape::{self, Renderer, Text},
|
||||
},
|
||||
};
|
||||
|
||||
@ -325,7 +324,7 @@ impl PageCounter {
|
||||
instruction,
|
||||
page_curr: 0,
|
||||
page_max: 0,
|
||||
font: Font::SUB,
|
||||
font: FONT_SUB,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ use crate::{
|
||||
trezorhal::usb::usb_configured,
|
||||
ui::{
|
||||
component::{Component, Event, EventCtx, Timer},
|
||||
display::{image::ImageInfo, Color, Font},
|
||||
display::{font, image::ImageInfo, Color},
|
||||
event::TouchEvent,
|
||||
geometry::{Alignment, Alignment2D, Offset, Point, Rect},
|
||||
layout::util::get_user_custom_image,
|
||||
@ -493,7 +493,7 @@ impl Homescreen {
|
||||
TR::progress__locking_device.map_translated(|t| {
|
||||
shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(theme::FG);
|
||||
});
|
||||
self.loader.render(target)
|
||||
|
@ -10,7 +10,7 @@ use crate::{
|
||||
text::TextStyle,
|
||||
Component, Event, EventCtx, Label, Never, Pad, Timer,
|
||||
},
|
||||
display::Font,
|
||||
display::font::FONT_MONO,
|
||||
event::TouchEvent,
|
||||
geometry::{Alignment, Alignment2D, Direction, Grid, Insets, Offset, Rect},
|
||||
shape::{self, Renderer},
|
||||
@ -605,20 +605,20 @@ impl PinDots {
|
||||
}
|
||||
|
||||
fn render_digits<'s>(&self, area: Rect, target: &mut impl Renderer<'s>) {
|
||||
let left = area.left_center() + Offset::y(Font::MONO.visible_text_height("1") / 2);
|
||||
let left = area.left_center() + Offset::y(FONT_MONO.visible_text_height("1") / 2);
|
||||
let digits = self.digits.len();
|
||||
|
||||
if digits <= MAX_VISIBLE_DIGITS {
|
||||
shape::Text::new(left, &self.digits)
|
||||
.with_align(Alignment::Start)
|
||||
.with_font(Font::MONO)
|
||||
.with_font(FONT_MONO)
|
||||
.with_fg(self.style.text_color)
|
||||
.render(target);
|
||||
} else {
|
||||
let offset: usize = digits.saturating_sub(MAX_VISIBLE_DIGITS);
|
||||
shape::Text::new(left, &self.digits[offset..])
|
||||
.with_align(Alignment::Start)
|
||||
.with_font(Font::MONO)
|
||||
.with_font(FONT_MONO)
|
||||
.with_fg(self.style.text_color)
|
||||
.render(target);
|
||||
}
|
||||
@ -668,10 +668,10 @@ impl PinDots {
|
||||
|
||||
if last_digit && digits > 0 {
|
||||
let last = &self.digits[(digits - 1)..digits];
|
||||
cursor.y = area.left_center().y + (Font::MONO.visible_text_height("1") / 2);
|
||||
cursor.y = area.left_center().y + (FONT_MONO.visible_text_height("1") / 2);
|
||||
shape::Text::new(cursor, last)
|
||||
.with_align(Alignment::Start)
|
||||
.with_font(Font::MONO)
|
||||
.with_font(FONT_MONO)
|
||||
.with_fg(self.style.text_color)
|
||||
.render(target);
|
||||
} else {
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
text::paragraphs::{Paragraph, Paragraphs},
|
||||
Component, Event, EventCtx, Pad,
|
||||
},
|
||||
display::Font,
|
||||
display::font::FONT_DEMIBOLD,
|
||||
event::SwipeEvent,
|
||||
geometry::{Alignment, Direction, Grid, Insets, Offset, Rect},
|
||||
shape::{self, Renderer},
|
||||
@ -152,7 +152,7 @@ impl Component for NumberInput {
|
||||
let mut buf = [0u8; 10];
|
||||
|
||||
if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) {
|
||||
let digit_font = Font::DEMIBOLD;
|
||||
let digit_font = FONT_DEMIBOLD;
|
||||
let y_offset = digit_font.text_height() / 2;
|
||||
|
||||
shape::Bar::new(self.area).with_bg(theme::BG).render(target);
|
||||
|
@ -8,7 +8,7 @@ use crate::{
|
||||
text::paragraphs::{Paragraph, Paragraphs},
|
||||
Component, Event, EventCtx, Label, Never, Pad,
|
||||
},
|
||||
display::{Font, LOADER_MAX},
|
||||
display::{font, LOADER_MAX},
|
||||
geometry::{Insets, Offset, Rect},
|
||||
shape::Renderer,
|
||||
util::animation_disabled,
|
||||
@ -62,7 +62,7 @@ impl Component for Progress {
|
||||
.map(|t| t.chars().filter(|c| *c == '\n').count() as i16);
|
||||
let (title, rest) = Self::AREA.split_top(self.title.max_size().y);
|
||||
let (loader, description) =
|
||||
rest.split_bottom(Font::NORMAL.line_height() * description_lines);
|
||||
rest.split_bottom(font::FONT_NORMAL.line_height() * description_lines);
|
||||
let loader = loader.inset(Insets::top(theme::CONTENT_BORDER));
|
||||
self.title.place(title);
|
||||
self.loader_y_offset = loader.center().y - constant::screen().center().y;
|
||||
|
@ -3,10 +3,9 @@ use crate::{
|
||||
ui::{
|
||||
component::{text::TextStyle, Component, Event, EventCtx, Label, Never, Pad},
|
||||
constant::screen,
|
||||
display::{Color, Font, Icon},
|
||||
display::{font, Color, Icon},
|
||||
geometry::{Alignment2D, Insets, Offset, Point, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
shape::{self, Renderer},
|
||||
},
|
||||
};
|
||||
|
||||
@ -34,11 +33,11 @@ impl ResultStyle {
|
||||
}
|
||||
|
||||
pub const fn message_style(&self) -> TextStyle {
|
||||
TextStyle::new(Font::NORMAL, self.fg_color, self.bg_color, FG, FG)
|
||||
TextStyle::new(font::FONT_NORMAL, self.fg_color, self.bg_color, FG, FG)
|
||||
}
|
||||
|
||||
pub const fn title_style(&self) -> TextStyle {
|
||||
TextStyle::new(Font::BOLD, self.fg_color, self.bg_color, FG, FG)
|
||||
TextStyle::new(font::FONT_BOLD, self.fg_color, self.bg_color, FG, FG)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,14 @@
|
||||
use crate::ui::{
|
||||
component::{Component, Event, EventCtx, Never},
|
||||
display::font::Font,
|
||||
display::font,
|
||||
geometry::{Alignment, Alignment2D, Offset, Rect},
|
||||
shape,
|
||||
shape::Renderer,
|
||||
shape::{self, Renderer},
|
||||
};
|
||||
|
||||
use super::theme;
|
||||
|
||||
const TEXT_BOTTOM_MARGIN: i16 = 54;
|
||||
const ICON_TOP_MARGIN: i16 = 48;
|
||||
#[cfg(not(feature = "bootloader"))]
|
||||
const MODEL_NAME_FONT: Font = Font::DEMIBOLD;
|
||||
|
||||
use crate::trezorhal::model;
|
||||
|
||||
@ -52,7 +49,7 @@ impl Component for WelcomeScreen {
|
||||
model::FULL_NAME,
|
||||
)
|
||||
.with_align(Alignment::Center)
|
||||
.with_font(Font::NORMAL)
|
||||
.with_font(font::FONT_NORMAL)
|
||||
.with_fg(theme::FG)
|
||||
.render(target);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::ui::{
|
||||
component::{text::TextStyle, LineBreaking::BreakWordsNoHyphen},
|
||||
constant::{HEIGHT, WIDTH},
|
||||
display::{Color, Font},
|
||||
display::{font, Color},
|
||||
geometry::{Offset, Point, Rect},
|
||||
util::include_res,
|
||||
};
|
||||
@ -73,21 +73,21 @@ pub const CHECK40: &[u8] = include_res!("layout_delizia/res/check40.toif");
|
||||
pub fn button_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_BG,
|
||||
button_color: WHITE,
|
||||
icon_color: BLD_BG,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_BG,
|
||||
button_color: BLD_INSTALL_BTN_COLOR_ACTIVE,
|
||||
icon_color: BLD_BG,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: BLD_BG,
|
||||
@ -99,21 +99,21 @@ pub fn button_confirm() -> ButtonStyleSheet {
|
||||
pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: WHITE,
|
||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR,
|
||||
icon_color: WHITE,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: WHITE,
|
||||
button_color: BLD_WIPE_CANCEL_BTN_COLOR_ACTIVE,
|
||||
icon_color: WHITE,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
@ -125,21 +125,21 @@ pub fn button_wipe_cancel() -> ButtonStyleSheet {
|
||||
pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_WIPE_COLOR,
|
||||
button_color: BLD_WIPE_BTN_COLOR,
|
||||
icon_color: BLD_WIPE_COLOR,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_WIPE_COLOR,
|
||||
button_color: BLD_WIPE_BTN_COLOR_ACTIVE,
|
||||
icon_color: BLD_WIPE_COLOR,
|
||||
background_color: BLD_WIPE_COLOR,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: FG,
|
||||
button_color: GREY_DARK,
|
||||
icon_color: FG,
|
||||
@ -151,21 +151,21 @@ pub fn button_wipe_confirm() -> ButtonStyleSheet {
|
||||
pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BG,
|
||||
icon_color: BLD_FG,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BG,
|
||||
icon_color: BLD_FG,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BLD_BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
@ -177,21 +177,21 @@ pub fn button_bld_menu() -> ButtonStyleSheet {
|
||||
pub fn button_bld() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BTN_COLOR,
|
||||
icon_color: BLD_FG,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: BLD_FG,
|
||||
button_color: BLD_BTN_COLOR_ACTIVE,
|
||||
icon_color: BLD_FG,
|
||||
background_color: BLD_BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::BOLD,
|
||||
font: font::FONT_BOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BLD_BTN_COLOR,
|
||||
icon_color: GREY_LIGHT,
|
||||
@ -202,7 +202,7 @@ pub fn button_bld() -> ButtonStyleSheet {
|
||||
|
||||
pub const fn text_title(bg: Color) -> TextStyle {
|
||||
TextStyle::new(
|
||||
Font::BOLD,
|
||||
font::FONT_BOLD,
|
||||
BLD_TITLE_COLOR,
|
||||
bg,
|
||||
BLD_TITLE_COLOR,
|
||||
@ -210,27 +210,29 @@ pub const fn text_title(bg: Color) -> TextStyle {
|
||||
)
|
||||
}
|
||||
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_NORMAL: TextStyle =
|
||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_WARNING: TextStyle = TextStyle::new(
|
||||
Font::BOLD,
|
||||
font::FONT_BOLD,
|
||||
BLD_WARN_COLOR,
|
||||
BLD_BG,
|
||||
BLD_WARN_COLOR,
|
||||
BLD_WARN_COLOR,
|
||||
);
|
||||
pub const fn text_fingerprint(bg: Color) -> TextStyle {
|
||||
TextStyle::new(Font::NORMAL, BLD_FG, bg, BLD_FG, BLD_FG).with_line_breaking(BreakWordsNoHyphen)
|
||||
TextStyle::new(font::FONT_NORMAL, BLD_FG, bg, BLD_FG, BLD_FG)
|
||||
.with_line_breaking(BreakWordsNoHyphen)
|
||||
}
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(font::FONT_BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
|
||||
pub const TEXT_WIPE_BOLD: TextStyle = TextStyle::new(
|
||||
Font::BOLD,
|
||||
font::FONT_BOLD,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
BLD_WIPE_COLOR,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
);
|
||||
pub const TEXT_WIPE_NORMAL: TextStyle = TextStyle::new(
|
||||
Font::NORMAL,
|
||||
font::FONT_NORMAL,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
BLD_WIPE_COLOR,
|
||||
BLD_WIPE_TEXT_COLOR,
|
||||
|
@ -9,7 +9,10 @@ use crate::{
|
||||
text::{layout::Chunks, LineBreaking, PageBreaking, TextStyle},
|
||||
FixedHeightBar,
|
||||
},
|
||||
display::{Color, Font},
|
||||
display::{
|
||||
font::{FONT_BIG, FONT_BOLD, FONT_DEMIBOLD, FONT_MONO, FONT_NORMAL, FONT_SUB},
|
||||
Color,
|
||||
},
|
||||
geometry::{Insets, Offset},
|
||||
util::include_icon,
|
||||
},
|
||||
@ -17,7 +20,6 @@ use crate::{
|
||||
|
||||
use super::component::{ButtonStyle, ButtonStyleSheet, LoaderStyle, LoaderStyleSheet, ResultStyle};
|
||||
|
||||
|
||||
pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500);
|
||||
|
||||
// Color palette.
|
||||
@ -138,15 +140,15 @@ pub const fn label_default() -> TextStyle {
|
||||
}
|
||||
|
||||
pub const fn label_keyboard() -> TextStyle {
|
||||
TextStyle::new(Font::DEMIBOLD, GREY_EXTRA_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(FONT_DEMIBOLD, GREY_EXTRA_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_keyboard_prompt() -> TextStyle {
|
||||
TextStyle::new(Font::DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(FONT_DEMIBOLD, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_keyboard_warning() -> TextStyle {
|
||||
TextStyle::new(Font::DEMIBOLD, ORANGE_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(FONT_DEMIBOLD, ORANGE_LIGHT, BG, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_keyboard_minor() -> TextStyle {
|
||||
@ -175,7 +177,7 @@ pub const fn label_progress() -> TextStyle {
|
||||
|
||||
pub const fn label_title_main() -> TextStyle {
|
||||
TextStyle::new(
|
||||
Font::NORMAL,
|
||||
FONT_NORMAL,
|
||||
GREY_EXTRA_LIGHT,
|
||||
GREY_DARK,
|
||||
GREY_LIGHT,
|
||||
@ -184,41 +186,35 @@ pub const fn label_title_main() -> TextStyle {
|
||||
}
|
||||
|
||||
pub const fn label_title_danger() -> TextStyle {
|
||||
TextStyle::new(
|
||||
Font::NORMAL,
|
||||
ORANGE_LIGHT,
|
||||
GREY_DARK,
|
||||
GREY_LIGHT,
|
||||
GREY_LIGHT,
|
||||
)
|
||||
TextStyle::new(FONT_NORMAL, ORANGE_LIGHT, GREY_DARK, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_title_sub() -> TextStyle {
|
||||
TextStyle::new(Font::SUB, GREY, GREY_DARK, GREY_LIGHT, GREY_LIGHT)
|
||||
TextStyle::new(FONT_SUB, GREY, GREY_DARK, GREY_LIGHT, GREY_LIGHT)
|
||||
}
|
||||
|
||||
pub const fn label_coinjoin_progress() -> TextStyle {
|
||||
TextStyle::new(Font::BOLD, FG, ORANGE_DIMMED, FG, FG)
|
||||
TextStyle::new(FONT_BOLD, FG, ORANGE_DIMMED, FG, FG)
|
||||
}
|
||||
|
||||
pub const fn button_default() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_EXTRA_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_EXTRA_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
@ -230,21 +226,21 @@ pub const fn button_default() -> ButtonStyleSheet {
|
||||
pub const fn button_warning_high() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE_DIMMED,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE_DIMMED,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE_DIMMED,
|
||||
@ -256,21 +252,21 @@ pub const fn button_warning_high() -> ButtonStyleSheet {
|
||||
pub const fn button_warning_low() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIME,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIME,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIME,
|
||||
@ -283,14 +279,14 @@ pub const fn button_warning_low() -> ButtonStyleSheet {
|
||||
pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREEN_LIME,
|
||||
button_color: GREEN_DARK,
|
||||
icon_color: GREEN_LIME,
|
||||
background_color: GREEN_DARK,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREEN_LIME,
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_DARK,
|
||||
@ -298,7 +294,7 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -310,14 +306,14 @@ pub const fn button_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_LIGHT,
|
||||
button_color: ORANGE_DARK,
|
||||
icon_color: ORANGE_LIGHT,
|
||||
background_color: GREEN_DARK,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_DARK,
|
||||
button_color: ORANGE_LIGHT,
|
||||
icon_color: ORANGE_DARK,
|
||||
@ -325,7 +321,7 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -337,21 +333,21 @@ pub const fn button_cancel() -> ButtonStyleSheet {
|
||||
pub const fn button_danger() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE_DIMMED,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: ORANGE_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: ORANGE_LIGHT,
|
||||
@ -364,21 +360,21 @@ pub const fn button_danger() -> ButtonStyleSheet {
|
||||
pub const fn button_keyboard() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::NORMAL,
|
||||
font: FONT_NORMAL,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_EXTRA_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::NORMAL,
|
||||
font: FONT_NORMAL,
|
||||
text_color: BG,
|
||||
button_color: GREY_LIGHT,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::NORMAL,
|
||||
font: FONT_NORMAL,
|
||||
text_color: GREY_DARK,
|
||||
button_color: BG, // so there is no "button" itself, just the text
|
||||
icon_color: GREY_LIGHT,
|
||||
@ -390,14 +386,14 @@ pub const fn button_keyboard() -> ButtonStyleSheet {
|
||||
pub const fn button_keyboard_cancel() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: BG, // TODO: gradient
|
||||
icon_color: ORANGE_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: ORANGE_LIGHT,
|
||||
icon_color: BG,
|
||||
@ -405,7 +401,7 @@ pub const fn button_keyboard_cancel() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
@ -417,14 +413,14 @@ pub const fn button_keyboard_cancel() -> ButtonStyleSheet {
|
||||
pub const fn button_keyboard_erase() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: BG, // TODO: gradient
|
||||
icon_color: GREY,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREY_LIGHT,
|
||||
icon_color: BG,
|
||||
@ -432,7 +428,7 @@ pub const fn button_keyboard_erase() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: BG,
|
||||
icon_color: GREEN_LIGHT,
|
||||
@ -446,21 +442,21 @@ pub const fn button_keyboard_erase() -> ButtonStyleSheet {
|
||||
pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREEN_DARK,
|
||||
icon_color: GREEN_LIME,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: FG,
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_DARK,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: GREY_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_DARK,
|
||||
@ -472,14 +468,14 @@ pub const fn button_pin_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_passphrase_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREEN_LIME,
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_LIME,
|
||||
background_color: GREEN_DARK,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREEN_LIME,
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_DARK,
|
||||
@ -487,7 +483,7 @@ pub const fn button_passphrase_confirm() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -499,14 +495,14 @@ pub const fn button_passphrase_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_passphrase_confirm_empty() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY,
|
||||
button_color: GREY_EXTRA_DARK,
|
||||
icon_color: GREY,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: GREY_LIGHT,
|
||||
icon_color: BG,
|
||||
@ -514,7 +510,7 @@ pub const fn button_passphrase_confirm_empty() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -526,14 +522,14 @@ pub const fn button_passphrase_confirm_empty() -> ButtonStyleSheet {
|
||||
pub const fn button_passphrase_next() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG, // TODO: gradient
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG, // TODO: gradient
|
||||
icon_color: GREY_LIGHT,
|
||||
@ -541,7 +537,7 @@ pub const fn button_passphrase_next() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: GREY_LIGHT,
|
||||
@ -553,14 +549,14 @@ pub const fn button_passphrase_next() -> ButtonStyleSheet {
|
||||
pub const fn button_recovery_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREEN_LIME,
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_LIME,
|
||||
background_color: GREEN_DARK,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREEN_DARK,
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_DARK,
|
||||
@ -568,7 +564,7 @@ pub const fn button_recovery_confirm() -> ButtonStyleSheet {
|
||||
},
|
||||
// used in SLIP-39 recovery for "*"
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -580,14 +576,14 @@ pub const fn button_recovery_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT, // difference
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_LIME,
|
||||
background_color: GREEN_DARK,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREEN_LIME,
|
||||
button_color: GREEN_LIGHT,
|
||||
icon_color: GREEN_DARK,
|
||||
@ -595,7 +591,7 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -607,14 +603,14 @@ pub const fn button_suggestion_confirm() -> ButtonStyleSheet {
|
||||
pub const fn button_recovery_autocomplete() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_LIGHT,
|
||||
button_color: GREY_EXTRA_DARK,
|
||||
icon_color: GREY_LIGHT,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: FG,
|
||||
icon_color: BG,
|
||||
@ -622,7 +618,7 @@ pub const fn button_recovery_autocomplete() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -634,14 +630,14 @@ pub const fn button_recovery_autocomplete() -> ButtonStyleSheet {
|
||||
pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: BG,
|
||||
button_color: FG,
|
||||
icon_color: BG,
|
||||
@ -649,7 +645,7 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||
},
|
||||
// not used
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::MONO,
|
||||
font: FONT_MONO,
|
||||
text_color: BG,
|
||||
button_color: BG,
|
||||
icon_color: BG,
|
||||
@ -661,21 +657,21 @@ pub const fn button_suggestion_autocomplete() -> ButtonStyleSheet {
|
||||
pub const fn button_counter() -> ButtonStyleSheet {
|
||||
ButtonStyleSheet {
|
||||
normal: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY,
|
||||
button_color: GREY_EXTRA_DARK,
|
||||
icon_color: GREY,
|
||||
background_color: BG,
|
||||
},
|
||||
active: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: BG,
|
||||
button_color: GREY_LIGHT,
|
||||
icon_color: BG,
|
||||
background_color: BG,
|
||||
},
|
||||
disabled: &ButtonStyle {
|
||||
font: Font::DEMIBOLD,
|
||||
font: FONT_DEMIBOLD,
|
||||
text_color: GREY_DARK,
|
||||
button_color: BG,
|
||||
icon_color: GREY_DARK,
|
||||
@ -710,17 +706,16 @@ pub const fn loader_lock_icon() -> LoaderStyleSheet {
|
||||
}
|
||||
}
|
||||
|
||||
pub const TEXT_SUPER: TextStyle = TextStyle::new(Font::BIG, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_SUPER: TextStyle = TextStyle::new(FONT_BIG, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_MAIN_GREY_EXTRA_LIGHT: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_MAIN_GREY_LIGHT: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, GREY_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_SUB_GREY_LIGHT: TextStyle = TextStyle::new(Font::SUB, GREY_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_SUB_GREY: TextStyle = TextStyle::new(Font::SUB, GREY, BG, GREY, GREY);
|
||||
TextStyle::new(FONT_NORMAL, GREY_EXTRA_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_MAIN_GREY_LIGHT: TextStyle = TextStyle::new(FONT_NORMAL, GREY_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_SUB_GREY_LIGHT: TextStyle = TextStyle::new(FONT_SUB, GREY_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_SUB_GREY: TextStyle = TextStyle::new(FONT_SUB, GREY, BG, GREY, GREY);
|
||||
pub const TEXT_SUB_GREEN_LIME: TextStyle =
|
||||
TextStyle::new(Font::SUB, GREEN_LIME, BG, GREEN_LIME, GREEN_LIME);
|
||||
pub const TEXT_WARNING: TextStyle = TextStyle::new(Font::NORMAL, ORANGE_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_MONO: TextStyle = TextStyle::new(Font::MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
|
||||
TextStyle::new(FONT_SUB, GREEN_LIME, BG, GREEN_LIME, GREEN_LIME);
|
||||
pub const TEXT_WARNING: TextStyle = TextStyle::new(FONT_NORMAL, ORANGE_LIGHT, BG, GREY, GREY);
|
||||
pub const TEXT_MONO: TextStyle = TextStyle::new(FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
|
||||
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
|
||||
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
|
||||
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
|
||||
@ -743,9 +738,9 @@ pub const TEXT_MONO_ADDRESS_CHUNKS_SMALLER_X_OFFSET: TextStyle = TEXT_MONO
|
||||
.with_ellipsis_icon(ICON_PAGE_NEXT, -12);
|
||||
|
||||
// TODO: remove TextStyles below when ui-t3t1 done
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(Font::DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_NORMAL: TextStyle = TextStyle::new(FONT_NORMAL, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_DEMIBOLD: TextStyle = TextStyle::new(FONT_DEMIBOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_BOLD: TextStyle = TextStyle::new(FONT_BOLD, FG, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
|
||||
/// Decide the text style of chunkified text according to its length.
|
||||
pub fn get_chunkified_text_style(character_length: usize) -> &'static TextStyle {
|
||||
@ -760,11 +755,11 @@ pub fn get_chunkified_text_style(character_length: usize) -> &'static TextStyle
|
||||
}
|
||||
|
||||
pub const TEXT_NORMAL_GREY_EXTRA_LIGHT: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, GREY_EXTRA_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_CHECKLIST_DEFAULT: TextStyle = TextStyle::new(Font::SUB, GREY, BG, GREY, GREY);
|
||||
TextStyle::new(FONT_NORMAL, GREY_EXTRA_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_CHECKLIST_DEFAULT: TextStyle = TextStyle::new(FONT_SUB, GREY, BG, GREY, GREY);
|
||||
pub const TEXT_CHECKLIST_SELECTED: TextStyle =
|
||||
TextStyle::new(Font::NORMAL, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_CHECKLIST_DONE: TextStyle = TextStyle::new(Font::SUB, GREY, BG, GREY, GREY);
|
||||
TextStyle::new(FONT_NORMAL, GREY_LIGHT, BG, GREY_LIGHT, GREY_LIGHT);
|
||||
pub const TEXT_CHECKLIST_DONE: TextStyle = TextStyle::new(FONT_SUB, GREY, BG, GREY, GREY);
|
||||
|
||||
/// Spacing between components (e.g. header and main content) and offsets from
|
||||
/// the side of the screen. Generally applied everywhere except the top side of
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::ui::{
|
||||
display::{Color, Font},
|
||||
display::{font::FONT_NORMAL, Color, Font},
|
||||
geometry::{Alignment, Offset, Point, Rect},
|
||||
};
|
||||
|
||||
@ -34,7 +34,7 @@ impl<'a> Text<'a> {
|
||||
text,
|
||||
color: Color::white(),
|
||||
alpha: 255,
|
||||
font: Font::NORMAL,
|
||||
font: FONT_NORMAL,
|
||||
align: Alignment::Start,
|
||||
bounds: Rect::zero(),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user