summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-06-05 04:14:09 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-06-05 04:18:42 (GMT)
commit793d3401a302a97e75429fad75a6777085dde783 (patch)
tree57a43d33cce20b118338a29d82f387cf2a3eebe2
parentce69628cd18baef1c204f50afc0da43dead75f9d (diff)
neofont: non-printable characters have no width
-rw-r--r--src/displayapp/fonts/neofont.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/displayapp/fonts/neofont.c b/src/displayapp/fonts/neofont.c
index b4ec7d5..e53f011 100644
--- a/src/displayapp/fonts/neofont.c
+++ b/src/displayapp/fonts/neofont.c
@@ -737,7 +737,7 @@ static bool neofont0mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_
/* Store the result.
* For example ...
*/
- dsc_out->adv_w = 4; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = (unicode_letter >= 32 ? 4 : 0); /*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 = 0; /*X offset of the bitmap in [pf]*/
@@ -818,7 +818,7 @@ static bool neofont1mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_
// ######..::##::..
// ######..::##::..
- dsc_out->adv_w = 8; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = (unicode_letter >= 32 ? 8 : 0); /*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 = 1; /*X offset of the bitmap in [pf]*/
@@ -975,7 +975,7 @@ lv_font_t neofont1mono = {
static bool neofont15mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
{
- dsc_out->adv_w = 12; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = (unicode_letter >= 32 ? 12 : 0); /*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 = 1; /*X offset of the bitmap in [pf]*/
@@ -1087,7 +1087,7 @@ lv_font_t neofont15mono = {
*/
static bool neofont2mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
{
- dsc_out->adv_w = 16; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = (unicode_letter >= 32 ? 16 : 0); /*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 = 2; /*X offset of the bitmap in [pf]*/
@@ -1187,7 +1187,7 @@ lv_font_t neofont2mono = {
*/
static bool neofont3mono_glyph_dsc_cb(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
{
- dsc_out->adv_w = 32; /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = (unicode_letter >= 32 ? 32 : 0); /*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 = 4; /*X offset of the bitmap in [pf]*/
@@ -1295,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 : (unicode_letter >= 0xF8000 ? 24 : 32); /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = unicode_letter < 32 ? 0 : 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]*/
@@ -1339,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 : (unicode_letter >= 0xF8000 ? 12 : 16); /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = unicode_letter < 32 ? 0 : 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]*/
@@ -1378,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 : (unicode_letter >= 0xF8000 ? 9 : 12); /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = unicode_letter < 32 ? 0 : 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]*/
@@ -1418,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 : (unicode_letter >= 0xF8000 ? 6 : 8); /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = unicode_letter < 32 ? 0 : 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]*/
@@ -1458,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 : (unicode_letter >= 0xF8000 ? 3 : 4); /*Horizontal space required by the glyph in [px]*/
+ dsc_out->adv_w = unicode_letter < 32 ? 0 : 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]*/