mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
refactor(core): separate concerns of FONT macros
Introduce a new flag `_NAME` for each font and reduce the usage of `_ENABLE` flag to purely compilation guard. [no changelog]
This commit is contained in:
parent
02533aa27a
commit
59f4dc31cb
@ -37,82 +37,79 @@
|
||||
#ifdef TREZOR_FONT_NORMAL_ENABLE
|
||||
#define FONT_NORMAL (-1)
|
||||
#include TREZOR_FONT_NORMAL_INCLUDE
|
||||
#define FONT_NORMAL_DATA TREZOR_FONT_NORMAL_ENABLE
|
||||
#define FONT_NORMAL_HEIGHT FONT_DEFINE(TREZOR_FONT_NORMAL_ENABLE, _HEIGHT)
|
||||
#define FONT_NORMAL_MAX_HEIGHT \
|
||||
FONT_DEFINE(TREZOR_FONT_NORMAL_ENABLE, _MAX_HEIGHT)
|
||||
#define FONT_NORMAL_BASELINE FONT_DEFINE(TREZOR_FONT_NORMAL_ENABLE, _BASELINE)
|
||||
#define FONT_NORMAL_DATA TREZOR_FONT_NORMAL_NAME
|
||||
#define FONT_NORMAL_HEIGHT FONT_DEFINE(TREZOR_FONT_NORMAL_NAME, _HEIGHT)
|
||||
#define FONT_NORMAL_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_NORMAL_NAME, _MAX_HEIGHT)
|
||||
#define FONT_NORMAL_BASELINE FONT_DEFINE(TREZOR_FONT_NORMAL_NAME, _BASELINE)
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_FONT_BIG_ENABLE
|
||||
#include TREZOR_FONT_BIG_INCLUDE
|
||||
#define FONT_BIG (-4)
|
||||
#define FONT_BIG_DATA TREZOR_FONT_BIG_ENABLE
|
||||
#define FONT_BIG_HEIGHT FONT_DEFINE(TREZOR_FONT_BIG_ENABLE, _HEIGHT)
|
||||
#define FONT_BIG_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_BIG_ENABLE, _MAX_HEIGHT)
|
||||
#define FONT_BIG_BASELINE FONT_DEFINE(TREZOR_FONT_BIG_ENABLE, _BASELINE)
|
||||
#define FONT_BIG_DATA TREZOR_FONT_BIG_NAME
|
||||
#define FONT_BIG_HEIGHT FONT_DEFINE(TREZOR_FONT_BIG_NAME, _HEIGHT)
|
||||
#define FONT_BIG_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_BIG_NAME, _MAX_HEIGHT)
|
||||
#define FONT_BIG_BASELINE FONT_DEFINE(TREZOR_FONT_BIG_NAME, _BASELINE)
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_FONT_DEMIBOLD_ENABLE
|
||||
#include TREZOR_FONT_DEMIBOLD_INCLUDE
|
||||
#define FONT_DEMIBOLD (-5)
|
||||
#define FONT_DEMIBOLD_DATA TREZOR_FONT_DEMIBOLD_ENABLE
|
||||
#define FONT_DEMIBOLD_HEIGHT FONT_DEFINE(TREZOR_FONT_DEMIBOLD_ENABLE, _HEIGHT)
|
||||
#define FONT_DEMIBOLD_DATA TREZOR_FONT_DEMIBOLD_NAME
|
||||
#define FONT_DEMIBOLD_HEIGHT FONT_DEFINE(TREZOR_FONT_DEMIBOLD_NAME, _HEIGHT)
|
||||
#define FONT_DEMIBOLD_MAX_HEIGHT \
|
||||
FONT_DEFINE(TREZOR_FONT_DEMIBOLD_ENABLE, _MAX_HEIGHT)
|
||||
#define FONT_DEMIBOLD_BASELINE \
|
||||
FONT_DEFINE(TREZOR_FONT_DEMIBOLD_ENABLE, _BASELINE)
|
||||
FONT_DEFINE(TREZOR_FONT_DEMIBOLD_NAME, _MAX_HEIGHT)
|
||||
#define FONT_DEMIBOLD_BASELINE FONT_DEFINE(TREZOR_FONT_DEMIBOLD_NAME, _BASELINE)
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_FONT_SUB_ENABLE
|
||||
#include TREZOR_FONT_SUB_INCLUDE
|
||||
#define FONT_SUB (-8)
|
||||
#define FONT_SUB_DATA TREZOR_FONT_SUB_ENABLE
|
||||
#define FONT_SUB_HEIGHT FONT_DEFINE(TREZOR_FONT_SUB_ENABLE, _HEIGHT)
|
||||
#define FONT_SUB_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_SUB_ENABLE, _MAX_HEIGHT)
|
||||
#define FONT_SUB_BASELINE FONT_DEFINE(TREZOR_FONT_SUB_ENABLE, _BASELINE)
|
||||
#define FONT_SUB_DATA TREZOR_FONT_SUB_NAME
|
||||
#define FONT_SUB_HEIGHT FONT_DEFINE(TREZOR_FONT_SUB_NAME, _HEIGHT)
|
||||
#define FONT_SUB_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_SUB_NAME, _MAX_HEIGHT)
|
||||
#define FONT_SUB_BASELINE FONT_DEFINE(TREZOR_FONT_SUB_NAME, _BASELINE)
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_FONT_MONO_ENABLE
|
||||
#include TREZOR_FONT_MONO_INCLUDE
|
||||
#define FONT_MONO (-3)
|
||||
#define FONT_MONO_DATA TREZOR_FONT_MONO_ENABLE
|
||||
#define FONT_MONO_HEIGHT FONT_DEFINE(TREZOR_FONT_MONO_ENABLE, _HEIGHT)
|
||||
#define FONT_MONO_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_MONO_ENABLE, _MAX_HEIGHT)
|
||||
#define FONT_MONO_BASELINE FONT_DEFINE(TREZOR_FONT_MONO_ENABLE, _BASELINE)
|
||||
#define FONT_MONO_DATA TREZOR_FONT_MONO_NAME
|
||||
#define FONT_MONO_HEIGHT FONT_DEFINE(TREZOR_FONT_MONO_NAME, _HEIGHT)
|
||||
#define FONT_MONO_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_MONO_NAME, _MAX_HEIGHT)
|
||||
#define FONT_MONO_BASELINE FONT_DEFINE(TREZOR_FONT_MONO_NAME, _BASELINE)
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_FONT_BOLD_ENABLE
|
||||
#include TREZOR_FONT_BOLD_INCLUDE
|
||||
#define FONT_BOLD (-2)
|
||||
#define FONT_BOLD_DATA TREZOR_FONT_BOLD_ENABLE
|
||||
#define FONT_BOLD_HEIGHT FONT_DEFINE(TREZOR_FONT_BOLD_ENABLE, _HEIGHT)
|
||||
#define FONT_BOLD_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_BOLD_ENABLE, _MAX_HEIGHT)
|
||||
#define FONT_BOLD_BASELINE FONT_DEFINE(TREZOR_FONT_BOLD_ENABLE, _BASELINE)
|
||||
#define FONT_BOLD_DATA TREZOR_FONT_BOLD_NAME
|
||||
#define FONT_BOLD_HEIGHT FONT_DEFINE(TREZOR_FONT_BOLD_NAME, _HEIGHT)
|
||||
#define FONT_BOLD_MAX_HEIGHT FONT_DEFINE(TREZOR_FONT_BOLD_NAME, _MAX_HEIGHT)
|
||||
#define FONT_BOLD_BASELINE FONT_DEFINE(TREZOR_FONT_BOLD_NAME, _BASELINE)
|
||||
#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_DATA TREZOR_FONT_NORMAL_UPPER_NAME
|
||||
#define FONT_NORMAL_UPPER_HEIGHT \
|
||||
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_ENABLE, _HEIGHT)
|
||||
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_NAME, _HEIGHT)
|
||||
#define FONT_NORMAL_UPPER_MAX_HEIGHT \
|
||||
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_ENABLE, _MAX_HEIGHT)
|
||||
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_NAME, _MAX_HEIGHT)
|
||||
#define FONT_NORMAL_UPPER_BASELINE \
|
||||
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_ENABLE, _BASELINE)
|
||||
FONT_DEFINE(TREZOR_FONT_NORMAL_UPPER_NAME, _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_DATA TREZOR_FONT_BOLD_UPPER_NAME
|
||||
#define FONT_BOLD_UPPER_HEIGHT FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_NAME, _HEIGHT)
|
||||
#define FONT_BOLD_UPPER_MAX_HEIGHT \
|
||||
FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_ENABLE, _MAX_HEIGHT)
|
||||
FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_NAME, _MAX_HEIGHT)
|
||||
#define FONT_BOLD_UPPER_BASELINE \
|
||||
FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_ENABLE, _BASELINE)
|
||||
FONT_DEFINE(TREZOR_FONT_BOLD_UPPER_NAME, _BASELINE)
|
||||
#endif
|
||||
|
||||
#define MAX_FONT_H(A, B) ((A) > (B) ? (A) : (B))
|
||||
|
@ -16,7 +16,8 @@ def add_font(
|
||||
if font is not None:
|
||||
font_filename = font.replace("_upper", "").lower()
|
||||
defines += [
|
||||
"TREZOR_FONT_" + font_name + "_ENABLE=" + font,
|
||||
"TREZOR_FONT_" + font_name + "_ENABLE",
|
||||
"TREZOR_FONT_" + font_name + "_NAME=" + font,
|
||||
"TREZOR_FONT_" + font_name + '_INCLUDE=\\"' + font_filename + '.h\\"',
|
||||
]
|
||||
sourcefile = "embed/lib/fonts/" + font_filename + ".c"
|
||||
|
Loading…
Reference in New Issue
Block a user