summaryrefslogtreecommitdiff
path: root/src/displayapp/fonts/neofont.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/fonts/neofont.c')
-rw-r--r--src/displayapp/fonts/neofont.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/displayapp/fonts/neofont.c b/src/displayapp/fonts/neofont.c
index 878ae47..e2e67e7 100644
--- a/src/displayapp/fonts/neofont.c
+++ b/src/displayapp/fonts/neofont.c
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
#include "neofont.h"
#define G( \
@@ -241,12 +242,14 @@ static uint8_t glyphs[][2] = {
X, _, _,
X, X, X ),
+
G( _, _, _,
_, _, _,
X, X, X,
_, _, _,
_, _, _ ),
+
G( _, _, _,
_, _, X,
_, X, _,
@@ -340,16 +343,15 @@ static const uint8_t * neofont0_glyph_bitmap_cb(const lv_font_t * font, uint32_t
return glyphs[(unicode_letter - 'a')+10];
}
- // -/:.,_?!#
- switch (unicode_letter) {
- case ':': return glyphs[38];
- case '?': return glyphs[42];
- case '-': return glyphs[36];
- case '_': return glyphs[41];
- case ' ': return spc;
+ if (unicode_letter == ' ') { return spc; }
+ static const char *symbols = "-/:.,_?!#";
+ if (unicode_letter < 0x80) {
+ char*x = strchr(symbols,((uint8_t)unicode_letter));
+ if (x != NULL) {
+ return glyphs[36+(x-symbols)];
+ }
}
-
- return glyphs[sizeof(glyphs)/sizeof(glyphs[0])-1]; /*Or NULL if not found*/
+ return glyphs[sizeof(glyphs)/sizeof(glyphs[0])-1];
}
const lv_font_t neofont0 = {
@@ -629,7 +631,7 @@ static const uint8_t * neofont2_glyph_bitmap_cb(const lv_font_t * font, uint32_t
}
/*Describe the properties of a font*/
-const lv_font_t neofont2 = {
+lv_font_t neofont2 = {
.get_glyph_dsc = neofont2_glyph_dsc_cb, /*Set a callback to get info about gylphs*/
.get_glyph_bitmap = neofont2_glyph_bitmap_cb, /*Set a callback to get bitmap of a glyp*/
.line_height = 24, /*The real line height where any text fits*/