mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-25 17:09:44 +00:00
tools: update tools to generate clang-format compatible output
This commit is contained in:
parent
0fbf2261cc
commit
fecc6e53a0
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_cancel[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_confirm[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_done[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_fail[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_info[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_install[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_logo[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_safeplace[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_welcome[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,3 +1,4 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_wipe[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include "font_roboto_bold_20.h"
|
||||
|
||||
// first two bytes are width and height of the glyph
|
||||
// third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// third, fourth and fifth bytes are advance
|
||||
// bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// rest is packed 4-bit glyph data
|
||||
|
||||
// clang-format off
|
||||
|
||||
/* */ static const uint8_t Font_Roboto_Bold_20_glyph_32[] = { 0, 0, 5, 0, 0 };
|
||||
/* ! */ static const uint8_t Font_Roboto_Bold_20_glyph_33[] = { 3, 15, 5, 1, 15, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 0, 0, 0, 159, 111, 252, 159, 96 };
|
||||
/* " */ static const uint8_t Font_Roboto_Bold_20_glyph_34[] = { 5, 5, 7, 1, 15, 255, 15, 255, 240, 255, 253, 15, 223, 176, 252, 250, 15, 160 };
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t * const Font_Roboto_Bold_20[126 + 1 - 32];
|
||||
extern const uint8_t* const Font_Roboto_Bold_20[126 + 1 - 32];
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include "font_roboto_regular_20.h"
|
||||
|
||||
// first two bytes are width and height of the glyph
|
||||
// third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// third, fourth and fifth bytes are advance
|
||||
// bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// rest is packed 4-bit glyph data
|
||||
|
||||
// clang-format off
|
||||
|
||||
/* */ static const uint8_t Font_Roboto_Regular_20_glyph_32[] = { 0, 0, 5, 0, 0 };
|
||||
/* ! */ static const uint8_t Font_Roboto_Regular_20_glyph_33[] = { 2, 15, 5, 2, 15, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 0, 0, 0, 83, 201 };
|
||||
/* " */ static const uint8_t Font_Roboto_Regular_20_glyph_34[] = { 4, 5, 6, 1, 15, 253, 223, 252, 223, 251, 222, 249, 220, 247, 218 };
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t * const Font_Roboto_Regular_20[126 + 1 - 32];
|
||||
extern const uint8_t* const Font_Roboto_Regular_20[126 + 1 - 32];
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include "font_robotomono_regular_20.h"
|
||||
|
||||
// first two bytes are width and height of the glyph
|
||||
// third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// third, fourth and fifth bytes are advance
|
||||
// bearingX and bearingY of the horizontal metrics of the glyph
|
||||
// rest is packed 4-bit glyph data
|
||||
|
||||
// clang-format off
|
||||
|
||||
/* */ static const uint8_t Font_RobotoMono_Regular_20_glyph_32[] = { 0, 0, 12, 0, 0 };
|
||||
/* ! */ static const uint8_t Font_RobotoMono_Regular_20_glyph_33[] = { 3, 15, 12, 4, 15, 31, 177, 251, 31, 177, 251, 31, 177, 251, 31, 177, 251, 31, 177, 251, 0, 0, 0, 1, 2, 253, 30, 192 };
|
||||
/* " */ static const uint8_t Font_RobotoMono_Regular_20_glyph_34[] = { 6, 5, 12, 3, 15, 143, 0, 246, 142, 0, 246, 141, 0, 245, 140, 0, 244, 140, 0, 243 };
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t * const Font_RobotoMono_Regular_20[126 + 1 - 32];
|
||||
extern const uint8_t* const Font_RobotoMono_Regular_20[126 + 1 - 32];
|
||||
|
@ -20,12 +20,14 @@ def process_face(name, style, size):
|
||||
fontname = '%s_%s_%d' % (name.lower(), style.lower(), size)
|
||||
with open('font_%s.h' % fontname, 'wt') as f:
|
||||
f.write('#include <stdint.h>\n\n')
|
||||
f.write('extern const uint8_t * const Font_%s_%s_%d[%d + 1 - %d];\n' % (name, style, size, MAX_GLYPH, MIN_GLYPH))
|
||||
f.write('extern const uint8_t* const Font_%s_%s_%d[%d + 1 - %d];\n' % (name, style, size, MAX_GLYPH, MIN_GLYPH))
|
||||
with open('font_%s.c' % fontname, 'wt') as f:
|
||||
f.write('#include "font_%s.h"\n\n' % fontname)
|
||||
f.write('// first two bytes are width and height of the glyph\n')
|
||||
f.write('// third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph\n')
|
||||
f.write('// third, fourth and fifth bytes are advance\n')
|
||||
f.write('// bearingX and bearingY of the horizontal metrics of the glyph\n')
|
||||
f.write('// rest is packed 4-bit glyph data\n\n')
|
||||
f.write('// clang-format off\n\n')
|
||||
for i in range(MIN_GLYPH, MAX_GLYPH + 1):
|
||||
c = chr(i)
|
||||
face.load_char(c, freetype.FT_LOAD_RENDER | freetype.FT_LOAD_TARGET_NORMAL)
|
||||
|
@ -75,6 +75,7 @@ def process_image(ifn, savefiles=False):
|
||||
f.write(('%s = %s\n' % (bname, data)).encode())
|
||||
print('Written %s ... %d bytes' % (ofn_py, len(data)))
|
||||
with open(ofn_h, 'wt') as f:
|
||||
f.write('// clang-format off\n')
|
||||
f.write('static const uint8_t toi_%s[] = {\n' % bname)
|
||||
f.write(' // magic\n')
|
||||
if im.mode == 'RGB':
|
||||
|
Loading…
Reference in New Issue
Block a user