Variable size font

pull/4/head
erikkaashoek 6 years ago
parent 61cc1dc843
commit 303405afd7

File diff suppressed because it is too large Load Diff

@ -610,9 +610,10 @@ void ili9341_drawstring_7x13(const char *str, int x, int y)
{ {
while (*str) { while (*str) {
uint8_t ch = *str++; uint8_t ch = *str++;
const uint16_t *char_buf = &x7x13b_bits[(ch * 13)]; // All chars start at row 2 const uint8_t *char_buf = bFONT_GET_DATA(ch);
blit16BitWidthBitmap(x, y, 7, 13, char_buf); // Only 'Q' has 12 rows, 'g' requires 13 rows uint16_t w = bFONT_GET_WIDTH(ch);
x += 7; blit8BitWidthBitmap(x, y, w, bFONT_GET_HEIGHT, char_buf);
x += w;
} }
} }

@ -312,12 +312,19 @@ extern int16_t area_height;
// font // font
extern const uint8_t x5x7_bits []; extern const uint8_t x5x7_bits [];
extern const uint16_t x7x13b_bits []; extern const uint8_t x7x11b_bits [];
#define FONT_GET_DATA(ch) (&x5x7_bits[ch*7]) #define FONT_GET_DATA(ch) (&x5x7_bits[ch*7])
#define FONT_GET_WIDTH(ch) (8-(x5x7_bits[ch*7]&7)) #define FONT_GET_WIDTH(ch) (8-(x5x7_bits[ch*7]&7))
#define FONT_MAX_WIDTH 7 #define FONT_MAX_WIDTH 7
#define FONT_GET_HEIGHT 7 #define FONT_GET_HEIGHT 7
#define bFONT_GET_DATA(ch) (&x7x11b_bits[ch*11])
#define bFONT_GET_WIDTH(ch) (8-(x7x11b_bits[ch*11]&7))
#define bFONT_MAX_WIDTH 8
#define bFONT_WIDTH 7
#define bFONT_GET_HEIGHT 11
#define bFONT_STR_HEIGHT 11
extern const uint16_t numfont16x22[]; extern const uint16_t numfont16x22[];
#define NUM_FONT_GET_DATA(ch) (&numfont16x22[ch*22]) #define NUM_FONT_GET_DATA(ch) (&numfont16x22[ch*22])
#define NUM_FONT_GET_WIDTH 16 #define NUM_FONT_GET_WIDTH 16

@ -1833,21 +1833,22 @@ cell_drawstring_size(char *str, int x, int y, int size)
} }
static int static int
cell_drawchar_7x13(uint8_t ch, int x, int y) cell_draw_bchar(uint8_t ch, int x, int y)
{ {
uint16_t bits; uint8_t bits;
int c, r, ch_size; int c, r, ch_size;
ch_size = 7; const uint8_t *char_buf = bFONT_GET_DATA(ch);
ch_size = bFONT_GET_WIDTH(ch);
// if (y <= -FONT_GET_HEIGHT || y >= CELLHEIGHT || x <= -ch_size || x >= CELLWIDTH) // if (y <= -FONT_GET_HEIGHT || y >= CELLHEIGHT || x <= -ch_size || x >= CELLWIDTH)
// return ch_size; // return ch_size;
if (x <= -ch_size) if (x <= -ch_size)
return ch_size; return ch_size;
for (c = 0; c < 13; c++) { for (c = 0; c < bFONT_GET_HEIGHT; c++) {
bits = x7x13b_bits[(ch * 13) + c]; bits = *char_buf++;
if ((y + c) < 0 || (y + c) >= CELLHEIGHT) if ((y + c) < 0 || (y + c) >= CELLHEIGHT)
continue; continue;
for (r = 0; r < ch_size; r++) { for (r = 0; r < ch_size; r++) {
if ((x+r) >= 0 && (x+r) < CELLWIDTH && (0x8000 & bits)) if ((x+r) >= 0 && (x+r) < CELLWIDTH && (0x80 & bits))
cell_buffer[(y+c)*CELLWIDTH + (x+r)] = foreground_color; cell_buffer[(y+c)*CELLWIDTH + (x+r)] = foreground_color;
bits <<= 1; bits <<= 1;
} }
@ -1859,12 +1860,12 @@ cell_drawchar_7x13(uint8_t ch, int x, int y)
void void
cell_drawstring_7x13(char *str, int x, int y) cell_drawstring_7x13(char *str, int x, int y)
{ {
if (y <= -13 || y >= CELLHEIGHT) if (y <= -bFONT_GET_HEIGHT || y >= CELLHEIGHT)
return; return;
while (*str) { while (*str) {
if (x >= CELLWIDTH) if (x >= CELLWIDTH)
return; return;
x += cell_drawchar_7x13(*str++, x, y); x += cell_draw_bchar(*str++, x, y);
} }
} }
@ -2001,7 +2002,7 @@ static void cell_draw_marker_info(int x0, int y0)
int t; int t;
int ref_marker = 0; int ref_marker = 0;
int j = 0; int j = 0;
int count = 0; // int count = 0;
int active=0; int active=0;
for (int i = 0; i < MARKER_COUNT; i++) { for (int i = 0; i < MARKER_COUNT; i++) {
if (markers[i].enabled) { if (markers[i].enabled) {

@ -290,8 +290,8 @@ void set_10mhz(int f)
} }
int SI4432_frequency_changed = false; int SI4432_frequency_changed = false;
static int old_freq_band[2] = {-1,-1}; //static int old_freq_band[2] = {-1,-1};
static int written[2]= {0,0}; //static int written[2]= {0,0};
void SI4432_Set_Frequency ( long Freq ) { void SI4432_Set_Frequency ( long Freq ) {
int hbsel; int hbsel;

Loading…
Cancel
Save

Powered by TurnKey Linux.