From 97f95f44c0f60c7ac6d8a89490c57c6a47f4e596 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 28 Apr 2017 15:54:54 +0200 Subject: [PATCH] bootloader: disable usage of mono/normal fonts --- Makefile.bootloader | 6 ++++-- micropython/bootloader/main.c | 2 +- micropython/extmod/modtrezorui/display.c | 12 ++++++++++++ micropython/extmod/modtrezorui/display.h | 6 ++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Makefile.bootloader b/Makefile.bootloader index 49b8d7ec..0a1af41b 100644 --- a/Makefile.bootloader +++ b/Makefile.bootloader @@ -76,10 +76,12 @@ OBJ_BOOTLOADER += $(addprefix $(BUILD_FW)/, \ extmod/modtrezorui/inflate.o \ extmod/modtrezorui/font_bitmap.o \ extmod/modtrezorui/font_roboto_bold_20.o \ - extmod/modtrezorui/font_roboto_regular_20.o \ - extmod/modtrezorui/font_robotomono_regular_20.o \ ) +CFLAGS_MOD += \ + -DTREZOR_FONT_MONO_DISABLE=1 \ + -DTREZOR_FONT_NORMAL_DISABLE=1 \ + OBJ_TREZORHAL += $(addprefix $(BUILD_FW)/, \ trezorhal/common.o \ trezorhal/image.o \ diff --git a/micropython/bootloader/main.c b/micropython/bootloader/main.c index 4f415058..139786b1 100644 --- a/micropython/bootloader/main.c +++ b/micropython/bootloader/main.c @@ -42,7 +42,7 @@ void display_vendor(const uint8_t *vimg, const char *vstr, uint32_t vstr_len, ui ver_str[3] += (fw_version >> 8) & 0xFF; ver_str[5] += (fw_version >> 16) & 0xFF; ver_str[7] += (fw_version >> 24) & 0xFF; - display_text_center(120, 215, ver_str, -1, FONT_NORMAL, 0x7BEF, 0x0000); + display_text_center(120, 215, ver_str, -1, FONT_BOLD, 0x7BEF, 0x0000); display_refresh(); } diff --git a/micropython/extmod/modtrezorui/display.c b/micropython/extmod/modtrezorui/display.c index 16dc8ce8..a5377c36 100644 --- a/micropython/extmod/modtrezorui/display.c +++ b/micropython/extmod/modtrezorui/display.c @@ -7,9 +7,15 @@ #include "inflate.h" #include "font_bitmap.h" +#ifndef TREZOR_FONT_MONO_DISABLE #include "font_robotomono_regular_20.h" +#endif +#ifndef TREZOR_FONT_NORMAL_DISABLE #include "font_roboto_regular_20.h" +#endif +#ifndef TREZOR_FONT_BOLD_DISABLE #include "font_roboto_bold_20.h" +#endif #include "trezor-qrenc/qr_encode.h" @@ -218,12 +224,18 @@ static const uint8_t *get_glyph(uint8_t font, uint8_t c) return 0; } switch (font) { +#ifndef TREZOR_FONT_MONO_DISABLE case FONT_MONO: return Font_RobotoMono_Regular_20[c - ' ']; +#endif +#ifndef TREZOR_FONT_NORMAL_DISABLE case FONT_NORMAL: return Font_Roboto_Regular_20[c - ' ']; +#endif +#ifndef TREZOR_FONT_BOLD_DISABLE case FONT_BOLD: return Font_Roboto_Bold_20[c - ' ']; +#endif } return 0; } diff --git a/micropython/extmod/modtrezorui/display.h b/micropython/extmod/modtrezorui/display.h index 444463be..dde0fcaf 100644 --- a/micropython/extmod/modtrezorui/display.h +++ b/micropython/extmod/modtrezorui/display.h @@ -13,9 +13,15 @@ #define DISPLAY_RESX 240 #define DISPLAY_RESY 240 +#ifndef TREZOR_FONT_MONO_DISABLE #define FONT_MONO 0 +#endif +#ifndef TREZOR_FONT_NORMAL_DISABLE #define FONT_NORMAL 1 +#endif +#ifndef TREZOR_FONT_BOLD_DISABLE #define FONT_BOLD 2 +#endif #define LOADER_ICON_SIZE 64