This commit is contained in:
Bodmer
2017-11-02 01:49:35 +00:00
parent fbdc65a3c7
commit 0562594ae3

View File

@@ -253,6 +253,11 @@ swap_coord(T& a, T& b) { T t = a; a = b; b = t; }
// This is a structure to conveniently hold infomation on the default fonts // This is a structure to conveniently hold infomation on the default fonts
// Stores pointer to font character image address table, width table and height // Stores pointer to font character image address table, width table and height
// Create a null set in case some fonts not used (to prevent crash)
const uint8_t widtbl_null[1] = {0};
PROGMEM const uint8_t chr_null[1] = {0};
PROGMEM const uint8_t* const chrtbl_null[1] = {chr_null};
typedef struct { typedef struct {
const uint8_t *chartbl; const uint8_t *chartbl;
const uint8_t *widthtbl; const uint8_t *widthtbl;
@@ -262,45 +267,45 @@ typedef struct {
// Now fill the structure // Now fill the structure
const PROGMEM fontinfo fontdata [] = { const PROGMEM fontinfo fontdata [] = {
{ 0, 0, 0, 0 }, { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 },
// GLCD font (Font 1) does not have all parameters // GLCD font (Font 1) does not have all parameters
{ 0, 0, 8, 7 }, { (const uint8_t *)chrtbl_null, widtbl_null, 8, 7 },
#ifdef LOAD_FONT2 #ifdef LOAD_FONT2
{ (const uint8_t *)chrtbl_f16, widtbl_f16, chr_hgt_f16, baseline_f16}, { (const uint8_t *)chrtbl_f16, widtbl_f16, chr_hgt_f16, baseline_f16},
#else #else
{ 0, 0, 0, 0 }, { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 },
#endif #endif
// Font 3 current unused // Font 3 current unused
{ 0, 0, 0, 0 }, { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 },
#ifdef LOAD_FONT4 #ifdef LOAD_FONT4
{ (const uint8_t *)chrtbl_f32, widtbl_f32, chr_hgt_f32, baseline_f32}, { (const uint8_t *)chrtbl_f32, widtbl_f32, chr_hgt_f32, baseline_f32},
#else #else
{ 0, 0, 0, 0 }, { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 },
#endif #endif
// Font 5 current unused // Font 5 current unused
{ 0, 0, 0, 0 }, { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 },
#ifdef LOAD_FONT6 #ifdef LOAD_FONT6
{ (const uint8_t *)chrtbl_f64, widtbl_f64, chr_hgt_f64, baseline_f64}, { (const uint8_t *)chrtbl_f64, widtbl_f64, chr_hgt_f64, baseline_f64},
#else #else
{ 0, 0, 0, 0 }, { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 },
#endif #endif
#ifdef LOAD_FONT7 #ifdef LOAD_FONT7
{ (const uint8_t *)chrtbl_f7s, widtbl_f7s, chr_hgt_f7s, baseline_f7s}, { (const uint8_t *)chrtbl_f7s, widtbl_f7s, chr_hgt_f7s, baseline_f7s},
#else #else
{ 0, 0, 0, 0 }, { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 },
#endif #endif
#ifdef LOAD_FONT8 #ifdef LOAD_FONT8
{ (const uint8_t *)chrtbl_f72, widtbl_f72, chr_hgt_f72, baseline_f72} { (const uint8_t *)chrtbl_f72, widtbl_f72, chr_hgt_f72, baseline_f72}
#else #else
{ 0, 0, 0, 0 } { (const uint8_t *)chrtbl_null, widtbl_null, 0, 0 }
#endif #endif
}; };