diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-10 08:47:51 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-10 08:48:53 (GMT) |
| commit | e30a394ee3b0348941a0fd559ca847d296b29928 (patch) | |
| tree | 7af75d2042780ccf9358030552e6479e8dd819e2 /src | |
| parent | b2be5344958d38fb362bab3691fc104f0f049853 (diff) | |
neofont: don't try to print non-printable characters with code < 0x20
Diffstat (limited to 'src')
| -rw-r--r-- | src/displayapp/fonts/neofont.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/displayapp/fonts/neofont.c b/src/displayapp/fonts/neofont.c index d883ad2..b95d9ae 100644 --- a/src/displayapp/fonts/neofont.c +++ b/src/displayapp/fonts/neofont.c @@ -351,6 +351,8 @@ static bool neofont0mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_ /* Get the bitmap of `unicode_letter` from `font`. */ static const uint8_t * neofont0mono_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) { + if (unicode_letter < 0x20) return NULL; + static const uint8_t spc[] = { 0, 0 }; static uint8_t custom[2]; /* Your code here */ @@ -447,6 +449,7 @@ static bool neofont1mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_ static const uint8_t * neofont1mono_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) { const uint8_t *u = neofont0mono_glyph_bitmap_cb(font, unicode_letter); + if (u == NULL) return NULL; static uint8_t v[(10*10+7)/8]; uint8_t u0 = u[0]; uint8_t u1 = u[1]; @@ -502,6 +505,7 @@ static const uint8_t * neofont1mono_glyph_bitmap_cb(const lv_font_t * font, uint static const uint8_t * neofont1mono_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) { const uint8_t *u = neofont0mono_glyph_bitmap_cb(font, unicode_letter); + if (u == NULL) return NULL; static uint8_t v[8]; uint8_t u0 = u[0]; uint8_t u1 = u[1]; @@ -601,6 +605,7 @@ static bool neofont15mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc static const uint8_t * neofont15mono_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) { const uint8_t *u = neofont0mono_glyph_bitmap_cb(font, unicode_letter); + if (u == NULL) return NULL; static uint8_t v[17]; uint8_t u0 = u[0]; uint8_t u1 = u[1]; @@ -711,6 +716,7 @@ static bool neofont2mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_ static const uint8_t * neofont2mono_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) { const uint8_t *u = neofont0mono_glyph_bitmap_cb(font, unicode_letter); + if (u == NULL) return NULL; static uint8_t v[30]; uint8_t u0 = u[0]; uint8_t u1 = u[1]; @@ -868,6 +874,7 @@ static void mono_bitmap_scale_4( static const uint8_t * neofont3mono_glyph_bitmap_cb(const lv_font_t * font, uint32_t unicode_letter) { const uint8_t *u = neofont1mono_glyph_bitmap_cb(font, unicode_letter); + if (u == NULL) return NULL; static uint8_t v[120 /* = 40 * 24 / 8 */ ]; mono_bitmap_scale_4(u,v,6,10,u,u+(60+7)/8,v,v+120); return v; |
