1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-05 15:48:45 +00:00

refactor(core): apply uppercased fonts in build

[no changelog]
This commit is contained in:
obrusvit 2024-04-09 13:23:36 +02:00 committed by Vít Obrusník
parent c448a7bcfc
commit 43e759ea0b
18 changed files with 191 additions and 35 deletions

View File

@ -36,18 +36,24 @@ if TREZOR_MODEL in ('R', ):
FONT_BOLD='Font_PixelOperator_Bold_8' FONT_BOLD='Font_PixelOperator_Bold_8'
FONT_MONO='Font_PixelOperator_Regular_8' FONT_MONO='Font_PixelOperator_Regular_8'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
elif TREZOR_MODEL in ('T', 'DISC1', 'DISC2'): elif TREZOR_MODEL in ('T', 'DISC1', 'DISC2'):
FONT_NORMAL='Font_TTHoves_Regular_21' FONT_NORMAL='Font_TTHoves_Regular_21'
FONT_DEMIBOLD='Font_TTHoves_Regular_21' FONT_DEMIBOLD='Font_TTHoves_Regular_21'
FONT_BOLD='Font_TTHoves_Bold_17' FONT_BOLD='Font_TTHoves_Bold_17_upper'
FONT_MONO='Font_TTHoves_Regular_21' FONT_MONO='Font_TTHoves_Regular_21'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER='Font_TTHoves_Bold_17_upper'
elif TREZOR_MODEL in ('T3T1',): elif TREZOR_MODEL in ('T3T1',):
FONT_NORMAL='Font_TTSatoshi_DemiBold_21' FONT_NORMAL='Font_TTSatoshi_DemiBold_21'
FONT_DEMIBOLD='Font_TTSatoshi_DemiBold_21' FONT_DEMIBOLD='Font_TTSatoshi_DemiBold_21'
FONT_BOLD='Font_TTHoves_Bold_17' FONT_BOLD=None
FONT_MONO='Font_TTSatoshi_DemiBold_21' FONT_MONO='Font_TTSatoshi_DemiBold_21'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER='Font_TTHoves_Bold_17_upper'
# modtrezorcrypto # modtrezorcrypto
CCFLAGS_MOD += '-Wno-sequence-point ' CCFLAGS_MOD += '-Wno-sequence-point '
@ -114,6 +120,8 @@ tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('NORMAL_UPPER', FONT_NORMAL_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD_UPPER', FONT_BOLD_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
env = Environment( env = Environment(
ENV=os.environ, ENV=os.environ,

View File

@ -34,18 +34,24 @@ if TREZOR_MODEL in ('1', 'R'):
FONT_BOLD=None FONT_BOLD=None
FONT_MONO='Font_PixelOperatorMono_Regular_8' FONT_MONO='Font_PixelOperatorMono_Regular_8'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
elif TREZOR_MODEL in ('T',): elif TREZOR_MODEL in ('T',):
FONT_NORMAL='Font_Roboto_Regular_20' FONT_NORMAL='Font_Roboto_Regular_20'
FONT_DEMIBOLD=None FONT_DEMIBOLD=None
FONT_BOLD=None FONT_BOLD=None
FONT_MONO='Font_RobotoMono_Medium_20' FONT_MONO='Font_RobotoMono_Medium_20'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
elif TREZOR_MODEL in ('T3T1',): elif TREZOR_MODEL in ('T3T1',):
FONT_NORMAL='Font_TTSatoshi_DemiBold_21' FONT_NORMAL='Font_TTSatoshi_DemiBold_21'
FONT_DEMIBOLD=None FONT_DEMIBOLD=None
FONT_BOLD=None FONT_BOLD=None
FONT_MONO='Font_RobotoMono_Medium_21' FONT_MONO='Font_RobotoMono_Medium_21'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
# modtrezorcrypto # modtrezorcrypto
CCFLAGS_MOD += '-Wno-sequence-point ' CCFLAGS_MOD += '-Wno-sequence-point '
@ -106,6 +112,8 @@ tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('NORMAL_UPPER', FONT_NORMAL_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD_UPPER', FONT_BOLD_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
env = Environment( env = Environment(
ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')), ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')),

View File

@ -33,18 +33,24 @@ if TREZOR_MODEL in ('1', 'R'):
FONT_BOLD='Font_PixelOperator_Bold_8' FONT_BOLD='Font_PixelOperator_Bold_8'
FONT_MONO='Font_PixelOperator_Regular_8' FONT_MONO='Font_PixelOperator_Regular_8'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
elif TREZOR_MODEL in ('T', 'DISC2'): elif TREZOR_MODEL in ('T', 'DISC2'):
FONT_NORMAL='Font_TTHoves_Regular_21' FONT_NORMAL='Font_TTHoves_Regular_21'
FONT_DEMIBOLD=None FONT_DEMIBOLD=None
FONT_BOLD='Font_TTHoves_Bold_17' FONT_BOLD=None
FONT_MONO=None FONT_MONO=None
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER='Font_TTHoves_Bold_17_upper'
elif TREZOR_MODEL in ('T3T1',): elif TREZOR_MODEL in ('T3T1',):
FONT_NORMAL='Font_TTSatoshi_DemiBold_21' FONT_NORMAL='Font_TTSatoshi_DemiBold_21'
FONT_DEMIBOLD='Font_TTSatoshi_DemiBold_21' FONT_DEMIBOLD='Font_TTSatoshi_DemiBold_21'
FONT_BOLD='Font_TTHoves_Bold_17' FONT_BOLD=None
FONT_MONO='Font_TTSatoshi_DemiBold_21' FONT_MONO='Font_TTSatoshi_DemiBold_21'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER='Font_TTHoves_Bold_17_upper'
# modtrezorcrypto # modtrezorcrypto
CCFLAGS_MOD += '-Wno-sequence-point ' CCFLAGS_MOD += '-Wno-sequence-point '
@ -164,6 +170,8 @@ tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('NORMAL_UPPER', FONT_NORMAL_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD_UPPER', FONT_BOLD_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
env = Environment(ENV=os.environ, CFLAGS='%s -DCONFIDENTIAL= -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0'))) env = Environment(ENV=os.environ, CFLAGS='%s -DCONFIDENTIAL= -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))

View File

@ -42,12 +42,16 @@ if TREZOR_MODEL in ('1', 'R'):
FONT_BOLD='Font_PixelOperator_Bold_8' FONT_BOLD='Font_PixelOperator_Bold_8'
FONT_MONO='Font_PixelOperatorMono_Regular_8' FONT_MONO='Font_PixelOperatorMono_Regular_8'
FONT_BIG='Font_Unifont_Regular_16' FONT_BIG='Font_Unifont_Regular_16'
FONT_NORMAL_UPPER='Font_PixelOperator_Regular_8_upper'
FONT_BOLD_UPPER='Font_PixelOperator_Bold_8_upper'
elif TREZOR_MODEL in ('T', 'T3T1', 'DISC1', 'DISC2'): elif TREZOR_MODEL in ('T', 'T3T1', 'DISC1', 'DISC2'):
FONT_NORMAL='Font_TTHoves_Regular_21' FONT_NORMAL='Font_TTHoves_Regular_21'
FONT_DEMIBOLD='Font_TTHoves_DemiBold_21' FONT_DEMIBOLD='Font_TTHoves_DemiBold_21'
FONT_BOLD='Font_TTHoves_Bold_17' FONT_BOLD=None
FONT_MONO='Font_RobotoMono_Medium_20' FONT_MONO='Font_RobotoMono_Medium_20'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER='Font_TTHoves_Bold_17_upper'
# modtrezorconfig # modtrezorconfig
CPPPATH_MOD += [ CPPPATH_MOD += [
@ -391,6 +395,8 @@ tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('NORMAL_UPPER', FONT_NORMAL_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD_UPPER', FONT_BOLD_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_MICROPYTHON_SPEED SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_MICROPYTHON_SPEED

View File

@ -38,12 +38,16 @@ if TREZOR_MODEL in ('1', 'R'):
FONT_BOLD='Font_PixelOperator_Bold_8' FONT_BOLD='Font_PixelOperator_Bold_8'
FONT_MONO=None FONT_MONO=None
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
elif TREZOR_MODEL in ('T', 'T3T1'): elif TREZOR_MODEL in ('T', 'T3T1'):
FONT_NORMAL=None FONT_NORMAL=None
FONT_DEMIBOLD=None FONT_DEMIBOLD=None
FONT_BOLD='Font_Roboto_Bold_20' FONT_BOLD='Font_Roboto_Bold_20'
FONT_MONO=None FONT_MONO=None
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
# modtrezorcrypto # modtrezorcrypto
CPPPATH_MOD += [ CPPPATH_MOD += [
@ -100,6 +104,8 @@ tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('NORMAL_UPPER', FONT_NORMAL_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD_UPPER', FONT_BOLD_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
env = Environment( env = Environment(
ENV=os.environ, ENV=os.environ,

View File

@ -33,12 +33,16 @@ if TREZOR_MODEL in ('1', 'R'):
FONT_BOLD='Font_PixelOperator_Bold_8' FONT_BOLD='Font_PixelOperator_Bold_8'
FONT_MONO=None FONT_MONO=None
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
elif TREZOR_MODEL in ('T', 'T3T1'): elif TREZOR_MODEL in ('T', 'T3T1'):
FONT_NORMAL=None FONT_NORMAL=None
FONT_DEMIBOLD=None FONT_DEMIBOLD=None
FONT_BOLD='Font_Roboto_Bold_20' FONT_BOLD='Font_Roboto_Bold_20'
FONT_MONO=None FONT_MONO=None
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER=None
# modtrezorcrypto # modtrezorcrypto
CPPPATH_MOD += [ CPPPATH_MOD += [
@ -74,6 +78,8 @@ tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('NORMAL_UPPER', FONT_NORMAL_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD_UPPER', FONT_BOLD_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
env = Environment( env = Environment(
ENV=os.environ, ENV=os.environ,

View File

@ -44,12 +44,16 @@ if TREZOR_MODEL in ('1', 'R'):
FONT_BOLD='Font_PixelOperator_Bold_8' FONT_BOLD='Font_PixelOperator_Bold_8'
FONT_MONO='Font_PixelOperatorMono_Regular_8' FONT_MONO='Font_PixelOperatorMono_Regular_8'
FONT_BIG='Font_Unifont_Regular_16' FONT_BIG='Font_Unifont_Regular_16'
FONT_NORMAL_UPPER='Font_PixelOperator_Regular_8_upper'
FONT_BOLD_UPPER='Font_PixelOperator_Bold_8_upper'
elif TREZOR_MODEL in ('T', 'T3T1'): elif TREZOR_MODEL in ('T', 'T3T1'):
FONT_NORMAL='Font_TTHoves_Regular_21' FONT_NORMAL='Font_TTHoves_Regular_21'
FONT_DEMIBOLD='Font_TTHoves_DemiBold_21' FONT_DEMIBOLD='Font_TTHoves_DemiBold_21'
FONT_BOLD='Font_TTHoves_Bold_17' FONT_BOLD=None
FONT_MONO='Font_RobotoMono_Medium_20' FONT_MONO='Font_RobotoMono_Medium_20'
FONT_BIG=None FONT_BIG=None
FONT_NORMAL_UPPER=None
FONT_BOLD_UPPER='Font_TTHoves_Bold_17_upper'
# modtrezorconfig # modtrezorconfig
CPPPATH_MOD += [ CPPPATH_MOD += [
@ -441,6 +445,8 @@ tools.add_font('BOLD', FONT_BOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('DEMIBOLD', FONT_DEMIBOLD, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD) tools.add_font('BIG', FONT_BIG, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('NORMAL_UPPER', FONT_NORMAL_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
tools.add_font('BOLD_UPPER', FONT_BOLD_UPPER, CPPDEFINES_MOD, SOURCE_MOD)
SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_UNIX SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_UNIX

View File

@ -28,8 +28,8 @@
/// HEIGHT: int # display height in pixels /// HEIGHT: int # display height in pixels
/// FONT_MONO: int # id of monospace font /// FONT_MONO: int # id of monospace font
/// FONT_NORMAL: int # id of normal-width font /// FONT_NORMAL: int # id of normal-width font
/// FONT_BOLD: int # id of bold-width font
/// FONT_DEMIBOLD: int # id of demibold font /// FONT_DEMIBOLD: int # id of demibold font
/// FONT_BOLD_UPPER: int # id of bold-width-uppercased font
/// ///
typedef struct _mp_obj_Display_t { typedef struct _mp_obj_Display_t {
mp_obj_base_t base; mp_obj_base_t base;
@ -163,9 +163,9 @@ STATIC const mp_rom_map_elem_t mod_trezorui_Display_locals_dict_table[] = {
{MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(DISPLAY_RESX)}, {MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(DISPLAY_RESX)},
{MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_ROM_INT(DISPLAY_RESY)}, {MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_ROM_INT(DISPLAY_RESY)},
{MP_ROM_QSTR(MP_QSTR_FONT_NORMAL), MP_ROM_INT(FONT_NORMAL)}, {MP_ROM_QSTR(MP_QSTR_FONT_NORMAL), MP_ROM_INT(FONT_NORMAL)},
{MP_ROM_QSTR(MP_QSTR_FONT_BOLD), MP_ROM_INT(FONT_BOLD)},
{MP_ROM_QSTR(MP_QSTR_FONT_DEMIBOLD), MP_ROM_INT(FONT_DEMIBOLD)}, {MP_ROM_QSTR(MP_QSTR_FONT_DEMIBOLD), MP_ROM_INT(FONT_DEMIBOLD)},
{MP_ROM_QSTR(MP_QSTR_FONT_MONO), MP_ROM_INT(FONT_MONO)}, {MP_ROM_QSTR(MP_QSTR_FONT_MONO), MP_ROM_INT(FONT_MONO)},
{MP_ROM_QSTR(MP_QSTR_FONT_BOLD_UPPER), MP_ROM_INT(FONT_BOLD_UPPER)},
}; };
STATIC MP_DEFINE_CONST_DICT(mod_trezorui_Display_locals_dict, STATIC MP_DEFINE_CONST_DICT(mod_trezorui_Display_locals_dict,
mod_trezorui_Display_locals_dict_table); mod_trezorui_Display_locals_dict_table);

View File

@ -42,6 +42,14 @@ int font_height(int font) {
case FONT_BOLD: case FONT_BOLD:
return FONT_BOLD_HEIGHT; return FONT_BOLD_HEIGHT;
#endif #endif
#ifdef TREZOR_FONT_NORMAL_UPPER_ENABLE
case FONT_NORMAL_UPPER:
return FONT_NORMAL_UPPER_HEIGHT;
#endif
#ifdef TREZOR_FONT_BOLD_UPPER_ENABLE
case FONT_BOLD_UPPER:
return FONT_BOLD_UPPER_HEIGHT;
#endif
#ifdef TREZOR_FONT_MONO_ENABLE #ifdef TREZOR_FONT_MONO_ENABLE
case FONT_MONO: case FONT_MONO:
return FONT_MONO_HEIGHT; return FONT_MONO_HEIGHT;
@ -68,6 +76,14 @@ int font_max_height(int font) {
case FONT_BOLD: case FONT_BOLD:
return FONT_BOLD_MAX_HEIGHT; return FONT_BOLD_MAX_HEIGHT;
#endif #endif
#ifdef TREZOR_FONT_NORMAL_UPPER_ENABLE
case FONT_NORMAL_UPPER:
return FONT_NORMAL_UPPER_MAX_HEIGHT;
#endif
#ifdef TREZOR_FONT_BOLD_UPPER_ENABLE
case FONT_BOLD_UPPER:
return FONT_BOLD_UPPER_MAX_HEIGHT;
#endif
#ifdef TREZOR_FONT_MONO_ENABLE #ifdef TREZOR_FONT_MONO_ENABLE
case FONT_MONO: case FONT_MONO:
return FONT_MONO_MAX_HEIGHT; return FONT_MONO_MAX_HEIGHT;
@ -94,6 +110,14 @@ int font_baseline(int font) {
case FONT_BOLD: case FONT_BOLD:
return FONT_BOLD_BASELINE; return FONT_BOLD_BASELINE;
#endif #endif
#ifdef TREZOR_FONT_NORMAL_UPPER_ENABLE
case FONT_NORMAL_UPPER:
return FONT_NORMAL_UPPER_BASELINE;
#endif
#ifdef TREZOR_FONT_BOLD_UPPER_ENABLE
case FONT_BOLD_UPPER:
return FONT_BOLD_UPPER_BASELINE;
#endif
#ifdef TREZOR_FONT_MONO_ENABLE #ifdef TREZOR_FONT_MONO_ENABLE
case FONT_MONO: case FONT_MONO:
return FONT_MONO_BASELINE; return FONT_MONO_BASELINE;
@ -192,6 +216,14 @@ const uint8_t *font_nonprintable_glyph(int font) {
case FONT_BOLD: case FONT_BOLD:
return NONPRINTABLE_GLYPH(FONT_BOLD_DATA); return NONPRINTABLE_GLYPH(FONT_BOLD_DATA);
#endif #endif
#ifdef TREZOR_FONT_NORMAL_UPPER_ENABLE
case FONT_NORMAL_UPPER:
return NONPRINTABLE_GLYPH(FONT_NORMAL_UPPER_DATA);
#endif
#ifdef TREZOR_FONT_BOLD_UPPER_ENABLE
case FONT_BOLD_UPPER:
return NONPRINTABLE_GLYPH(FONT_BOLD_UPPER_DATA);
#endif
#ifdef TREZOR_FONT_MONO_ENABLE #ifdef TREZOR_FONT_MONO_ENABLE
case FONT_MONO: case FONT_MONO:
return NONPRINTABLE_GLYPH(FONT_MONO_DATA); return NONPRINTABLE_GLYPH(FONT_MONO_DATA);
@ -233,6 +265,14 @@ const uint8_t *font_get_glyph(int font, uint16_t c) {
case FONT_BOLD: case FONT_BOLD:
return FONT_BOLD_DATA[c - ' ']; return FONT_BOLD_DATA[c - ' '];
#endif #endif
#ifdef TREZOR_FONT_NORMAL_UPPER_ENABLE
case FONT_NORMAL_UPPER:
return FONT_NORMAL_UPPER_DATA[c - ' '];
#endif
#ifdef TREZOR_FONT_BOLD_UPPER_ENABLE
case FONT_BOLD_UPPER:
return FONT_BOLD_UPPER_DATA[c - ' '];
#endif
#ifdef TREZOR_FONT_MONO_ENABLE #ifdef TREZOR_FONT_MONO_ENABLE
case FONT_MONO: case FONT_MONO:
return FONT_MONO_DATA[c - ' ']; return FONT_MONO_DATA[c - ' '];

View File

@ -82,6 +82,30 @@
#define FONT_BOLD_BASELINE FONT_DEFINE(TREZOR_FONT_BOLD_ENABLE, _BASELINE) #define FONT_BOLD_BASELINE FONT_DEFINE(TREZOR_FONT_BOLD_ENABLE, _BASELINE)
#endif #endif
#ifdef TREZOR_FONT_NORMAL_UPPER_ENABLE
#include TREZOR_FONT_NORMAL_UPPER_INCLUDE
#define FONT_NORMAL_UPPER (-6)
#define FONT_NORMAL_UPPER_DATA TREZOR_FONT_NORMAL_UPPER_ENABLE
#define FONT_NORMAL_UPPER_HEIGHT \
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_ENABLE, _HEIGHT)
#define FONT_NORMAL_UPPER_MAX_HEIGHT \
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_ENABLE, _MAX_HEIGHT)
#define FONT_NORMAL_UPPER_BASELINE \
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_ENABLE, _BASELINE)
#endif
#ifdef TREZOR_FONT_BOLD_UPPER_ENABLE
#include TREZOR_FONT_BOLD_UPPER_INCLUDE
#define FONT_BOLD_UPPER (-7)
#define FONT_BOLD_UPPER_DATA TREZOR_FONT_BOLD_UPPER_ENABLE
#define FONT_BOLD_UPPER_HEIGHT \
FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_ENABLE, _HEIGHT)
#define FONT_BOLD_UPPER_MAX_HEIGHT \
FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_ENABLE, _MAX_HEIGHT)
#define FONT_BOLD_UPPER_BASELINE \
FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_ENABLE, _BASELINE)
#endif
#define MAX_FONT_H(A, B) ((A) > (B) ? (A) : (B)) #define MAX_FONT_H(A, B) ((A) > (B) ? (A) : (B))
#define FONT_MAX_HEIGHT_1 0 #define FONT_MAX_HEIGHT_1 0
@ -110,10 +134,24 @@
#define FONT_MAX_HEIGHT_5 FONT_MAX_HEIGHT_4 #define FONT_MAX_HEIGHT_5 FONT_MAX_HEIGHT_4
#endif #endif
#ifdef TREZOR_FONT_MONO_ENABLE #ifdef TREZOR_FONT_NORMAL_UPPER_ENABLE
#define FONT_MAX_HEIGHT MAX_FONT_H(FONT_MONO_MAX_HEIGHT, FONT_MAX_HEIGHT_5) #define FONT_MAX_HEIGHT_6 \
MAX_FONT_H(FONT_NORMAL_UPPER_MAX_HEIGHT, FONT_MAX_HEIGHT_5)
#else #else
#define FONT_MAX_HEIGHT FONT_MAX_HEIGHT_5 #define FONT_MAX_HEIGHT_6 FONT_MAX_HEIGHT_5
#endif
#ifdef TREZOR_FONT_BOLD_UPPER_ENABLE
#define FONT_MAX_HEIGHT_7 \
MAX_FONT_H(FONT_BOLD_UPPER_MAX_HEIGHT, FONT_MAX_HEIGHT_6)
#else
#define FONT_MAX_HEIGHT_7 FONT_MAX_HEIGHT_6
#endif
#ifdef TREZOR_FONT_MONO_ENABLE
#define FONT_MAX_HEIGHT MAX_FONT_H(FONT_MONO_MAX_HEIGHT, FONT_MAX_HEIGHT_7)
#else
#define FONT_MAX_HEIGHT FONT_MAX_HEIGHT_7
#endif #endif
int font_height(int font); int font_height(int font);

View File

@ -122,15 +122,18 @@ impl Glyph {
} }
/// Font constants. Keep in sync with FONT_ definitions in /// Font constants. Keep in sync with FONT_ definitions in
/// `extmod/modtrezorui/fonts/fonts.h`. /// `core/embed/lib/fonts/fonts.h`.
#[derive(Copy, Clone, PartialEq, Eq, FromPrimitive)] #[derive(Copy, Clone, PartialEq, Eq, FromPrimitive)]
#[repr(u8)] #[repr(u8)]
#[allow(non_camel_case_types)]
pub enum Font { pub enum Font {
NORMAL = 1, NORMAL = 1,
BOLD = 2, BOLD = 2,
MONO = 3, MONO = 3,
BIG = 4, BIG = 4,
DEMIBOLD = 5, DEMIBOLD = 5,
NORMAL_UPPER = 6,
BOLD_UPPER = 7,
} }
impl From<Font> for i32 { impl From<Font> for i32 {

View File

@ -10,8 +10,8 @@ class Display:
HEIGHT: int # display height in pixels HEIGHT: int # display height in pixels
FONT_MONO: int # id of monospace font FONT_MONO: int # id of monospace font
FONT_NORMAL: int # id of normal-width font FONT_NORMAL: int # id of normal-width font
FONT_BOLD: int # id of bold-width font
FONT_DEMIBOLD: int # id of demibold font FONT_DEMIBOLD: int # id of demibold font
FONT_BOLD_UPPER: int # id of bold-width-uppercased font
def __init__(self) -> None: def __init__(self) -> None:
""" """

View File

@ -21,8 +21,8 @@ display = Display()
# re-export constants from modtrezorui # re-export constants from modtrezorui
NORMAL: int = Display.FONT_NORMAL NORMAL: int = Display.FONT_NORMAL
BOLD: int = Display.FONT_BOLD
DEMIBOLD: int = Display.FONT_DEMIBOLD DEMIBOLD: int = Display.FONT_DEMIBOLD
BOLD_UPPER: int = Display.FONT_BOLD_UPPER
MONO: int = Display.FONT_MONO MONO: int = Display.FONT_MONO
WIDTH: int = Display.WIDTH WIDTH: int = Display.WIDTH
HEIGHT: int = Display.HEIGHT HEIGHT: int = Display.HEIGHT

View File

@ -868,7 +868,10 @@ async def _confirm_ask_pagination(
trezorui2.confirm_more( trezorui2.confirm_more(
title=title, title=title,
button=TR.buttons__go_back, button=TR.buttons__go_back,
items=[(ui.BOLD, f"Size: {len(data)} bytes"), (ui.MONO, data)], items=[
(ui.BOLD_UPPER, f"Size: {len(data)} bytes"),
(ui.MONO, data),
],
) )
) )
else: else:

View File

@ -5,21 +5,27 @@
"2_FONT_BOLD": "font_pixeloperator_bold_8_cs.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_cs.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_cs.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_cs.json",
"4_FONT_BIG": "font_unifont_regular_16_cs.json", "4_FONT_BIG": "font_unifont_regular_16_cs.json",
"5_FONT_DEMIBOLD": "font_unifont_bold_16_cs.json" "5_FONT_DEMIBOLD": "font_unifont_bold_16_cs.json",
"6_FONT_NORMAL_UPPER": "font_pixeloperator_regular_8_upper_cs.json",
"7_FONT_BOLD_UPPER": "font_pixeloperator_bold_8_upper_cs.json"
}, },
"T2T1": { "T2T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_cs.json", "1_FONT_NORMAL": "font_tthoves_regular_21_cs.json",
"2_FONT_BOLD": "font_tthoves_bold_17_cs.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_cs.json", "3_FONT_MONO": "font_robotomono_medium_20_cs.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_cs.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_cs.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_cs.json"
}, },
"T3T1": { "T3T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_cs.json", "1_FONT_NORMAL": "font_tthoves_regular_21_cs.json",
"2_FONT_BOLD": "font_tthoves_bold_17_cs.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_cs.json", "3_FONT_MONO": "font_robotomono_medium_20_cs.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_cs.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_cs.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_cs.json"
} }
}, },
"header": { "header": {

View File

@ -5,21 +5,27 @@
"2_FONT_BOLD": "font_pixeloperator_bold_8_de.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_de.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_de.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_de.json",
"4_FONT_BIG": "font_unifont_regular_16_de.json", "4_FONT_BIG": "font_unifont_regular_16_de.json",
"5_FONT_DEMIBOLD": "font_unifont_bold_16_de.json" "5_FONT_DEMIBOLD": "font_unifont_bold_16_de.json",
"6_FONT_NORMAL_UPPER": "font_pixeloperator_regular_8_upper_de.json",
"7_FONT_BOLD_UPPER": "font_pixeloperator_bold_8_upper_de.json"
}, },
"T2T1": { "T2T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_de.json", "1_FONT_NORMAL": "font_tthoves_regular_21_de.json",
"2_FONT_BOLD": "font_tthoves_bold_17_de.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_de.json", "3_FONT_MONO": "font_robotomono_medium_20_de.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_de.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_de.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_de.json"
}, },
"T3T1": { "T3T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_de.json", "1_FONT_NORMAL": "font_tthoves_regular_21_de.json",
"2_FONT_BOLD": "font_tthoves_bold_17_de.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_de.json", "3_FONT_MONO": "font_robotomono_medium_20_de.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_de.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_de.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_de.json"
} }
}, },
"header": { "header": {

View File

@ -5,21 +5,27 @@
"2_FONT_BOLD": "font_pixeloperator_bold_8_es.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_es.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_es.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_es.json",
"4_FONT_BIG": "font_unifont_regular_16_es.json", "4_FONT_BIG": "font_unifont_regular_16_es.json",
"5_FONT_DEMIBOLD": "font_unifont_bold_16_es.json" "5_FONT_DEMIBOLD": "font_unifont_bold_16_es.json",
"6_FONT_NORMAL_UPPER": "font_pixeloperator_regular_8_upper_es.json",
"7_FONT_BOLD_UPPER": "font_pixeloperator_bold_8_upper_es.json"
}, },
"T2T1": { "T2T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_es.json", "1_FONT_NORMAL": "font_tthoves_regular_21_es.json",
"2_FONT_BOLD": "font_tthoves_bold_17_es.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_es.json", "3_FONT_MONO": "font_robotomono_medium_20_es.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_es.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_es.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_es.json"
}, },
"T3T1": { "T3T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_es.json", "1_FONT_NORMAL": "font_tthoves_regular_21_es.json",
"2_FONT_BOLD": "font_tthoves_bold_17_es.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_es.json", "3_FONT_MONO": "font_robotomono_medium_20_es.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_es.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_es.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_es.json"
} }
}, },
"header": { "header": {

View File

@ -5,21 +5,27 @@
"2_FONT_BOLD": "font_pixeloperator_bold_8_fr.json", "2_FONT_BOLD": "font_pixeloperator_bold_8_fr.json",
"3_FONT_MONO": "font_pixeloperatormono_regular_8_fr.json", "3_FONT_MONO": "font_pixeloperatormono_regular_8_fr.json",
"4_FONT_BIG": "font_unifont_regular_16_fr.json", "4_FONT_BIG": "font_unifont_regular_16_fr.json",
"5_FONT_DEMIBOLD": "font_unifont_bold_16_fr.json" "5_FONT_DEMIBOLD": "font_unifont_bold_16_fr.json",
"6_FONT_NORMAL_UPPER": "font_pixeloperator_regular_8_upper_fr.json",
"7_FONT_BOLD_UPPER": "font_pixeloperator_bold_8_upper_fr.json"
}, },
"T2T1": { "T2T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_fr.json", "1_FONT_NORMAL": "font_tthoves_regular_21_fr.json",
"2_FONT_BOLD": "font_tthoves_bold_17_fr.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_fr.json", "3_FONT_MONO": "font_robotomono_medium_20_fr.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_fr.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_fr.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_fr.json"
}, },
"T3T1": { "T3T1": {
"1_FONT_NORMAL": "font_tthoves_regular_21_fr.json", "1_FONT_NORMAL": "font_tthoves_regular_21_fr.json",
"2_FONT_BOLD": "font_tthoves_bold_17_fr.json", "2_FONT_BOLD": null,
"3_FONT_MONO": "font_robotomono_medium_20_fr.json", "3_FONT_MONO": "font_robotomono_medium_20_fr.json",
"4_FONT_BIG": null, "4_FONT_BIG": null,
"5_FONT_DEMIBOLD": "font_tthoves_demibold_21_fr.json" "5_FONT_DEMIBOLD": "font_tthoves_demibold_21_fr.json",
"6_FONT_NORMAL_UPPER": null,
"7_FONT_BOLD_UPPER": "font_tthoves_bold_17_upper_fr.json"
} }
}, },
"header": { "header": {