mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-29 09:38:08 +00:00
legacy/oled: remove non-ASCII symbols from font definitions
This commit is contained in:
parent
4462fb522c
commit
81085ed388
@ -1,35 +1,3 @@
|
|||||||
/* 0x00 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x01 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x02 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x03 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x04 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x05 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x06 _ */ (uint8_t *)"\x07\x18\x1c\x0e\x18\x30\x40\x80",
|
|
||||||
/* 0x07 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x08 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x09 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0a _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0b _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0c _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0d _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0e _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0f _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x10 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x11 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x12 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x13 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x14 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x15 _ */ (uint8_t *)"\x07\x44\xee\x7c\x38\x7c\xee\x44",
|
|
||||||
/* 0x16 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x17 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x18 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x19 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1a _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1b _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1c _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1d _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1e _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1f _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x20 */ (uint8_t *)"\x01\x00",
|
/* 0x20 */ (uint8_t *)"\x01\x00",
|
||||||
/* 0x21 ! */ (uint8_t *)"\x02\xfa\xfa",
|
/* 0x21 ! */ (uint8_t *)"\x02\xfa\xfa",
|
||||||
/* 0x22 " */ (uint8_t *)"\x03\xc0\x00\xc0",
|
/* 0x22 " */ (uint8_t *)"\x03\xc0\x00\xc0",
|
||||||
|
@ -1,35 +1,3 @@
|
|||||||
/* 0x00 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x01 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x02 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x03 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x04 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x05 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x06 _ */ (uint8_t *)"\x07\x18\x1c\x0e\x18\x30\x40\x80",
|
|
||||||
/* 0x07 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x08 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x09 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0a _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0b _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0c _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0d _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0e _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x0f _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x10 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x11 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x12 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x13 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x14 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x15 _ */ (uint8_t *)"\x07\x44\xee\x7c\x38\x7c\xee\x44",
|
|
||||||
/* 0x16 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x17 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x18 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x19 _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1a _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1b _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1c _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1d _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1e _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x1f _ */ (uint8_t *)"\x01\x00",
|
|
||||||
/* 0x20 */ (uint8_t *)"\x01\x00",
|
/* 0x20 */ (uint8_t *)"\x01\x00",
|
||||||
/* 0x21 ! */ (uint8_t *)"\x03\x60\xfa\x60",
|
/* 0x21 ! */ (uint8_t *)"\x03\x60\xfa\x60",
|
||||||
/* 0x22 " */ (uint8_t *)"\x05\x00\xe0\x00\xe0\x00",
|
/* 0x22 " */ (uint8_t *)"\x05\x00\xe0\x00\xe0\x00",
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
|
|
||||||
const uint8_t *const font_data[2][128] = {
|
#define FONTS 2
|
||||||
|
|
||||||
|
const uint8_t *const font_data[FONTS][128 - 32] = {
|
||||||
{
|
{
|
||||||
#include "font.inc"
|
#include "font.inc"
|
||||||
},
|
},
|
||||||
@ -9,8 +11,11 @@ const uint8_t *const font_data[2][128] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
int fontCharWidth(int font, uint8_t c) { return font_data[font][c & 0x7f][0]; }
|
int fontCharWidth(uint8_t font, uint8_t c) {
|
||||||
|
return (c < 0x20 || c >= 0x80) ? 0 : font_data[font % FONTS][c - 32][0];
|
||||||
const uint8_t *fontCharData(int font, uint8_t c) {
|
}
|
||||||
return font_data[font][c & 0x7f] + 1;
|
|
||||||
|
const uint8_t *fontCharData(uint8_t font, uint8_t c) {
|
||||||
|
return (c < 0x20 || c >= 0x80) ? (const uint8_t *)""
|
||||||
|
: font_data[font % FONTS][c - 32] + 1;
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
#define FONT_FIXED 1
|
#define FONT_FIXED 1
|
||||||
#define FONT_DOUBLE 0x80
|
#define FONT_DOUBLE 0x80
|
||||||
|
|
||||||
extern const uint8_t *const font_data[2][128];
|
extern const uint8_t *const font_data[2][128 - 32];
|
||||||
|
|
||||||
int fontCharWidth(int font, uint8_t c);
|
int fontCharWidth(uint8_t font, uint8_t c);
|
||||||
const uint8_t *fontCharData(int font, uint8_t c);
|
const uint8_t *fontCharData(uint8_t font, uint8_t c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 9.3 KiB |
@ -23,7 +23,7 @@ def convert(imgfile, outfile):
|
|||||||
img = Img(imgfile)
|
img = Img(imgfile)
|
||||||
cur = ""
|
cur = ""
|
||||||
with open(outfile, "w") as f:
|
with open(outfile, "w") as f:
|
||||||
for i in range(128):
|
for i in range(128 - 32):
|
||||||
x = (i % 16) * 10
|
x = (i % 16) * 10
|
||||||
y = (i // 16) * 10
|
y = (i // 16) * 10
|
||||||
cur = ""
|
cur = ""
|
||||||
@ -32,7 +32,8 @@ def convert(imgfile, outfile):
|
|||||||
x += 1
|
x += 1
|
||||||
cur += "\\x%02x" % int(val, 2)
|
cur += "\\x%02x" % int(val, 2)
|
||||||
cur = "\\x%02x" % (len(cur) // 4) + cur
|
cur = "\\x%02x" % (len(cur) // 4) + cur
|
||||||
ch = chr(i) if i >= 32 and i <= 126 else "_"
|
i += 32
|
||||||
|
ch = "_" if (i == 127) else chr(i)
|
||||||
f.write('\t/* 0x%02x %c */ (uint8_t *)"%s",\n' % (i, ch, cur))
|
f.write('\t/* 0x%02x %c */ (uint8_t *)"%s",\n' % (i, ch, cur))
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ void oledSetBuffer(uint8_t *buf) {
|
|||||||
memcpy(_oledbuffer, buf, sizeof(_oledbuffer));
|
memcpy(_oledbuffer, buf, sizeof(_oledbuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
void oledDrawChar(int x, int y, char c, int font) {
|
void oledDrawChar(int x, int y, char c, uint8_t font) {
|
||||||
if (x >= OLED_WIDTH || y >= OLED_HEIGHT || y <= -FONT_HEIGHT) {
|
if (x >= OLED_WIDTH || y >= OLED_HEIGHT || y <= -FONT_HEIGHT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ static uint8_t convert_char(const char a) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int oledStringWidth(const char *text, int font) {
|
int oledStringWidth(const char *text, uint8_t font) {
|
||||||
if (!text) return 0;
|
if (!text) return 0;
|
||||||
int space = (font & FONT_DOUBLE) ? 2 : 1;
|
int space = (font & FONT_DOUBLE) ? 2 : 1;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
@ -317,7 +317,7 @@ int oledStringWidth(const char *text, int font) {
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
void oledDrawString(int x, int y, const char *text, int font) {
|
void oledDrawString(int x, int y, const char *text, uint8_t font) {
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
int space = (font & FONT_DOUBLE) ? 2 : 1;
|
int space = (font & FONT_DOUBLE) ? 2 : 1;
|
||||||
@ -330,12 +330,12 @@ void oledDrawString(int x, int y, const char *text, int font) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void oledDrawStringCenter(int x, int y, const char *text, int font) {
|
void oledDrawStringCenter(int x, int y, const char *text, uint8_t font) {
|
||||||
x = x - oledStringWidth(text, font) / 2;
|
x = x - oledStringWidth(text, font) / 2;
|
||||||
oledDrawString(x, y, text, font);
|
oledDrawString(x, y, text, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void oledDrawStringRight(int x, int y, const char *text, int font) {
|
void oledDrawStringRight(int x, int y, const char *text, uint8_t font) {
|
||||||
x -= oledStringWidth(text, font);
|
x -= oledStringWidth(text, font);
|
||||||
oledDrawString(x, y, text, font);
|
oledDrawString(x, y, text, font);
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,11 @@ bool oledGetPixel(int x, int y);
|
|||||||
void oledDrawPixel(int x, int y);
|
void oledDrawPixel(int x, int y);
|
||||||
void oledClearPixel(int x, int y);
|
void oledClearPixel(int x, int y);
|
||||||
void oledInvertPixel(int x, int y);
|
void oledInvertPixel(int x, int y);
|
||||||
void oledDrawChar(int x, int y, char c, int zoom);
|
void oledDrawChar(int x, int y, char c, uint8_t font);
|
||||||
int oledStringWidth(const char *text, int font);
|
int oledStringWidth(const char *text, uint8_t font);
|
||||||
|
void oledDrawString(int x, int y, const char *text, uint8_t font);
|
||||||
void oledDrawString(int x, int y, const char *text, int font);
|
void oledDrawStringCenter(int x, int y, const char *text, uint8_t font);
|
||||||
void oledDrawStringCenter(int x, int y, const char *text, int font);
|
void oledDrawStringRight(int x, int y, const char *text, uint8_t font);
|
||||||
void oledDrawStringRight(int x, int y, const char *text, int font);
|
|
||||||
void oledDrawBitmap(int x, int y, const BITMAP *bmp);
|
void oledDrawBitmap(int x, int y, const BITMAP *bmp);
|
||||||
void oledInvert(int x1, int y1, int x2, int y2);
|
void oledInvert(int x1, int y1, int x2, int y2);
|
||||||
void oledBox(int x1, int y1, int x2, int y2, bool set);
|
void oledBox(int x1, int y1, int x2, int y2, bool set);
|
||||||
|
Loading…
Reference in New Issue
Block a user