From 6e50231a648bef9ad0d5dae3d031812995f0d5bf Mon Sep 17 00:00:00 2001 From: obrusvit Date: Wed, 18 Sep 2024 16:21:57 +0200 Subject: [PATCH] refactor(core): change gen_font.py and regen fonts Change to the new structures and preserve manual changes. This commit also removes duplicated definition of nonprintable glyph for _UPPER fonts. [no changelog] --- .../lib/fonts/font_pixeloperator_bold_8.c | 25 ++++-- .../lib/fonts/font_pixeloperator_bold_8.h | 12 +-- .../lib/fonts/font_pixeloperator_regular_8.c | 25 ++++-- .../lib/fonts/font_pixeloperator_regular_8.h | 12 +-- .../fonts/font_pixeloperatormono_regular_8.c | 14 +++- .../fonts/font_pixeloperatormono_regular_8.h | 7 +- core/embed/lib/fonts/font_roboto_bold_20.c | 13 ++- core/embed/lib/fonts/font_roboto_bold_20.h | 7 +- core/embed/lib/fonts/font_roboto_regular_20.c | 13 ++- core/embed/lib/fonts/font_roboto_regular_20.h | 7 +- .../lib/fonts/font_robotomono_medium_20.c | 13 ++- .../lib/fonts/font_robotomono_medium_20.h | 7 +- .../lib/fonts/font_robotomono_medium_21.c | 13 ++- .../lib/fonts/font_robotomono_medium_21.h | 7 +- core/embed/lib/fonts/font_tthoves_bold_17.c | 13 ++- core/embed/lib/fonts/font_tthoves_bold_17.h | 7 +- .../lib/fonts/font_tthoves_demibold_21.c | 13 ++- .../lib/fonts/font_tthoves_demibold_21.h | 7 +- .../embed/lib/fonts/font_tthoves_regular_21.c | 13 ++- .../embed/lib/fonts/font_tthoves_regular_21.h | 7 +- .../lib/fonts/font_ttsatoshi_demibold_18.c | 14 +++- .../lib/fonts/font_ttsatoshi_demibold_18.h | 7 +- .../lib/fonts/font_ttsatoshi_demibold_21.c | 13 ++- .../lib/fonts/font_ttsatoshi_demibold_21.h | 7 +- .../lib/fonts/font_ttsatoshi_demibold_42.c | 15 +++- .../lib/fonts/font_ttsatoshi_demibold_42.h | 7 +- core/embed/lib/fonts/font_unifont_bold_16.c | 13 ++- core/embed/lib/fonts/font_unifont_bold_16.h | 7 +- .../embed/lib/fonts/font_unifont_regular_16.c | 13 ++- .../embed/lib/fonts/font_unifont_regular_16.h | 7 +- core/embed/lib/fonts/fonts_types.h | 1 - core/tools/codegen/gen_font.py | 82 +++++++++---------- 32 files changed, 271 insertions(+), 150 deletions(-) diff --git a/core/embed/lib/fonts/font_pixeloperator_bold_8.c b/core/embed/lib/fonts/font_pixeloperator_bold_8.c index 76c6ce16b..25bdbab6f 100644 --- a/core/embed/lib/fonts/font_pixeloperator_bold_8.c +++ b/core/embed/lib/fonts/font_pixeloperator_bold_8.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -106,11 +107,9 @@ /* } */ static const uint8_t Font_PixelOperator_Bold_8_glyph_125[] = { 5, 7, 6, 0, 7, 225, 140, 51, 27, 128 }; /* ~ */ static const uint8_t Font_PixelOperator_Bold_8_glyph_126[] = { 7, 2, 8, 0, 7, 119, 184 }; -/* ? */ const uint8_t Font_PixelOperator_Bold_8_glyph_nonprintable[] = { 6, 7, 7, 0, 7, 132, 207, 57, 207, 252, 255 }; +/* ? */ static const uint8_t Font_PixelOperator_Bold_8_glyph_nonprintable[] = { 6, 7, 7, 0, 7, 132, 207, 57, 207, 252, 255 }; -/* ? */ const uint8_t Font_PixelOperator_Bold_8_upper_glyph_nonprintable[] = { 6, 7, 7, 0, 7, 132, 207, 57, 207, 252, 255 }; - -const uint8_t * const Font_PixelOperator_Bold_8[126 + 1 - 32] = { +static const uint8_t * const Font_PixelOperator_Bold_8[126 + 1 - 32] = { Font_PixelOperator_Bold_8_glyph_32, Font_PixelOperator_Bold_8_glyph_33, Font_PixelOperator_Bold_8_glyph_34, @@ -208,7 +207,7 @@ const uint8_t * const Font_PixelOperator_Bold_8[126 + 1 - 32] = { Font_PixelOperator_Bold_8_glyph_126, }; -const uint8_t * const Font_PixelOperator_Bold_8_upper[126 + 1 - 32] = { +static const uint8_t * const Font_PixelOperator_Bold_8_upper[126 + 1 - 32] = { Font_PixelOperator_Bold_8_glyph_32, Font_PixelOperator_Bold_8_glyph_33, Font_PixelOperator_Bold_8_glyph_34, @@ -305,3 +304,19 @@ const uint8_t * const Font_PixelOperator_Bold_8_upper[126 + 1 - 32] = { Font_PixelOperator_Bold_8_glyph_125, Font_PixelOperator_Bold_8_glyph_126, }; + +const font_info_t Font_PixelOperator_Bold_8_info = { + .height = 8, + .max_height = 8, + .baseline = 1, + .glyph_data = Font_PixelOperator_Bold_8, + .glyph_nonprintable = Font_PixelOperator_Bold_8_glyph_nonprintable, +}; + +const font_info_t Font_PixelOperator_Bold_8_upper_info = { + .height = 8, + .max_height = 8, + .baseline = 1, + .glyph_data = Font_PixelOperator_Bold_8_upper, + .glyph_nonprintable = Font_PixelOperator_Bold_8_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_pixeloperator_bold_8.h b/core/embed/lib/fonts/font_pixeloperator_bold_8.h index d3b0f11a5..dd34b599f 100644 --- a/core/embed/lib/fonts/font_pixeloperator_bold_8.h +++ b/core/embed/lib/fonts/font_pixeloperator_bold_8.h @@ -1,17 +1,13 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 1 #error Wrong TREZOR_FONT_BPP (expected 1) #endif -#define Font_PixelOperator_Bold_8_HEIGHT 8 + #define Font_PixelOperator_Bold_8_MAX_HEIGHT 8 -#define Font_PixelOperator_Bold_8_BASELINE 1 -extern const uint8_t* const Font_PixelOperator_Bold_8[126 + 1 - 32]; -extern const uint8_t Font_PixelOperator_Bold_8_glyph_nonprintable[]; -#define Font_PixelOperator_Bold_8_upper_HEIGHT 8 +extern const font_info_t Font_PixelOperator_Bold_8_info; #define Font_PixelOperator_Bold_8_upper_MAX_HEIGHT 8 -#define Font_PixelOperator_Bold_8_upper_BASELINE 1 -extern const uint8_t* const Font_PixelOperator_Bold_8_upper[126 + 1 - 32]; -extern const uint8_t Font_PixelOperator_Bold_8_upper_glyph_nonprintable[]; +extern const font_info_t Font_PixelOperator_Bold_8_upper_info; diff --git a/core/embed/lib/fonts/font_pixeloperator_regular_8.c b/core/embed/lib/fonts/font_pixeloperator_regular_8.c index 5f6181330..9bfb22b3f 100644 --- a/core/embed/lib/fonts/font_pixeloperator_regular_8.c +++ b/core/embed/lib/fonts/font_pixeloperator_regular_8.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -106,11 +107,9 @@ /* } */ static const uint8_t Font_PixelOperator_Regular_8_glyph_125[] = { 4, 7, 6, 0, 7, 194, 33, 34, 192 }; /* ~ */ static const uint8_t Font_PixelOperator_Regular_8_glyph_126[] = { 6, 2, 7, 0, 7, 102, 96 }; -/* ? */ const uint8_t Font_PixelOperator_Regular_8_glyph_nonprintable[] = { 5, 7, 6, 0, 7, 139, 189, 221, 255, 127 }; +/* ? */ static const uint8_t Font_PixelOperator_Regular_8_glyph_nonprintable[] = { 5, 7, 6, 0, 7, 139, 189, 221, 255, 127 }; -/* ? */ const uint8_t Font_PixelOperator_Regular_8_upper_glyph_nonprintable[] = { 5, 7, 6, 0, 7, 139, 189, 221, 255, 127 }; - -const uint8_t * const Font_PixelOperator_Regular_8[126 + 1 - 32] = { +static const uint8_t * const Font_PixelOperator_Regular_8[126 + 1 - 32] = { Font_PixelOperator_Regular_8_glyph_32, Font_PixelOperator_Regular_8_glyph_33, Font_PixelOperator_Regular_8_glyph_34, @@ -208,7 +207,7 @@ const uint8_t * const Font_PixelOperator_Regular_8[126 + 1 - 32] = { Font_PixelOperator_Regular_8_glyph_126, }; -const uint8_t * const Font_PixelOperator_Regular_8_upper[126 + 1 - 32] = { +static const uint8_t * const Font_PixelOperator_Regular_8_upper[126 + 1 - 32] = { Font_PixelOperator_Regular_8_glyph_32, Font_PixelOperator_Regular_8_glyph_33, Font_PixelOperator_Regular_8_glyph_34, @@ -305,3 +304,19 @@ const uint8_t * const Font_PixelOperator_Regular_8_upper[126 + 1 - 32] = { Font_PixelOperator_Regular_8_glyph_125, Font_PixelOperator_Regular_8_glyph_126, }; + +const font_info_t Font_PixelOperator_Regular_8_info = { + .height = 8, + .max_height = 8, + .baseline = 1, + .glyph_data = Font_PixelOperator_Regular_8, + .glyph_nonprintable = Font_PixelOperator_Regular_8_glyph_nonprintable, +}; + +const font_info_t Font_PixelOperator_Regular_8_upper_info = { + .height = 8, + .max_height = 8, + .baseline = 1, + .glyph_data = Font_PixelOperator_Regular_8_upper, + .glyph_nonprintable = Font_PixelOperator_Regular_8_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_pixeloperator_regular_8.h b/core/embed/lib/fonts/font_pixeloperator_regular_8.h index 2565d8790..27212ca20 100644 --- a/core/embed/lib/fonts/font_pixeloperator_regular_8.h +++ b/core/embed/lib/fonts/font_pixeloperator_regular_8.h @@ -1,17 +1,13 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 1 #error Wrong TREZOR_FONT_BPP (expected 1) #endif -#define Font_PixelOperator_Regular_8_HEIGHT 8 + #define Font_PixelOperator_Regular_8_MAX_HEIGHT 8 -#define Font_PixelOperator_Regular_8_BASELINE 1 -extern const uint8_t* const Font_PixelOperator_Regular_8[126 + 1 - 32]; -extern const uint8_t Font_PixelOperator_Regular_8_glyph_nonprintable[]; -#define Font_PixelOperator_Regular_8_upper_HEIGHT 8 +extern const font_info_t Font_PixelOperator_Regular_8_info; #define Font_PixelOperator_Regular_8_upper_MAX_HEIGHT 8 -#define Font_PixelOperator_Regular_8_upper_BASELINE 1 -extern const uint8_t* const Font_PixelOperator_Regular_8_upper[126 + 1 - 32]; -extern const uint8_t Font_PixelOperator_Regular_8_upper_glyph_nonprintable[]; +extern const font_info_t Font_PixelOperator_Regular_8_upper_info; diff --git a/core/embed/lib/fonts/font_pixeloperatormono_regular_8.c b/core/embed/lib/fonts/font_pixeloperatormono_regular_8.c index 0f8ea4e9c..6676241ed 100644 --- a/core/embed/lib/fonts/font_pixeloperatormono_regular_8.c +++ b/core/embed/lib/fonts/font_pixeloperatormono_regular_8.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -10,7 +11,6 @@ // NOTE: hand-changed all the advances with 8 to 7 // NOTE: hand-changed the visuals of "m", "w", "M" and "W" to make it narrower - /* */ static const uint8_t Font_PixelOperatorMono_Regular_8_glyph_32[] = { 0, 0, 7, 0, 0 }; // width hand-changed from 8 to 7 to have 9px space between words /* ! */ static const uint8_t Font_PixelOperatorMono_Regular_8_glyph_33[] = { 1, 7, 7, 2, 7, 250 }; /* " */ static const uint8_t Font_PixelOperatorMono_Regular_8_glyph_34[] = { 3, 3, 7, 1, 7, 182, 128 }; @@ -107,9 +107,9 @@ /* } */ static const uint8_t Font_PixelOperatorMono_Regular_8_glyph_125[] = { 4, 7, 7, 0, 7, 194, 33, 34, 192 }; /* ~ */ static const uint8_t Font_PixelOperatorMono_Regular_8_glyph_126[] = { 6, 2, 7, 0, 7, 102, 96 }; -/* ? */ const uint8_t Font_PixelOperatorMono_Regular_8_glyph_nonprintable[] = { 5, 7, 7, 0, 7, 139, 189, 221, 255, 127 }; +/* ? */ static const uint8_t Font_PixelOperatorMono_Regular_8_glyph_nonprintable[] = { 5, 7, 7, 0, 7, 139, 189, 221, 255, 127 }; -const uint8_t * const Font_PixelOperatorMono_Regular_8[126 + 1 - 32] = { +static const uint8_t * const Font_PixelOperatorMono_Regular_8[126 + 1 - 32] = { Font_PixelOperatorMono_Regular_8_glyph_32, Font_PixelOperatorMono_Regular_8_glyph_33, Font_PixelOperatorMono_Regular_8_glyph_34, @@ -206,3 +206,11 @@ const uint8_t * const Font_PixelOperatorMono_Regular_8[126 + 1 - 32] = { Font_PixelOperatorMono_Regular_8_glyph_125, Font_PixelOperatorMono_Regular_8_glyph_126, }; + +const font_info_t Font_PixelOperatorMono_Regular_8_info = { + .height = 8, + .max_height = 8, + .baseline = 1, + .glyph_data = Font_PixelOperatorMono_Regular_8, + .glyph_nonprintable = Font_PixelOperatorMono_Regular_8_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_pixeloperatormono_regular_8.h b/core/embed/lib/fonts/font_pixeloperatormono_regular_8.h index ce157770f..617064d32 100644 --- a/core/embed/lib/fonts/font_pixeloperatormono_regular_8.h +++ b/core/embed/lib/fonts/font_pixeloperatormono_regular_8.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 1 #error Wrong TREZOR_FONT_BPP (expected 1) #endif -#define Font_PixelOperatorMono_Regular_8_HEIGHT 8 + #define Font_PixelOperatorMono_Regular_8_MAX_HEIGHT 8 -#define Font_PixelOperatorMono_Regular_8_BASELINE 1 -extern const uint8_t* const Font_PixelOperatorMono_Regular_8[126 + 1 - 32]; -extern const uint8_t Font_PixelOperatorMono_Regular_8_glyph_nonprintable[]; +extern const font_info_t Font_PixelOperatorMono_Regular_8_info; diff --git a/core/embed/lib/fonts/font_roboto_bold_20.c b/core/embed/lib/fonts/font_roboto_bold_20.c index da87d94e8..6c9442644 100644 --- a/core/embed/lib/fonts/font_roboto_bold_20.c +++ b/core/embed/lib/fonts/font_roboto_bold_20.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -104,9 +105,9 @@ /* } */ static const uint8_t Font_Roboto_Bold_20_glyph_125[] = { 7, 20, 7, 0, 16, 180, 3, 0, 0, 248, 79, 0, 0, 176, 239, 0, 0, 64, 255, 3, 0, 32, 255, 5, 0, 32, 255, 6, 0, 32, 255, 6, 0, 16, 255, 7, 0, 0, 252, 45, 0, 0, 210, 255, 2, 0, 210, 255, 2, 0, 252, 45, 0, 16, 255, 7, 0, 32, 255, 6, 0, 32, 255, 6, 0, 32, 255, 5, 0, 64, 255, 3, 0, 176, 239, 0, 0, 248, 79, 0, 0, 180, 3, 0, 0 }; /* ~ */ static const uint8_t Font_Roboto_Bold_20_glyph_126[] = { 11, 5, 13, 1, 8, 96, 254, 60, 0, 162, 9, 245, 255, 255, 6, 249, 12, 252, 108, 252, 255, 255, 6, 237, 3, 128, 255, 175, 0, 0, 0, 0, 65, 2, 0 }; -/* ? */ const uint8_t Font_Roboto_Bold_20_glyph_nonprintable[] = { 10, 14, 10, 0, 14, 255, 40, 16, 163, 255, 79, 0, 0, 0, 247, 11, 16, 137, 0, 240, 8, 160, 255, 5, 192, 255, 255, 255, 4, 208, 255, 255, 175, 0, 243, 255, 255, 10, 16, 253, 255, 239, 0, 209, 255, 255, 143, 0, 251, 255, 255, 111, 16, 255, 255, 255, 255, 255, 255, 255, 255, 159, 65, 255, 255, 255, 47, 0, 252, 255, 255, 143, 64, 255, 255 }; +/* ? */ static const uint8_t Font_Roboto_Bold_20_glyph_nonprintable[] = { 10, 14, 10, 0, 14, 255, 40, 16, 163, 255, 79, 0, 0, 0, 247, 11, 16, 137, 0, 240, 8, 160, 255, 5, 192, 255, 255, 255, 4, 208, 255, 255, 175, 0, 243, 255, 255, 10, 16, 253, 255, 239, 0, 209, 255, 255, 143, 0, 251, 255, 255, 111, 16, 255, 255, 255, 255, 255, 255, 255, 255, 159, 65, 255, 255, 255, 47, 0, 252, 255, 255, 143, 64, 255, 255 }; -const uint8_t * const Font_Roboto_Bold_20[126 + 1 - 32] = { +static const uint8_t * const Font_Roboto_Bold_20[126 + 1 - 32] = { Font_Roboto_Bold_20_glyph_32, Font_Roboto_Bold_20_glyph_33, Font_Roboto_Bold_20_glyph_34, @@ -203,3 +204,11 @@ const uint8_t * const Font_Roboto_Bold_20[126 + 1 - 32] = { Font_Roboto_Bold_20_glyph_125, Font_Roboto_Bold_20_glyph_126, }; + +const font_info_t Font_Roboto_Bold_20_info = { + .height = 20, + .max_height = 21, + .baseline = 4, + .glyph_data = Font_Roboto_Bold_20, + .glyph_nonprintable = Font_Roboto_Bold_20_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_roboto_bold_20.h b/core/embed/lib/fonts/font_roboto_bold_20.h index f922ba660..a0016eb25 100644 --- a/core/embed/lib/fonts/font_roboto_bold_20.h +++ b/core/embed/lib/fonts/font_roboto_bold_20.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_Roboto_Bold_20_HEIGHT 20 + #define Font_Roboto_Bold_20_MAX_HEIGHT 21 -#define Font_Roboto_Bold_20_BASELINE 4 -extern const uint8_t* const Font_Roboto_Bold_20[126 + 1 - 32]; -extern const uint8_t Font_Roboto_Bold_20_glyph_nonprintable[]; +extern const font_info_t Font_Roboto_Bold_20_info; diff --git a/core/embed/lib/fonts/font_roboto_regular_20.c b/core/embed/lib/fonts/font_roboto_regular_20.c index f4370a6e6..cc70bfe5a 100644 --- a/core/embed/lib/fonts/font_roboto_regular_20.c +++ b/core/embed/lib/fonts/font_roboto_regular_20.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -104,9 +105,9 @@ /* } */ static const uint8_t Font_Roboto_Regular_20_glyph_125[] = { 7, 20, 7, 0, 16, 152, 1, 0, 0, 228, 29, 0, 0, 48, 159, 0, 0, 0, 238, 0, 0, 0, 252, 0, 0, 0, 252, 0, 0, 0, 252, 0, 0, 0, 250, 2, 0, 0, 244, 27, 0, 0, 112, 255, 1, 0, 209, 143, 0, 0, 248, 5, 0, 0, 251, 1, 0, 0, 252, 0, 0, 0, 252, 0, 0, 0, 252, 0, 0, 0, 222, 0, 0, 80, 143, 0, 0, 229, 29, 0, 0, 152, 1, 0, 0 }; /* ~ */ static const uint8_t Font_Roboto_Regular_20_glyph_126[] = { 12, 4, 14, 1, 8, 64, 253, 109, 0, 32, 59, 243, 173, 254, 43, 161, 31, 249, 1, 144, 255, 255, 7, 50, 0, 0, 115, 56, 0 }; -/* ? */ const uint8_t Font_Roboto_Regular_20_glyph_nonprintable[] = { 9, 14, 9, 0, 14, 255, 57, 16, 213, 255, 111, 16, 69, 16, 254, 14, 242, 255, 8, 247, 125, 250, 255, 12, 245, 255, 255, 255, 10, 248, 255, 255, 239, 1, 254, 255, 255, 46, 160, 255, 255, 255, 3, 250, 255, 255, 191, 96, 255, 255, 255, 143, 160, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 159, 160, 255, 255, 255, 159, 160, 255, 255 }; +/* ? */ static const uint8_t Font_Roboto_Regular_20_glyph_nonprintable[] = { 9, 14, 9, 0, 14, 255, 57, 16, 213, 255, 111, 16, 69, 16, 254, 14, 242, 255, 8, 247, 125, 250, 255, 12, 245, 255, 255, 255, 10, 248, 255, 255, 239, 1, 254, 255, 255, 46, 160, 255, 255, 255, 3, 250, 255, 255, 191, 96, 255, 255, 255, 143, 160, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 159, 160, 255, 255, 255, 159, 160, 255, 255 }; -const uint8_t * const Font_Roboto_Regular_20[126 + 1 - 32] = { +static const uint8_t * const Font_Roboto_Regular_20[126 + 1 - 32] = { Font_Roboto_Regular_20_glyph_32, Font_Roboto_Regular_20_glyph_33, Font_Roboto_Regular_20_glyph_34, @@ -203,3 +204,11 @@ const uint8_t * const Font_Roboto_Regular_20[126 + 1 - 32] = { Font_Roboto_Regular_20_glyph_125, Font_Roboto_Regular_20_glyph_126, }; + +const font_info_t Font_Roboto_Regular_20_info = { + .height = 20, + .max_height = 22, + .baseline = 5, + .glyph_data = Font_Roboto_Regular_20, + .glyph_nonprintable = Font_Roboto_Regular_20_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_roboto_regular_20.h b/core/embed/lib/fonts/font_roboto_regular_20.h index 8eeb50983..706c08977 100644 --- a/core/embed/lib/fonts/font_roboto_regular_20.h +++ b/core/embed/lib/fonts/font_roboto_regular_20.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_Roboto_Regular_20_HEIGHT 20 + #define Font_Roboto_Regular_20_MAX_HEIGHT 22 -#define Font_Roboto_Regular_20_BASELINE 5 -extern const uint8_t* const Font_Roboto_Regular_20[126 + 1 - 32]; -extern const uint8_t Font_Roboto_Regular_20_glyph_nonprintable[]; +extern const font_info_t Font_Roboto_Regular_20_info; diff --git a/core/embed/lib/fonts/font_robotomono_medium_20.c b/core/embed/lib/fonts/font_robotomono_medium_20.c index c08fc3fb0..58c0d3637 100644 --- a/core/embed/lib/fonts/font_robotomono_medium_20.c +++ b/core/embed/lib/fonts/font_robotomono_medium_20.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -104,9 +105,9 @@ /* } */ static const uint8_t Font_RobotoMono_Medium_20_glyph_125[] = { 7, 20, 12, 3, 16, 117, 1, 0, 0, 249, 30, 0, 0, 112, 175, 0, 0, 16, 255, 0, 0, 0, 255, 2, 0, 0, 255, 3, 0, 0, 255, 3, 0, 0, 254, 4, 0, 0, 248, 28, 0, 0, 144, 255, 11, 0, 144, 255, 10, 0, 248, 28, 0, 0, 254, 4, 0, 0, 255, 3, 0, 0, 255, 3, 0, 0, 255, 2, 0, 32, 255, 0, 0, 144, 159, 0, 0, 250, 29, 0, 0, 100, 0, 0, 0 }; /* ~ */ static const uint8_t Font_RobotoMono_Medium_20_glyph_126[] = { 12, 5, 12, 0, 8, 64, 237, 76, 0, 32, 22, 242, 255, 255, 8, 144, 63, 248, 6, 229, 239, 253, 14, 149, 0, 32, 251, 239, 3, 0, 0, 0, 16, 2, 0 }; -/* ? */ const uint8_t Font_RobotoMono_Medium_20_glyph_nonprintable[] = { 10, 16, 12, 1, 15, 255, 207, 153, 251, 255, 239, 3, 0, 16, 250, 47, 0, 102, 2, 208, 12, 176, 255, 14, 128, 174, 250, 255, 47, 112, 255, 255, 255, 13, 160, 255, 255, 255, 3, 242, 255, 255, 79, 16, 253, 255, 255, 5, 209, 255, 255, 255, 0, 251, 255, 255, 255, 34, 254, 255, 255, 255, 255, 255, 255, 255, 255, 153, 255, 255, 255, 175, 0, 250, 255, 255, 207, 0, 253, 255, 255, 255, 255, 255, 255 }; +/* ? */ static const uint8_t Font_RobotoMono_Medium_20_glyph_nonprintable[] = { 10, 16, 12, 1, 15, 255, 207, 153, 251, 255, 239, 3, 0, 16, 250, 47, 0, 102, 2, 208, 12, 176, 255, 14, 128, 174, 250, 255, 47, 112, 255, 255, 255, 13, 160, 255, 255, 255, 3, 242, 255, 255, 79, 16, 253, 255, 255, 5, 209, 255, 255, 255, 0, 251, 255, 255, 255, 34, 254, 255, 255, 255, 255, 255, 255, 255, 255, 153, 255, 255, 255, 175, 0, 250, 255, 255, 207, 0, 253, 255, 255, 255, 255, 255, 255 }; -const uint8_t * const Font_RobotoMono_Medium_20[126 + 1 - 32] = { +static const uint8_t * const Font_RobotoMono_Medium_20[126 + 1 - 32] = { Font_RobotoMono_Medium_20_glyph_32, Font_RobotoMono_Medium_20_glyph_33, Font_RobotoMono_Medium_20_glyph_34, @@ -203,3 +204,11 @@ const uint8_t * const Font_RobotoMono_Medium_20[126 + 1 - 32] = { Font_RobotoMono_Medium_20_glyph_125, Font_RobotoMono_Medium_20_glyph_126, }; + +const font_info_t Font_RobotoMono_Medium_20_info = { + .height = 20, + .max_height = 22, + .baseline = 5, + .glyph_data = Font_RobotoMono_Medium_20, + .glyph_nonprintable = Font_RobotoMono_Medium_20_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_robotomono_medium_20.h b/core/embed/lib/fonts/font_robotomono_medium_20.h index 7b43d298f..8ea21088f 100644 --- a/core/embed/lib/fonts/font_robotomono_medium_20.h +++ b/core/embed/lib/fonts/font_robotomono_medium_20.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_RobotoMono_Medium_20_HEIGHT 20 + #define Font_RobotoMono_Medium_20_MAX_HEIGHT 22 -#define Font_RobotoMono_Medium_20_BASELINE 5 -extern const uint8_t* const Font_RobotoMono_Medium_20[126 + 1 - 32]; -extern const uint8_t Font_RobotoMono_Medium_20_glyph_nonprintable[]; +extern const font_info_t Font_RobotoMono_Medium_20_info; diff --git a/core/embed/lib/fonts/font_robotomono_medium_21.c b/core/embed/lib/fonts/font_robotomono_medium_21.c index 50077e6eb..13b2bd9dc 100644 --- a/core/embed/lib/fonts/font_robotomono_medium_21.c +++ b/core/embed/lib/fonts/font_robotomono_medium_21.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -104,9 +105,9 @@ /* } */ static const uint8_t Font_RobotoMono_Medium_21_glyph_125[] = { 8, 21, 13, 3, 17, 66, 0, 0, 0, 248, 45, 0, 0, 128, 223, 0, 0, 0, 254, 4, 0, 0, 252, 7, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 251, 9, 0, 0, 248, 12, 0, 0, 225, 175, 4, 0, 16, 253, 63, 0, 160, 239, 42, 0, 245, 30, 0, 0, 250, 9, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 252, 8, 0, 0, 254, 5, 0, 80, 239, 0, 0, 246, 95, 0, 0, 148, 3, 0, 0 }; /* ~ */ static const uint8_t Font_RobotoMono_Medium_21_glyph_126[] = { 12, 6, 13, 0, 9, 0, 82, 3, 0, 0, 0, 128, 255, 207, 2, 0, 155, 244, 191, 254, 111, 97, 191, 248, 5, 144, 255, 255, 79, 98, 0, 0, 197, 239, 6, 0, 0, 0, 0, 0, 0 }; -/* ? */ const uint8_t Font_RobotoMono_Medium_21_glyph_nonprintable[] = { 11, 17, 13, 1, 16, 255, 255, 222, 254, 255, 255, 255, 42, 0, 32, 250, 255, 143, 0, 0, 0, 144, 255, 15, 48, 254, 46, 16, 255, 61, 195, 255, 143, 0, 255, 255, 255, 255, 143, 0, 255, 255, 255, 255, 30, 80, 255, 255, 255, 255, 3, 225, 255, 255, 255, 62, 16, 252, 255, 255, 255, 7, 208, 255, 255, 255, 255, 3, 246, 255, 255, 255, 255, 104, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 105, 253, 255, 255, 255, 239, 0, 244, 255, 255, 255, 255, 2, 248, 255, 255, 255, 255, 239, 255, 255, 255 }; +/* ? */ static const uint8_t Font_RobotoMono_Medium_21_glyph_nonprintable[] = { 11, 17, 13, 1, 16, 255, 255, 222, 254, 255, 255, 255, 42, 0, 32, 250, 255, 143, 0, 0, 0, 144, 255, 15, 48, 254, 46, 16, 255, 61, 195, 255, 143, 0, 255, 255, 255, 255, 143, 0, 255, 255, 255, 255, 30, 80, 255, 255, 255, 255, 3, 225, 255, 255, 255, 62, 16, 252, 255, 255, 255, 7, 208, 255, 255, 255, 255, 3, 246, 255, 255, 255, 255, 104, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 105, 253, 255, 255, 255, 239, 0, 244, 255, 255, 255, 255, 2, 248, 255, 255, 255, 255, 239, 255, 255, 255 }; -const uint8_t * const Font_RobotoMono_Medium_21[126 + 1 - 32] = { +static const uint8_t * const Font_RobotoMono_Medium_21[126 + 1 - 32] = { Font_RobotoMono_Medium_21_glyph_32, Font_RobotoMono_Medium_21_glyph_33, Font_RobotoMono_Medium_21_glyph_34, @@ -203,3 +204,11 @@ const uint8_t * const Font_RobotoMono_Medium_21[126 + 1 - 32] = { Font_RobotoMono_Medium_21_glyph_125, Font_RobotoMono_Medium_21_glyph_126, }; + +const font_info_t Font_RobotoMono_Medium_21_info = { + .height = 21, + .max_height = 23, + .baseline = 5, + .glyph_data = Font_RobotoMono_Medium_21, + .glyph_nonprintable = Font_RobotoMono_Medium_21_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_robotomono_medium_21.h b/core/embed/lib/fonts/font_robotomono_medium_21.h index 224fb3762..4323e0981 100644 --- a/core/embed/lib/fonts/font_robotomono_medium_21.h +++ b/core/embed/lib/fonts/font_robotomono_medium_21.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_RobotoMono_Medium_21_HEIGHT 21 + #define Font_RobotoMono_Medium_21_MAX_HEIGHT 23 -#define Font_RobotoMono_Medium_21_BASELINE 5 -extern const uint8_t* const Font_RobotoMono_Medium_21[126 + 1 - 32]; -extern const uint8_t Font_RobotoMono_Medium_21_glyph_nonprintable[]; +extern const font_info_t Font_RobotoMono_Medium_21_info; diff --git a/core/embed/lib/fonts/font_tthoves_bold_17.c b/core/embed/lib/fonts/font_tthoves_bold_17.c index d8b3138e3..9f04a7765 100644 --- a/core/embed/lib/fonts/font_tthoves_bold_17.c +++ b/core/embed/lib/fonts/font_tthoves_bold_17.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -78,9 +79,9 @@ /* } */ static const uint8_t Font_TTHoves_Bold_17_glyph_125[] = { 7, 17, 7, 0, 13, 65, 3, 0, 0, 246, 223, 1, 0, 246, 255, 10, 0, 16, 254, 13, 0, 0, 251, 13, 0, 0, 251, 13, 0, 0, 251, 14, 0, 0, 248, 207, 0, 0, 128, 255, 0, 0, 210, 255, 0, 0, 249, 127, 0, 0, 251, 14, 0, 0, 251, 13, 0, 0, 251, 13, 0, 81, 255, 12, 0, 246, 255, 8, 0, 246, 158, 0, 0 }; /* ~ */ static const uint8_t Font_TTHoves_Bold_17_glyph_126[] = { 10, 4, 10, 0, 7, 0, 98, 2, 0, 0, 128, 255, 159, 246, 143, 242, 255, 255, 255, 79, 245, 63, 180, 239, 7 }; -/* ? */ const uint8_t Font_TTHoves_Bold_17_upper_glyph_nonprintable[] = { 9, 12, 9, 0, 12, 255, 40, 32, 230, 255, 63, 0, 0, 16, 254, 10, 32, 39, 0, 248, 90, 213, 207, 0, 246, 255, 255, 95, 0, 249, 255, 223, 2, 96, 255, 255, 95, 0, 250, 255, 255, 47, 64, 255, 255, 255, 239, 238, 255, 255, 255, 63, 99, 255, 255, 255, 15, 48, 255, 255, 255, 15, 48, 255, 255 }; +/* ? */ static const uint8_t Font_TTHoves_Bold_17_glyph_nonprintable[] = { 9, 12, 9, 0, 12, 255, 40, 32, 230, 255, 63, 0, 0, 16, 254, 10, 32, 39, 0, 248, 90, 213, 207, 0, 246, 255, 255, 95, 0, 249, 255, 223, 2, 96, 255, 255, 95, 0, 250, 255, 255, 47, 64, 255, 255, 255, 239, 238, 255, 255, 255, 63, 99, 255, 255, 255, 15, 48, 255, 255, 255, 15, 48, 255, 255 }; -const uint8_t * const Font_TTHoves_Bold_17_upper[126 + 1 - 32] = { +static const uint8_t * const Font_TTHoves_Bold_17_upper[126 + 1 - 32] = { Font_TTHoves_Bold_17_glyph_32, Font_TTHoves_Bold_17_glyph_33, Font_TTHoves_Bold_17_glyph_34, @@ -177,3 +178,11 @@ const uint8_t * const Font_TTHoves_Bold_17_upper[126 + 1 - 32] = { Font_TTHoves_Bold_17_glyph_125, Font_TTHoves_Bold_17_glyph_126, }; + +const font_info_t Font_TTHoves_Bold_17_upper_info = { + .height = 17, + .max_height = 18, + .baseline = 4, + .glyph_data = Font_TTHoves_Bold_17_upper, + .glyph_nonprintable = Font_TTHoves_Bold_17_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_tthoves_bold_17.h b/core/embed/lib/fonts/font_tthoves_bold_17.h index 94ecd370d..e90cf1c6a 100644 --- a/core/embed/lib/fonts/font_tthoves_bold_17.h +++ b/core/embed/lib/fonts/font_tthoves_bold_17.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_TTHoves_Bold_17_upper_HEIGHT 17 + #define Font_TTHoves_Bold_17_upper_MAX_HEIGHT 18 -#define Font_TTHoves_Bold_17_upper_BASELINE 4 -extern const uint8_t* const Font_TTHoves_Bold_17_upper[126 + 1 - 32]; -extern const uint8_t Font_TTHoves_Bold_17_upper_glyph_nonprintable[]; +extern const font_info_t Font_TTHoves_Bold_17_upper_info; diff --git a/core/embed/lib/fonts/font_tthoves_demibold_21.c b/core/embed/lib/fonts/font_tthoves_demibold_21.c index de02f2ba8..a72098be4 100644 --- a/core/embed/lib/fonts/font_tthoves_demibold_21.c +++ b/core/embed/lib/fonts/font_tthoves_demibold_21.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -104,9 +105,9 @@ /* } */ static const uint8_t Font_TTHoves_DemiBold_21_glyph_125[] = { 7, 20, 8, 0, 16, 97, 37, 0, 0, 244, 255, 8, 0, 244, 255, 47, 0, 0, 248, 79, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 242, 175, 1, 0, 160, 255, 12, 0, 0, 249, 12, 0, 208, 255, 10, 0, 243, 143, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 245, 95, 0, 97, 252, 79, 0, 244, 255, 14, 0, 244, 207, 3, 0 }; /* ~ */ static const uint8_t Font_TTHoves_DemiBold_21_glyph_126[] = { 12, 5, 12, 0, 8, 0, 215, 158, 1, 144, 73, 112, 255, 255, 61, 245, 111, 224, 255, 254, 255, 255, 47, 241, 143, 64, 254, 255, 9, 64, 37, 0, 113, 72, 0 }; -/* ? */ const uint8_t Font_TTHoves_DemiBold_21_glyph_nonprintable[] = { 11, 15, 11, 0, 15, 255, 93, 2, 98, 254, 255, 175, 0, 0, 0, 192, 255, 30, 0, 100, 2, 16, 255, 11, 80, 255, 63, 0, 252, 157, 217, 255, 127, 0, 250, 255, 255, 255, 30, 0, 253, 255, 255, 159, 0, 80, 255, 255, 255, 9, 0, 248, 255, 255, 255, 2, 176, 255, 255, 255, 255, 0, 244, 255, 255, 255, 255, 85, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 17, 245, 255, 255, 255, 239, 0, 244, 255, 255, 255, 239, 0, 244, 255, 255 }; +/* ? */ static const uint8_t Font_TTHoves_DemiBold_21_glyph_nonprintable[] = { 11, 15, 11, 0, 15, 255, 93, 2, 98, 254, 255, 175, 0, 0, 0, 192, 255, 30, 0, 100, 2, 16, 255, 11, 80, 255, 63, 0, 252, 157, 217, 255, 127, 0, 250, 255, 255, 255, 30, 0, 253, 255, 255, 159, 0, 80, 255, 255, 255, 9, 0, 248, 255, 255, 255, 2, 176, 255, 255, 255, 255, 0, 244, 255, 255, 255, 255, 85, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 17, 245, 255, 255, 255, 239, 0, 244, 255, 255, 255, 239, 0, 244, 255, 255 }; -const uint8_t * const Font_TTHoves_DemiBold_21[126 + 1 - 32] = { +static const uint8_t * const Font_TTHoves_DemiBold_21[126 + 1 - 32] = { Font_TTHoves_DemiBold_21_glyph_32, Font_TTHoves_DemiBold_21_glyph_33, Font_TTHoves_DemiBold_21_glyph_34, @@ -203,3 +204,11 @@ const uint8_t * const Font_TTHoves_DemiBold_21[126 + 1 - 32] = { Font_TTHoves_DemiBold_21_glyph_125, Font_TTHoves_DemiBold_21_glyph_126, }; + +const font_info_t Font_TTHoves_DemiBold_21_info = { + .height = 21, + .max_height = 21, + .baseline = 4, + .glyph_data = Font_TTHoves_DemiBold_21, + .glyph_nonprintable = Font_TTHoves_DemiBold_21_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_tthoves_demibold_21.h b/core/embed/lib/fonts/font_tthoves_demibold_21.h index bcaf66460..faa915471 100644 --- a/core/embed/lib/fonts/font_tthoves_demibold_21.h +++ b/core/embed/lib/fonts/font_tthoves_demibold_21.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_TTHoves_DemiBold_21_HEIGHT 21 + #define Font_TTHoves_DemiBold_21_MAX_HEIGHT 21 -#define Font_TTHoves_DemiBold_21_BASELINE 4 -extern const uint8_t* const Font_TTHoves_DemiBold_21[126 + 1 - 32]; -extern const uint8_t Font_TTHoves_DemiBold_21_glyph_nonprintable[]; +extern const font_info_t Font_TTHoves_DemiBold_21_info; diff --git a/core/embed/lib/fonts/font_tthoves_regular_21.c b/core/embed/lib/fonts/font_tthoves_regular_21.c index 2db8aae33..22ece349e 100644 --- a/core/embed/lib/fonts/font_tthoves_regular_21.c +++ b/core/embed/lib/fonts/font_tthoves_regular_21.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -104,9 +105,9 @@ /* } */ static const uint8_t Font_TTHoves_Regular_21_glyph_125[] = { 6, 20, 7, 0, 16, 81, 3, 0, 244, 143, 0, 0, 250, 0, 0, 247, 1, 0, 247, 1, 0, 247, 1, 0, 247, 1, 0, 247, 1, 0, 246, 3, 0, 209, 77, 0, 48, 126, 0, 243, 25, 0, 247, 1, 0, 247, 1, 0, 247, 1, 0, 247, 1, 0, 247, 1, 0, 247, 1, 97, 237, 0, 244, 77, 0 }; /* ~ */ static const uint8_t Font_TTHoves_Regular_21_glyph_126[] = { 11, 4, 12, 0, 8, 0, 97, 21, 0, 48, 5, 64, 255, 239, 3, 208, 12, 192, 61, 211, 159, 251, 7, 224, 8, 0, 233, 142, 0 }; -/* ? */ const uint8_t Font_TTHoves_Regular_21_glyph_nonprintable[] = { 10, 15, 11, 0, 15, 255, 76, 17, 163, 255, 159, 0, 84, 1, 246, 14, 226, 255, 79, 176, 10, 250, 255, 239, 96, 239, 255, 255, 255, 64, 255, 255, 255, 207, 96, 255, 255, 255, 46, 192, 255, 255, 175, 1, 251, 255, 255, 10, 211, 255, 255, 255, 4, 254, 255, 255, 255, 19, 255, 255, 255, 255, 119, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35, 255, 255, 255, 255, 1, 255, 255 }; +/* ? */ static const uint8_t Font_TTHoves_Regular_21_glyph_nonprintable[] = { 10, 15, 11, 0, 15, 255, 76, 17, 163, 255, 159, 0, 84, 1, 246, 14, 226, 255, 79, 176, 10, 250, 255, 239, 96, 239, 255, 255, 255, 64, 255, 255, 255, 207, 96, 255, 255, 255, 46, 192, 255, 255, 175, 1, 251, 255, 255, 10, 211, 255, 255, 255, 4, 254, 255, 255, 255, 19, 255, 255, 255, 255, 119, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35, 255, 255, 255, 255, 1, 255, 255 }; -const uint8_t * const Font_TTHoves_Regular_21[126 + 1 - 32] = { +static const uint8_t * const Font_TTHoves_Regular_21[126 + 1 - 32] = { Font_TTHoves_Regular_21_glyph_32, Font_TTHoves_Regular_21_glyph_33, Font_TTHoves_Regular_21_glyph_34, @@ -203,3 +204,11 @@ const uint8_t * const Font_TTHoves_Regular_21[126 + 1 - 32] = { Font_TTHoves_Regular_21_glyph_125, Font_TTHoves_Regular_21_glyph_126, }; + +const font_info_t Font_TTHoves_Regular_21_info = { + .height = 21, + .max_height = 21, + .baseline = 4, + .glyph_data = Font_TTHoves_Regular_21, + .glyph_nonprintable = Font_TTHoves_Regular_21_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_tthoves_regular_21.h b/core/embed/lib/fonts/font_tthoves_regular_21.h index 82e48105f..c9cb109e5 100644 --- a/core/embed/lib/fonts/font_tthoves_regular_21.h +++ b/core/embed/lib/fonts/font_tthoves_regular_21.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_TTHoves_Regular_21_HEIGHT 21 + #define Font_TTHoves_Regular_21_MAX_HEIGHT 21 -#define Font_TTHoves_Regular_21_BASELINE 4 -extern const uint8_t* const Font_TTHoves_Regular_21[126 + 1 - 32]; -extern const uint8_t Font_TTHoves_Regular_21_glyph_nonprintable[]; +extern const font_info_t Font_TTHoves_Regular_21_info; diff --git a/core/embed/lib/fonts/font_ttsatoshi_demibold_18.c b/core/embed/lib/fonts/font_ttsatoshi_demibold_18.c index f46c501da..248df600f 100644 --- a/core/embed/lib/fonts/font_ttsatoshi_demibold_18.c +++ b/core/embed/lib/fonts/font_ttsatoshi_demibold_18.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -9,7 +10,6 @@ // - the rest is packed 4-bit glyph data // NOTE: numeral chars ('0','1',..,'9') mapped to alternative style glyphs contained in the font (glyph indices: 1298-1307) - /* */ static const uint8_t Font_TTSatoshi_DemiBold_18_glyph_32[] = { 0, 0, 5, 0, 0 }; /* ! */ static const uint8_t Font_TTSatoshi_DemiBold_18_glyph_33[] = { 3, 13, 5, 1, 13, 248, 12, 248, 12, 248, 12, 248, 12, 248, 12, 248, 11, 247, 10, 245, 8, 244, 7, 64, 1, 132, 6, 248, 12, 248, 12 }; /* " */ static const uint8_t Font_TTSatoshi_DemiBold_18_glyph_34[] = { 6, 5, 8, 1, 13, 254, 146, 127, 254, 146, 127, 254, 146, 127, 254, 146, 127, 34, 16, 18 }; @@ -106,9 +106,9 @@ /* } */ static const uint8_t Font_TTSatoshi_DemiBold_18_glyph_125[] = { 6, 18, 7, 0, 14, 0, 0, 0, 245, 159, 0, 245, 255, 5, 0, 252, 8, 0, 250, 9, 0, 250, 9, 0, 250, 9, 0, 249, 28, 0, 210, 223, 0, 128, 223, 0, 247, 110, 0, 250, 9, 0, 250, 9, 0, 250, 9, 0, 250, 9, 16, 253, 8, 245, 255, 5, 245, 142, 0 }; /* ~ */ static const uint8_t Font_TTSatoshi_DemiBold_18_glyph_126[] = { 10, 4, 11, 0, 7, 32, 251, 44, 48, 137, 192, 255, 239, 182, 191, 242, 127, 250, 255, 111, 146, 9, 112, 238, 8 }; -/* ? */ const uint8_t Font_TTSatoshi_DemiBold_18_glyph_nonprintable[] = { 9, 13, 10, 0, 13, 255, 56, 32, 229, 255, 79, 0, 0, 0, 253, 11, 80, 139, 0, 245, 41, 243, 255, 6, 242, 255, 255, 255, 3, 243, 255, 255, 61, 0, 249, 255, 239, 1, 160, 255, 255, 143, 0, 253, 255, 255, 111, 64, 255, 255, 255, 223, 219, 255, 255, 255, 175, 151, 255, 255, 255, 95, 64, 255, 255, 255, 95, 64, 255, 255 }; +/* ? */ static const uint8_t Font_TTSatoshi_DemiBold_18_glyph_nonprintable[] = { 9, 13, 10, 0, 13, 255, 56, 32, 229, 255, 79, 0, 0, 0, 253, 11, 80, 139, 0, 245, 41, 243, 255, 6, 242, 255, 255, 255, 3, 243, 255, 255, 61, 0, 249, 255, 239, 1, 160, 255, 255, 143, 0, 253, 255, 255, 111, 64, 255, 255, 255, 223, 219, 255, 255, 255, 175, 151, 255, 255, 255, 95, 64, 255, 255, 255, 95, 64, 255, 255 }; -const uint8_t * const Font_TTSatoshi_DemiBold_18[126 + 1 - 32] = { +static const uint8_t * const Font_TTSatoshi_DemiBold_18[126 + 1 - 32] = { Font_TTSatoshi_DemiBold_18_glyph_32, Font_TTSatoshi_DemiBold_18_glyph_33, Font_TTSatoshi_DemiBold_18_glyph_34, @@ -205,3 +205,11 @@ const uint8_t * const Font_TTSatoshi_DemiBold_18[126 + 1 - 32] = { Font_TTSatoshi_DemiBold_18_glyph_125, Font_TTSatoshi_DemiBold_18_glyph_126, }; + +const font_info_t Font_TTSatoshi_DemiBold_18_info = { + .height = 18, + .max_height = 19, + .baseline = 4, + .glyph_data = Font_TTSatoshi_DemiBold_18, + .glyph_nonprintable = Font_TTSatoshi_DemiBold_18_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_ttsatoshi_demibold_18.h b/core/embed/lib/fonts/font_ttsatoshi_demibold_18.h index 0508e3a32..4a1af8ff9 100644 --- a/core/embed/lib/fonts/font_ttsatoshi_demibold_18.h +++ b/core/embed/lib/fonts/font_ttsatoshi_demibold_18.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_TTSatoshi_DemiBold_18_HEIGHT 18 + #define Font_TTSatoshi_DemiBold_18_MAX_HEIGHT 19 -#define Font_TTSatoshi_DemiBold_18_BASELINE 4 -extern const uint8_t* const Font_TTSatoshi_DemiBold_18[126 + 1 - 32]; -extern const uint8_t Font_TTSatoshi_DemiBold_18_glyph_nonprintable[]; +extern const font_info_t Font_TTSatoshi_DemiBold_18_info; diff --git a/core/embed/lib/fonts/font_ttsatoshi_demibold_21.c b/core/embed/lib/fonts/font_ttsatoshi_demibold_21.c index edd6f21f3..91095e352 100644 --- a/core/embed/lib/fonts/font_ttsatoshi_demibold_21.c +++ b/core/embed/lib/fonts/font_ttsatoshi_demibold_21.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -106,9 +107,9 @@ /* } */ static const uint8_t Font_TTSatoshi_DemiBold_21_glyph_125[] = { 7, 20, 8, 0, 16, 97, 37, 0, 0, 244, 255, 7, 0, 244, 255, 47, 0, 0, 248, 79, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 242, 175, 1, 0, 160, 255, 12, 0, 0, 250, 12, 0, 208, 255, 10, 0, 243, 143, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 244, 95, 0, 0, 244, 95, 0, 97, 252, 79, 0, 244, 255, 14, 0, 244, 191, 3, 0 }; /* ~ */ static const uint8_t Font_TTSatoshi_DemiBold_21_glyph_126[] = { 12, 5, 12, 0, 8, 0, 215, 158, 1, 144, 73, 112, 255, 255, 61, 246, 111, 224, 255, 251, 255, 255, 47, 241, 127, 64, 254, 255, 9, 48, 19, 0, 113, 72, 0 }; -/* ? */ const uint8_t Font_TTSatoshi_DemiBold_21_glyph_nonprintable[] = { 11, 15, 11, 0, 15, 255, 93, 2, 98, 254, 255, 175, 0, 0, 0, 176, 255, 30, 0, 100, 2, 16, 255, 11, 80, 255, 63, 0, 252, 156, 217, 255, 127, 0, 250, 255, 255, 255, 46, 0, 252, 255, 255, 159, 0, 80, 255, 255, 255, 9, 0, 248, 255, 255, 255, 2, 176, 255, 255, 255, 255, 0, 244, 255, 255, 255, 255, 85, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 17, 245, 255, 255, 255, 239, 0, 244, 255, 255, 255, 239, 0, 244, 255, 255 }; +/* ? */ static const uint8_t Font_TTSatoshi_DemiBold_21_glyph_nonprintable[] = { 11, 15, 11, 0, 15, 255, 93, 2, 98, 254, 255, 175, 0, 0, 0, 176, 255, 30, 0, 100, 2, 16, 255, 11, 80, 255, 63, 0, 252, 156, 217, 255, 127, 0, 250, 255, 255, 255, 46, 0, 252, 255, 255, 159, 0, 80, 255, 255, 255, 9, 0, 248, 255, 255, 255, 2, 176, 255, 255, 255, 255, 0, 244, 255, 255, 255, 255, 85, 249, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 17, 245, 255, 255, 255, 239, 0, 244, 255, 255, 255, 239, 0, 244, 255, 255 }; -const uint8_t * const Font_TTSatoshi_DemiBold_21[126 + 1 - 32] = { +static const uint8_t * const Font_TTSatoshi_DemiBold_21[126 + 1 - 32] = { Font_TTSatoshi_DemiBold_21_glyph_32, Font_TTSatoshi_DemiBold_21_glyph_33, Font_TTSatoshi_DemiBold_21_glyph_34, @@ -205,3 +206,11 @@ const uint8_t * const Font_TTSatoshi_DemiBold_21[126 + 1 - 32] = { Font_TTSatoshi_DemiBold_21_glyph_125, Font_TTSatoshi_DemiBold_21_glyph_126, }; + +const font_info_t Font_TTSatoshi_DemiBold_21_info = { + .height = 21, + .max_height = 21, + .baseline = 4, + .glyph_data = Font_TTSatoshi_DemiBold_21, + .glyph_nonprintable = Font_TTSatoshi_DemiBold_21_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_ttsatoshi_demibold_21.h b/core/embed/lib/fonts/font_ttsatoshi_demibold_21.h index 79c7b4240..95dbe9c77 100644 --- a/core/embed/lib/fonts/font_ttsatoshi_demibold_21.h +++ b/core/embed/lib/fonts/font_ttsatoshi_demibold_21.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_TTSatoshi_DemiBold_21_HEIGHT 21 + #define Font_TTSatoshi_DemiBold_21_MAX_HEIGHT 21 -#define Font_TTSatoshi_DemiBold_21_BASELINE 4 -extern const uint8_t* const Font_TTSatoshi_DemiBold_21[126 + 1 - 32]; -extern const uint8_t Font_TTSatoshi_DemiBold_21_glyph_nonprintable[]; +extern const font_info_t Font_TTSatoshi_DemiBold_21_info; diff --git a/core/embed/lib/fonts/font_ttsatoshi_demibold_42.c b/core/embed/lib/fonts/font_ttsatoshi_demibold_42.c index 20bc5b8f8..2ff80209b 100644 --- a/core/embed/lib/fonts/font_ttsatoshi_demibold_42.c +++ b/core/embed/lib/fonts/font_ttsatoshi_demibold_42.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -8,6 +9,8 @@ // - the third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph // - the rest is packed 4-bit glyph data +// NOTE: glyphs of uppercase and special characters removed to save space as they are not used + /* */ static const uint8_t Font_TTSatoshi_DemiBold_42_glyph_32[] = { 0, 0, 11, 0, 0 }; /* a */ static const uint8_t Font_TTSatoshi_DemiBold_42_glyph_97[] = { 20, 23, 23, 1, 22, 0, 0, 0, 147, 237, 239, 140, 3, 0, 0, 0, 0, 161, 255, 255, 255, 255, 191, 2, 0, 0, 48, 255, 255, 255, 255, 255, 255, 62, 0, 0, 225, 255, 255, 255, 255, 255, 255, 239, 1, 0, 250, 255, 255, 108, 100, 252, 255, 255, 9, 0, 255, 255, 159, 0, 0, 176, 255, 255, 15, 64, 255, 255, 15, 0, 0, 32, 255, 255, 95, 16, 34, 34, 2, 0, 0, 0, 253, 255, 127, 0, 0, 0, 0, 0, 0, 0, 251, 255, 159, 0, 0, 96, 218, 254, 255, 255, 255, 255, 159, 0, 96, 255, 255, 255, 255, 255, 255, 255, 159, 0, 249, 255, 255, 255, 255, 255, 255, 255, 159, 80, 255, 255, 255, 255, 255, 255, 255, 255, 159, 208, 255, 255, 143, 2, 0, 0, 250, 255, 159, 242, 255, 255, 5, 0, 0, 0, 252, 255, 159, 244, 255, 255, 0, 0, 0, 0, 255, 255, 159, 244, 255, 255, 0, 0, 0, 112, 255, 255, 159, 242, 255, 255, 6, 0, 0, 244, 255, 255, 159, 224, 255, 255, 159, 52, 166, 255, 255, 255, 159, 80, 255, 255, 255, 255, 255, 255, 255, 255, 159, 0, 250, 255, 255, 255, 255, 255, 251, 255, 159, 0, 112, 255, 255, 255, 255, 111, 240, 255, 159, 0, 0, 129, 236, 223, 123, 0, 0, 0, 0 }; /* b */ static const uint8_t Font_TTSatoshi_DemiBold_42_glyph_98[] = { 23, 30, 26, 2, 29, 240, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 255, 2, 96, 218, 239, 124, 1, 0, 0, 0, 240, 255, 255, 82, 254, 255, 255, 255, 143, 0, 0, 0, 240, 255, 255, 249, 255, 255, 255, 255, 255, 11, 0, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 207, 0, 0, 240, 255, 255, 255, 255, 239, 255, 255, 255, 255, 7, 0, 240, 255, 255, 255, 94, 1, 48, 252, 255, 255, 31, 0, 240, 255, 255, 223, 1, 0, 0, 144, 255, 255, 127, 0, 240, 255, 255, 63, 0, 0, 0, 0, 254, 255, 207, 0, 240, 255, 255, 11, 0, 0, 0, 0, 246, 255, 255, 0, 240, 255, 255, 7, 0, 0, 0, 0, 242, 255, 255, 3, 240, 255, 255, 5, 0, 0, 0, 0, 240, 255, 255, 4, 240, 255, 255, 3, 0, 0, 0, 0, 224, 255, 255, 5, 240, 255, 255, 5, 0, 0, 0, 0, 240, 255, 255, 4, 240, 255, 255, 7, 0, 0, 0, 0, 242, 255, 255, 3, 240, 255, 255, 11, 0, 0, 0, 0, 246, 255, 255, 0, 240, 255, 255, 63, 0, 0, 0, 0, 254, 255, 207, 0, 240, 255, 255, 207, 1, 0, 0, 144, 255, 255, 127, 0, 240, 255, 255, 255, 94, 1, 48, 252, 255, 255, 31, 0, 240, 255, 255, 255, 255, 239, 255, 255, 255, 255, 7, 0, 240, 255, 255, 255, 255, 255, 255, 255, 255, 207, 0, 0, 240, 255, 239, 250, 255, 255, 255, 255, 255, 28, 0, 0, 240, 255, 175, 112, 255, 255, 255, 255, 143, 0, 0, 0, 0, 0, 0, 0, 113, 219, 239, 124, 1, 0, 0, 0 }; @@ -36,9 +39,9 @@ /* y */ static const uint8_t Font_TTSatoshi_DemiBold_42_glyph_121[] = { 23, 29, 22, 0, 21, 252, 255, 175, 0, 0, 0, 0, 0, 246, 255, 255, 1, 246, 255, 255, 1, 0, 0, 0, 0, 251, 255, 191, 0, 240, 255, 255, 6, 0, 0, 0, 16, 255, 255, 95, 0, 160, 255, 255, 13, 0, 0, 0, 112, 255, 255, 15, 0, 48, 255, 255, 63, 0, 0, 0, 208, 255, 255, 9, 0, 0, 253, 255, 159, 0, 0, 0, 242, 255, 255, 3, 0, 0, 247, 255, 255, 0, 0, 0, 248, 255, 239, 0, 0, 0, 241, 255, 255, 6, 0, 0, 254, 255, 143, 0, 0, 0, 160, 255, 255, 12, 0, 64, 255, 255, 47, 0, 0, 0, 64, 255, 255, 47, 0, 144, 255, 255, 12, 0, 0, 0, 0, 253, 255, 143, 0, 240, 255, 255, 6, 0, 0, 0, 0, 247, 255, 239, 0, 245, 255, 255, 1, 0, 0, 0, 0, 241, 255, 255, 5, 251, 255, 191, 0, 0, 0, 0, 0, 176, 255, 255, 27, 255, 255, 95, 0, 0, 0, 0, 0, 64, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 9, 0, 0, 0, 0, 0, 0, 248, 255, 255, 255, 255, 3, 0, 0, 0, 0, 0, 0, 242, 255, 255, 255, 223, 0, 0, 0, 0, 0, 0, 0, 176, 255, 255, 255, 143, 0, 0, 0, 0, 0, 0, 0, 80, 255, 255, 255, 47, 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 12, 0, 0, 0, 0, 0, 0, 0, 0, 249, 255, 255, 6, 0, 0, 0, 0, 0, 0, 0, 0, 247, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 16, 253, 255, 191, 0, 0, 0, 0, 0, 0, 214, 221, 253, 255, 255, 95, 0, 0, 0, 0, 0, 0, 247, 255, 255, 255, 255, 14, 0, 0, 0, 0, 0, 0, 247, 255, 255, 255, 255, 6, 0, 0, 0, 0, 0, 0, 247, 255, 255, 255, 175, 0, 0, 0, 0, 0, 0, 0, 247, 255, 255, 189, 4, 0, 0, 0, 0, 0, 0 }; /* z */ static const uint8_t Font_TTSatoshi_DemiBold_42_glyph_122[] = { 18, 21, 20, 1, 21, 248, 255, 255, 255, 255, 255, 255, 255, 127, 248, 255, 255, 255, 255, 255, 255, 255, 127, 248, 255, 255, 255, 255, 255, 255, 255, 127, 248, 255, 255, 255, 255, 255, 255, 255, 127, 215, 221, 221, 221, 221, 254, 255, 255, 111, 0, 0, 0, 0, 0, 252, 255, 255, 10, 0, 0, 0, 0, 176, 255, 255, 191, 0, 0, 0, 0, 0, 250, 255, 255, 12, 0, 0, 0, 0, 144, 255, 255, 223, 1, 0, 0, 0, 0, 247, 255, 255, 46, 0, 0, 0, 0, 96, 255, 255, 255, 2, 0, 0, 0, 0, 245, 255, 255, 63, 0, 0, 0, 0, 48, 255, 255, 255, 5, 0, 0, 0, 0, 242, 255, 255, 111, 0, 0, 0, 0, 32, 254, 255, 255, 7, 0, 0, 0, 0, 209, 255, 255, 159, 0, 0, 0, 0, 0, 250, 255, 255, 223, 221, 221, 221, 221, 157, 251, 255, 255, 255, 255, 255, 255, 255, 175, 251, 255, 255, 255, 255, 255, 255, 255, 175, 251, 255, 255, 255, 255, 255, 255, 255, 175, 251, 255, 255, 255, 255, 255, 255, 255, 175 }; -/* ? */ const uint8_t Font_TTSatoshi_DemiBold_42_glyph_nonprintable[] = { 20, 30, 22, 1, 30, 255, 255, 223, 55, 1, 32, 132, 253, 255, 255, 255, 223, 4, 0, 0, 0, 0, 80, 254, 255, 255, 11, 0, 0, 0, 0, 0, 0, 193, 255, 207, 0, 0, 0, 0, 0, 0, 0, 16, 253, 63, 0, 0, 0, 0, 0, 0, 0, 0, 244, 11, 0, 0, 80, 235, 157, 1, 0, 0, 192, 6, 0, 0, 247, 255, 255, 63, 0, 0, 112, 2, 0, 0, 255, 255, 255, 207, 0, 0, 80, 35, 34, 82, 255, 255, 255, 255, 0, 0, 48, 255, 255, 255, 255, 255, 255, 255, 0, 0, 80, 255, 255, 255, 255, 255, 255, 175, 0, 0, 112, 255, 255, 255, 255, 255, 255, 10, 0, 0, 192, 255, 255, 255, 255, 255, 77, 0, 0, 0, 243, 255, 255, 255, 255, 143, 0, 0, 0, 16, 253, 255, 255, 255, 255, 9, 0, 0, 0, 211, 255, 255, 255, 255, 223, 0, 0, 0, 161, 255, 255, 255, 255, 255, 127, 0, 0, 48, 254, 255, 255, 255, 255, 255, 47, 0, 0, 241, 255, 255, 255, 255, 255, 255, 31, 0, 0, 248, 255, 255, 255, 255, 255, 255, 15, 0, 0, 251, 255, 255, 255, 255, 255, 255, 15, 0, 0, 252, 255, 255, 255, 255, 255, 255, 175, 170, 170, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 44, 34, 34, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255 }; +/* ? */ static const uint8_t Font_TTSatoshi_DemiBold_42_glyph_nonprintable[] = { 20, 30, 22, 1, 30, 255, 255, 223, 55, 1, 32, 132, 253, 255, 255, 255, 223, 4, 0, 0, 0, 0, 80, 254, 255, 255, 11, 0, 0, 0, 0, 0, 0, 193, 255, 207, 0, 0, 0, 0, 0, 0, 0, 16, 253, 63, 0, 0, 0, 0, 0, 0, 0, 0, 244, 11, 0, 0, 80, 235, 157, 1, 0, 0, 192, 6, 0, 0, 247, 255, 255, 63, 0, 0, 112, 2, 0, 0, 255, 255, 255, 207, 0, 0, 80, 35, 34, 82, 255, 255, 255, 255, 0, 0, 48, 255, 255, 255, 255, 255, 255, 255, 0, 0, 80, 255, 255, 255, 255, 255, 255, 175, 0, 0, 112, 255, 255, 255, 255, 255, 255, 10, 0, 0, 192, 255, 255, 255, 255, 255, 77, 0, 0, 0, 243, 255, 255, 255, 255, 143, 0, 0, 0, 16, 253, 255, 255, 255, 255, 9, 0, 0, 0, 211, 255, 255, 255, 255, 223, 0, 0, 0, 161, 255, 255, 255, 255, 255, 127, 0, 0, 48, 254, 255, 255, 255, 255, 255, 47, 0, 0, 241, 255, 255, 255, 255, 255, 255, 31, 0, 0, 248, 255, 255, 255, 255, 255, 255, 15, 0, 0, 251, 255, 255, 255, 255, 255, 255, 15, 0, 0, 252, 255, 255, 255, 255, 255, 255, 175, 170, 170, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 44, 34, 34, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255, 255, 255, 255, 12, 0, 0, 249, 255, 255, 255 }; -const uint8_t * const Font_TTSatoshi_DemiBold_42[126 + 1 - 32] = { +static const uint8_t * const Font_TTSatoshi_DemiBold_42[126 + 1 - 32] = { Font_TTSatoshi_DemiBold_42_glyph_32, Font_TTSatoshi_DemiBold_42_glyph_nonprintable, Font_TTSatoshi_DemiBold_42_glyph_nonprintable, @@ -135,3 +138,11 @@ const uint8_t * const Font_TTSatoshi_DemiBold_42[126 + 1 - 32] = { Font_TTSatoshi_DemiBold_42_glyph_nonprintable, Font_TTSatoshi_DemiBold_42_glyph_nonprintable, }; + +const font_info_t Font_TTSatoshi_DemiBold_42_info = { + .height = 42, + .max_height = 44, + .baseline = 9, + .glyph_data = Font_TTSatoshi_DemiBold_42, + .glyph_nonprintable = Font_TTSatoshi_DemiBold_42_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_ttsatoshi_demibold_42.h b/core/embed/lib/fonts/font_ttsatoshi_demibold_42.h index 6b737171e..c0583a490 100644 --- a/core/embed/lib/fonts/font_ttsatoshi_demibold_42.h +++ b/core/embed/lib/fonts/font_ttsatoshi_demibold_42.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 4 #error Wrong TREZOR_FONT_BPP (expected 4) #endif -#define Font_TTSatoshi_DemiBold_42_HEIGHT 42 + #define Font_TTSatoshi_DemiBold_42_MAX_HEIGHT 44 -#define Font_TTSatoshi_DemiBold_42_BASELINE 9 -extern const uint8_t* const Font_TTSatoshi_DemiBold_42[126 + 1 - 32]; -extern const uint8_t Font_TTSatoshi_DemiBold_42_glyph_nonprintable[]; +extern const font_info_t Font_TTSatoshi_DemiBold_42_info; diff --git a/core/embed/lib/fonts/font_unifont_bold_16.c b/core/embed/lib/fonts/font_unifont_bold_16.c index 666d0049d..30e2aa35d 100644 --- a/core/embed/lib/fonts/font_unifont_bold_16.c +++ b/core/embed/lib/fonts/font_unifont_bold_16.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -104,9 +105,9 @@ /* } */ static const uint8_t Font_Unifont_Bold_16_glyph_125[] = { 5, 13, 7, 0, 11, 225, 140, 198, 24, 102, 99, 12, 110, 0 }; /* ~ */ static const uint8_t Font_Unifont_Bold_16_glyph_126[] = { 7, 3, 8, 0, 11, 99, 118, 48 }; -/* ? */ const uint8_t Font_Unifont_Bold_16_glyph_nonprintable[] = { 6, 10, 7, 0, 10, 5, 199, 60, 231, 60, 255, 207, 63 }; +/* ? */ static const uint8_t Font_Unifont_Bold_16_glyph_nonprintable[] = { 6, 10, 7, 0, 10, 5, 199, 60, 231, 60, 255, 207, 63 }; -const uint8_t * const Font_Unifont_Bold_16[126 + 1 - 32] = { +static const uint8_t * const Font_Unifont_Bold_16[126 + 1 - 32] = { Font_Unifont_Bold_16_glyph_32, Font_Unifont_Bold_16_glyph_33, Font_Unifont_Bold_16_glyph_34, @@ -203,3 +204,11 @@ const uint8_t * const Font_Unifont_Bold_16[126 + 1 - 32] = { Font_Unifont_Bold_16_glyph_125, Font_Unifont_Bold_16_glyph_126, }; + +const font_info_t Font_Unifont_Bold_16_info = { + .height = 16, + .max_height = 15, + .baseline = 2, + .glyph_data = Font_Unifont_Bold_16, + .glyph_nonprintable = Font_Unifont_Bold_16_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_unifont_bold_16.h b/core/embed/lib/fonts/font_unifont_bold_16.h index 976e13c18..afd21f6be 100644 --- a/core/embed/lib/fonts/font_unifont_bold_16.h +++ b/core/embed/lib/fonts/font_unifont_bold_16.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 1 #error Wrong TREZOR_FONT_BPP (expected 1) #endif -#define Font_Unifont_Bold_16_HEIGHT 16 + #define Font_Unifont_Bold_16_MAX_HEIGHT 15 -#define Font_Unifont_Bold_16_BASELINE 2 -extern const uint8_t* const Font_Unifont_Bold_16[126 + 1 - 32]; -extern const uint8_t Font_Unifont_Bold_16_glyph_nonprintable[]; +extern const font_info_t Font_Unifont_Bold_16_info; diff --git a/core/embed/lib/fonts/font_unifont_regular_16.c b/core/embed/lib/fonts/font_unifont_regular_16.c index ecb753945..47bd89fc4 100644 --- a/core/embed/lib/fonts/font_unifont_regular_16.c +++ b/core/embed/lib/fonts/font_unifont_regular_16.c @@ -1,6 +1,7 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" // clang-format off @@ -108,9 +109,9 @@ /* } */ static const uint8_t Font_Unifont_Regular_16_glyph_125[] = { 4, 13, 7, 1, 11, 194, 36, 66, 18, 68, 34, 192 }; /* ~ */ static const uint8_t Font_Unifont_Regular_16_glyph_126[] = { 7, 3, 8, 0, 11, 99, 38, 48 }; // < --- advanced changed from 7 to 8 -/* ? */ const uint8_t Font_Unifont_Regular_16_glyph_nonprintable[] = { 6, 10, 7, 0, 10, 133, 231, 190, 247, 190, 255, 239, 191 }; +/* ? */ static const uint8_t Font_Unifont_Regular_16_glyph_nonprintable[] = { 6, 10, 7, 0, 10, 133, 231, 190, 247, 190, 255, 239, 191 }; -const uint8_t * const Font_Unifont_Regular_16[126 + 1 - 32] = { +static const uint8_t * const Font_Unifont_Regular_16[126 + 1 - 32] = { Font_Unifont_Regular_16_glyph_32, Font_Unifont_Regular_16_glyph_33, Font_Unifont_Regular_16_glyph_34, @@ -207,3 +208,11 @@ const uint8_t * const Font_Unifont_Regular_16[126 + 1 - 32] = { Font_Unifont_Regular_16_glyph_125, Font_Unifont_Regular_16_glyph_126, }; + +const font_info_t Font_Unifont_Regular_16_info = { + .height = 16, + .max_height = 15, + .baseline = 2, + .glyph_data = Font_Unifont_Regular_16, + .glyph_nonprintable = Font_Unifont_Regular_16_glyph_nonprintable, +}; diff --git a/core/embed/lib/fonts/font_unifont_regular_16.h b/core/embed/lib/fonts/font_unifont_regular_16.h index 108b384d9..20153f174 100644 --- a/core/embed/lib/fonts/font_unifont_regular_16.h +++ b/core/embed/lib/fonts/font_unifont_regular_16.h @@ -1,12 +1,11 @@ // This file is generated by core/tools/codegen/gen_font.py #include +#include "fonts_types.h" #if TREZOR_FONT_BPP != 1 #error Wrong TREZOR_FONT_BPP (expected 1) #endif -#define Font_Unifont_Regular_16_HEIGHT 16 + #define Font_Unifont_Regular_16_MAX_HEIGHT 15 -#define Font_Unifont_Regular_16_BASELINE 2 -extern const uint8_t* const Font_Unifont_Regular_16[126 + 1 - 32]; -extern const uint8_t Font_Unifont_Regular_16_glyph_nonprintable[]; +extern const font_info_t Font_Unifont_Regular_16_info; diff --git a/core/embed/lib/fonts/fonts_types.h b/core/embed/lib/fonts/fonts_types.h index 7b5ec3866..3871137cc 100644 --- a/core/embed/lib/fonts/fonts_types.h +++ b/core/embed/lib/fonts/fonts_types.h @@ -5,7 +5,6 @@ /// Font information structure containing metadata and pointers to font data typedef struct { - const char* name; int height; int max_height; int baseline; diff --git a/core/tools/codegen/gen_font.py b/core/tools/codegen/gen_font.py index bd86912d8..11fd05fe4 100755 --- a/core/tools/codegen/gen_font.py +++ b/core/tools/codegen/gen_font.py @@ -24,7 +24,7 @@ def _normalize(s: str) -> str: HERE = Path(__file__).parent CORE_ROOT = HERE.parent.parent FONTS_DIR = HERE / "fonts" -OUT_DIR = HERE / ".." / ".." / "embed" / "lib" / "fonts" +OUT_DIR = CORE_ROOT / "embed" / "lib" / "fonts" C_FONTS_DEST = CORE_ROOT / "embed" / "lib" / "fonts" JSON_FONTS_DEST = CORE_ROOT / "translations" / "fonts" @@ -362,20 +362,15 @@ class FaceProcessor: self._write_char_definition(f, chr(i), i) # Write nonprintable glyph - if self.gen_normal: - f.write("\n") - nonprintable = self._get_nonprintable_definition_line() - f.write(nonprintable) - if self.gen_upper: - f.write("\n") - nonprintable = self._get_nonprintable_definition_line(upper=True) - f.write(nonprintable) + f.write("\n") + nonprintable = self._get_nonprintable_definition_line() + f.write(nonprintable) # Write array of all glyphs if self.gen_normal: f.write("\n") f.write( - f"const uint8_t * const Font_{self._name_style_size}[{MAX_GLYPH} + 1 - {MIN_GLYPH}] = {{\n" + f"static const uint8_t * const Font_{self._name_style_size}[{MAX_GLYPH} + 1 - {MIN_GLYPH}] = {{\n" ) for i in range(MIN_GLYPH, MAX_GLYPH + 1): f.write(f" Font_{self._name_style_size}_glyph_{i},\n") @@ -385,7 +380,7 @@ class FaceProcessor: if self.gen_upper: f.write("\n") f.write( - f"const uint8_t * const Font_{self._name_style_size}_upper[{MAX_GLYPH} + 1 - {MIN_GLYPH}] = {{\n" + f"static const uint8_t * const Font_{self._name_style_size}_upper[{MAX_GLYPH} + 1 - {MIN_GLYPH}] = {{\n" ) for i in range(MIN_GLYPH, MAX_GLYPH + 1): comment = "" @@ -397,6 +392,12 @@ class FaceProcessor: f.write(f" Font_{self._name_style_size}_glyph_{i},{comment}\n") f.write("};\n") + # Write font info structure + if self.gen_normal: + self._write_font_info_structure(f) + if self.gen_upper: + self._write_font_info_structure(f, is_upper=True) + def _write_char_definition(self, f: TextIO, c: str, i: int) -> None: self._load_char(c) glyph = Glyph.from_face(self.face, c, self.shaveX) @@ -412,7 +413,8 @@ class FaceProcessor: def _write_c_file_header(self, f: TextIO) -> None: f.write("// This file is generated by core/tools/codegen/gen_font.py\n\n") - f.write("#include \n\n") + f.write("#include \n") + f.write('#include "fonts_types.h"\n\n') f.write("// clang-format off\n\n") f.write("// - the first two bytes are width and height of the glyph\n") f.write( @@ -420,18 +422,27 @@ class FaceProcessor: ) f.write(f"// - the rest is packed {self.bpp}-bit glyph data\n\n") - def _get_nonprintable_definition_line(self, upper: bool = False) -> str: + # Write font info structure to instantiate font_info_t defined in fonts_types.h + def _write_font_info_structure(self, f: TextIO, is_upper: bool = False): + suffix = "_upper" if is_upper else "" + f.write("\n") + f.write(f"const font_info_t Font_{self._name_style_size}{suffix}_info = {{\n") + f.write(f" .height = {self.size},\n") + f.write(f" .max_height = {self.font_ymax - self.font_ymin},\n") + f.write(f" .baseline = {-self.font_ymin},\n") + f.write(f" .glyph_data = Font_{self._name_style_size}{suffix},\n") + f.write( + f" .glyph_nonprintable = Font_{self._name_style_size}_glyph_nonprintable,\n" + ) + f.write("};\n") + + def _get_nonprintable_definition_line(self) -> str: c = "?" self._load_char(c) glyph = Glyph.from_face(self.face, c, self.shaveX, inverse_colors=True) - if upper: - return glyph.get_definition_line( - f"{self._name_style_size}_upper", self.bpp, "nonprintable", static=False - ) - else: - return glyph.get_definition_line( - self._name_style_size, self.bpp, "nonprintable", static=False - ) + return glyph.get_definition_line( + self._name_style_size, self.bpp, "nonprintable", static=True + ) def _load_char(self, c: str) -> None: self.face.load_char(c, freetype.FT_LOAD_RENDER | freetype.FT_LOAD_TARGET_NORMAL) # type: ignore @@ -439,39 +450,24 @@ class FaceProcessor: def _write_h_file(self) -> None: with open(OUT_DIR / self._h_file_name, "wt") as f: f.write("// This file is generated by core/tools/codegen/gen_font.py\n\n") - f.write("#include \n\n") + f.write("#include \n") + f.write('#include "fonts_types.h"\n\n') f.write(f"#if TREZOR_FONT_BPP != {self.bpp}\n") f.write(f"#error Wrong TREZOR_FONT_BPP (expected {self.bpp})\n") - f.write("#endif\n") + f.write("#endif\n\n") if self.gen_normal: - f.write(f"#define Font_{self._name_style_size}_HEIGHT {self.size}\n") f.write( f"#define Font_{self._name_style_size}_MAX_HEIGHT {self.font_ymax - self.font_ymin}\n" ) f.write( - f"#define Font_{self._name_style_size}_BASELINE {-self.font_ymin}\n" - ) - f.write( - f"extern const uint8_t* const Font_{self._name_style_size}[{MAX_GLYPH} + 1 - {MIN_GLYPH}];\n" - ) - f.write( - f"extern const uint8_t Font_{self._name_style_size}_glyph_nonprintable[];\n" + f"extern const font_info_t Font_{self._name_style_size}_info;\n" ) if self.gen_upper: - f.write( - f"#define Font_{self._name_style_size}_upper_HEIGHT {self.size}\n" - ) f.write( f"#define Font_{self._name_style_size}_upper_MAX_HEIGHT {self.font_ymax - self.font_ymin}\n" ) f.write( - f"#define Font_{self._name_style_size}_upper_BASELINE {-self.font_ymin}\n" - ) - f.write( - f"extern const uint8_t* const Font_{self._name_style_size}_upper[{MAX_GLYPH} + 1 - {MIN_GLYPH}];\n" - ) - f.write( - f"extern const uint8_t Font_{self._name_style_size}_upper_glyph_nonprintable[];\n" + f"extern const font_info_t Font_{self._name_style_size}_upper_info;\n" ) @@ -489,6 +485,7 @@ if __name__ == "__main__": ).write_files() FaceProcessor("RobotoMono", "Medium", 20).write_files() + # model R FaceProcessor( "PixelOperator", "Regular", @@ -508,12 +505,11 @@ if __name__ == "__main__": gen_upper=True, ).write_files() FaceProcessor("PixelOperatorMono", "Regular", 8, bpp=1, shaveX=1).write_files() - - # For model R FaceProcessor("Unifont", "Regular", 16, bpp=1, shaveX=1, ext="otf").write_files() # NOTE: Unifont Bold does not seem to have czech characters FaceProcessor("Unifont", "Bold", 16, bpp=1, shaveX=1, ext="otf").write_files() + # model mercury FaceProcessor("TTSatoshi", "DemiBold", 42, ext="otf").write_files() FaceProcessor("TTSatoshi", "DemiBold", 21, ext="otf").write_files() FaceProcessor("TTSatoshi", "DemiBold", 18, ext="otf").write_files()