summaryrefslogtreecommitdiff
path: root/src/displayapp/fonts/neofont.c
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-05-11 17:17:59 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-05-11 17:44:57 (GMT)
commit8a9061b5e731203fd961c2bfd0282017fb6fabdb (patch)
tree91ba06ae54b0ae87604181c0a73fd0dc61f6fe76 /src/displayapp/fonts/neofont.c
parentce0d9a5bfd50b8ef4f57b938b0794f9021606710 (diff)
Multi-width graphical character extension
Diffstat (limited to 'src/displayapp/fonts/neofont.c')
-rw-r--r--src/displayapp/fonts/neofont.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/displayapp/fonts/neofont.c b/src/displayapp/fonts/neofont.c
index de6381b..3131f63 100644
--- a/src/displayapp/fonts/neofont.c
+++ b/src/displayapp/fonts/neofont.c
@@ -763,7 +763,9 @@ static const uint8_t * neofont0mono_glyph_bitmap_cb(const lv_font_t * font, uint
if (unicode_letter == 0xB0) {
// Degree symbol
return glyphs[sizeof(glyphs)/sizeof(glyphs[0])-1];
- } else if ((0xF0000 < unicode_letter) && (unicode_letter < 0xF7FFF)) {
+ }
+
+ if ((0xF0000 <= unicode_letter) && (unicode_letter <= 0xFFFFD)) {
custom[0] = unicode_letter;
custom[1] = (unicode_letter >> 7);
} else {
@@ -1293,7 +1295,7 @@ static bool isthin(uint32_t unicode_letter) {
static bool neofont3_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) {
// if (unicode_letter == '\n') { return false; }
bool thin = isthin(unicode_letter);
- dsc_out->adv_w = thin ? 16 : 32; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = thin ? 16 : (unicode_letter >= 0xF8000 ? 24 : 32); /*Horizontal space required by the glyph in [px]*/
dsc_out->box_h = 40; /*Height of the bitmap in [px]*/
dsc_out->box_w = 24; /*Width of the bitmap in [px]*/
dsc_out->ofs_x = thin ? (4-8) : 4; /*X offset of the bitmap in [pf]*/
@@ -1337,7 +1339,7 @@ static bool neofont2_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t *
{
// if (unicode_letter == '\n') { return false; }
bool thin = isthin(unicode_letter);
- dsc_out->adv_w = thin ? 8 : 16; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = thin ? 8 : (unicode_letter >= 0xF8000 ? 12 : 16); /*Horizontal space required by the glyph in [px]*/
dsc_out->box_h = 20; /*Height of the bitmap in [px]*/
dsc_out->box_w = 12; /*Width of the bitmap in [px]*/
dsc_out->ofs_x = thin ? (2-4) : 2; /*X offset of the bitmap in [pf]*/
@@ -1376,7 +1378,7 @@ lv_font_t neofont2 = {
static bool neofont15_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) {
// if (unicode_letter == '\n') { return false; }
bool thin = isthin(unicode_letter);
- dsc_out->adv_w = thin ? 6 : 12; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = thin ? 6 : (unicode_letter >= 0xF8000 ? 9 : 12); /*Horizontal space required by the glyph in [px]*/
dsc_out->box_h = 15; /*Height of the bitmap in [px]*/
dsc_out->box_w = 9; /*Width of the bitmap in [px]*/
dsc_out->ofs_x = thin ? (1-3) : 1; /*X offset of the bitmap in [pf]*/
@@ -1416,7 +1418,7 @@ lv_font_t neofont15 = {
static bool neofont1_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) {
// if (unicode_letter == '\n') { return false; }
bool thin = isthin(unicode_letter);
- dsc_out->adv_w = thin ? 4 : 8; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = thin ? 4 : (unicode_letter >= 0xF8000 ? 6 : 8); /*Horizontal space required by the glyph in [px]*/
dsc_out->box_h = 10; /*Height of the bitmap in [px]*/
dsc_out->box_w = 6; /*Width of the bitmap in [px]*/
dsc_out->ofs_x = thin ? (1-2) : 1; /*X offset of the bitmap in [pf]*/
@@ -1456,7 +1458,7 @@ lv_font_t neofont1 = {
static bool neofont0_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) {
// if (unicode_letter == '\n') { return false; }
bool thin = isthin(unicode_letter);
- dsc_out->adv_w = thin ? 2 : 4; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = thin ? 2 : (unicode_letter >= 0xF8000 ? 3 : 4); /*Horizontal space required by the glyph in [px]*/
dsc_out->box_h = 5; /*Height of the bitmap in [px]*/
dsc_out->box_w = 3; /*Width of the bitmap in [px]*/
dsc_out->ofs_x = thin ? (0-1) : 0; /*X offset of the bitmap in [pf]*/