chore: shrink 5x7 font

This commit is contained in:
TT 2019-10-20 22:16:32 +09:00
parent 1cf19fa50a
commit dcbcfe162c
4 changed files with 898 additions and 898 deletions

1780
Font5x7.c

File diff suppressed because it is too large Load diff

View file

@ -338,12 +338,12 @@ void
ili9341_drawchar_5x7(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg) ili9341_drawchar_5x7(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg)
{ {
uint16_t *buf = spi_buffer; uint16_t *buf = spi_buffer;
uint16_t bits; uint8_t bits;
int c, r; int c, r;
for(c = 0; c < 7; c++) { for(c = 0; c < 7; c++) {
bits = x5x7_bits[(ch * 7) + c]; bits = x5x7_bits[(ch * 7) + c];
for (r = 0; r < 5; r++) { for (r = 0; r < 5; r++) {
*buf++ = (0x8000 & bits) ? fg : bg; *buf++ = (0x80 & bits) ? fg : bg;
bits <<= 1; bits <<= 1;
} }
} }
@ -364,12 +364,12 @@ void
ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size) ili9341_drawchar_size(uint8_t ch, int x, int y, uint16_t fg, uint16_t bg, uint8_t size)
{ {
uint16_t *buf = spi_buffer; uint16_t *buf = spi_buffer;
uint16_t bits; uint8_t bits;
int c, r; int c, r;
for(c = 0; c < 7*size; c++) { for(c = 0; c < 7*size; c++) {
bits = x5x7_bits[(ch * 7) + (c / size)]; bits = x5x7_bits[(ch * 7) + (c / size)];
for (r = 0; r < 5*size; r++) { for (r = 0; r < 5*size; r++) {
*buf++ = (0x8000 & bits) ? fg : bg; *buf++ = (0x80 & bits) ? fg : bg;
if (r % size == (size-1)) { if (r % size == (size-1)) {
bits <<= 1; bits <<= 1;
} }

View file

@ -152,7 +152,7 @@ extern int area_height;
// font // font
extern const uint16_t x5x7_bits []; extern const uint8_t x5x7_bits [];
extern const uint32_t numfont20x24[][24]; extern const uint32_t numfont20x24[][24];
#define S_PI "\034" #define S_PI "\034"

6
plot.c
View file

@ -1056,7 +1056,7 @@ draw_marker(int w, int h, int x, int y, int c, int ch)
int cc = c; int cc = c;
if (j <= 9 && j > 2 && i >= -1 && i <= 3) { if (j <= 9 && j > 2 && i >= -1 && i <= 3) {
uint16_t bits = x5x7_bits[(ch * 7) + (9-j)]; uint16_t bits = x5x7_bits[(ch * 7) + (9-j)];
if (bits & (0x8000>>(i+1))) if (bits & (0x80>>(i+1)))
cc = 0; cc = 0;
} }
if (y0 >= 0 && y0 < h && x0 >= 0 && x0 < w) if (y0 >= 0 && y0 < h && x0 >= 0 && x0 < w)
@ -1355,7 +1355,7 @@ request_to_draw_cells_behind_numeric_input(void)
void void
cell_drawchar_5x7(int w, int h, uint8_t ch, int x, int y, uint16_t fg, int invert) cell_drawchar_5x7(int w, int h, uint8_t ch, int x, int y, uint16_t fg, int invert)
{ {
uint16_t bits; uint8_t bits;
int c, r; int c, r;
if (y <= -7 || y >= h || x <= -5 || x >= w) if (y <= -7 || y >= h || x <= -5 || x >= w)
return; return;
@ -1366,7 +1366,7 @@ cell_drawchar_5x7(int w, int h, uint8_t ch, int x, int y, uint16_t fg, int inver
if (invert) if (invert)
bits = ~bits; bits = ~bits;
for (r = 0; r < 5; r++) { for (r = 0; r < 5; r++) {
if ((x+r) >= 0 && (x+r) < w && (0x8000 & bits)) if ((x+r) >= 0 && (x+r) < w && (0x80 & bits))
spi_buffer[(y+c)*w + (x+r)] = fg; spi_buffer[(y+c)*w + (x+r)] = fg;
bits <<= 1; bits <<= 1;
} }