summaryrefslogtreecommitdiff
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
parentce0d9a5bfd50b8ef4f57b938b0794f9021606710 (diff)
Multi-width graphical character extension
-rw-r--r--src/displayapp/fonts/neofont.c14
-rw-r--r--src/displayapp/screens/Symbols.h144
2 files changed, 97 insertions, 61 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]*/
diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h
index 86b4b8b..83ccee6 100644
--- a/src/displayapp/screens/Symbols.h
+++ b/src/displayapp/screens/Symbols.h
@@ -25,6 +25,24 @@
0 \
}
+#define H( \
+ A,B,C,a,b,c, \
+ D,E,F,d,e,f, \
+ G,H,I,g,h,i, \
+ J,K,L,j,k,l, \
+ M,N,O,m,n,o \
+) { \
+ ((char)( 0xF3 )), \
+ ((char)( 0xB8 | (I<<2) | (J<<1) | K )), \
+ ((char)( 0x80 | (L<<5) | (M<<4) | (N<<3) | (O<<2) | (A<<1) | B )), \
+ ((char)( 0x80 | (C<<5) | (D<<4) | (E<<3) | (F<<2) | (G<<1) | H )), \
+ ((char)( 0xF3 )), \
+ ((char)( 0xB0 | (i<<2) | (j<<1) | k )), \
+ ((char)( 0x80 | (l<<5) | (m<<4) | (n<<3) | (o<<2) | (a<<1) | b )), \
+ ((char)( 0x80 | (c<<5) | (d<<4) | (e<<3) | (f<<2) | (g<<1) | h )), \
+ 0 \
+}
+
#define X 1
#define _ 0
@@ -35,46 +53,46 @@ namespace Pinetime {
static constexpr const char* none = "";
static constexpr const char batteryFull[] =
// "\xEF\x89\x80";
- G(_, X, _,
- X, X, X,
- X, X, X,
- X, X, X,
- X, X, X);
+ H(X, X, X, X, X, _,
+ X, X, X, X, X, X,
+ X, X, X, X, X, X,
+ X, X, X, X, X, _,
+ _, _, _, _, _, _);
static constexpr const char batteryEmpty[] =
// "\xEF\x89\x84";
- G(_, X, _,
- X, _, X,
- X, _, X,
- X, _, X, // l is ignored!
- X, X, X);
+ H(X, X, X, X, X, _,
+ X, _, _, _, _, X,
+ X, _, _, _, _, X,
+ X, X, X, X, X, _,
+ _, _, _, _, _, _);
static constexpr const char batteryThreeQuarter[] =
// Was: "\xEF\x89\x81";
- G(_, X, _,
- X, X, X,
- X, _, X,
- X, X, X,
- X, X, X);
+ H(X, X, X, X, X, _,
+ X, X, X, X, _, X,
+ X, X, X, X, _, X,
+ X, X, X, X, X, _,
+ _, _, _, _, _, _);
static constexpr const char batteryHalf[] =
// Was: "\xEF\x89\x82";
- G(_, X, _,
- X, _, X,
- X, X, X,
- X, X, X,
- X, X, X);
+ H(X, X, X, X, X, _,
+ X, X, X, _, _, X,
+ X, X, X, _, _, X,
+ X, X, X, X, X, _,
+ _, _, _, _, _, _);
static constexpr const char batteryOneQuarter[] =
// Was: "\xEF\x89\x83";
- G(_, X, _,
- X, _, X,
- X, _, X,
- X, X, X,
- X, X, X);
+ H(X, X, X, X, X, _,
+ X, X, _, _, _, X,
+ X, X, _, _, _, X,
+ X, X, X, X, X, _,
+ _, _, _, _, _, _);
static constexpr const char heartBeat[] =
// Was: "\xEF\x88\x9E"
- G(_, _, _,
- X, _, X,
- X, X, X,
- _, X, _,
- _, _, _);
+ H(_, X, _, X, _, _,
+ X, X, X, X, X, _,
+ X, X, X, X, X, _,
+ _, X, X, X, _, _,
+ _, _, X, _, _, _);
static constexpr const char bluetoothFull[] =
// "\xEF\x8A\x93";
G(X, X, _,
@@ -105,11 +123,11 @@ namespace Pinetime {
X, _, _);
static constexpr const char music[] =
// "\xEF\x80\x81";
- G(_, X, X,
- _, _, X,
- _, X, X,
- X, X, X,
- _, X, _);
+ H(_, X, X, X, X, X,
+ _, X, _, _, _, X,
+ _, X, _, _, _, X,
+ X, X, _, _, X, X,
+ X, X, _, _, X, X);
static constexpr const char* clock = "\xEF\x80\x97";
static constexpr const char* info = "\xEF\x84\xA9";
static constexpr const char* list = "\xEF\x80\xBA";
@@ -164,18 +182,33 @@ namespace Pinetime {
X, _, _);
static constexpr const char hourGlass[] =
// "\xEF\x89\x92";
- G(X, X, X,
- X, X, X,
- _, X, _,
- X, X, X,
- X, X, X);
+ H(_, X, X, X, X, _,
+ _, X, _, _, X, _,
+ _, _, X, X, _, _,
+ _, X, X, X, X, _,
+ _, X, X, X, X, _);
+ // G(X, X, X,
+ // X, _, X,
+ // _, X, _,
+ // X, X, X,
+ // X, X, X);
static constexpr const char lapsFlag[] =
// "\xEF\x80\xA4";
- G(_, X, _,
- X, _, X,
- X, _, _,
- X, _, X,
- _, X, _);
+ H(X, X, X, _, _, X,
+ X, X, X, X, X, X,
+ X, X, X, X, X, X,
+ X, _, _, X, X, _,
+ X, _, _, _, _, _);
+ // H(_, X, X, X, _, _,
+ // K, _, X, _, X, _,
+ // X, _, X, _, X, _,
+ // X, _, _, _, X, _,
+ // _, X, X, X, _, _);
+ // G(_, X, _,
+ // X, _, X,
+ // X, _, _,
+ // X, _, X,
+ // _, X, _);
static constexpr const char* drum = "\xEF\x95\xA9";
static constexpr const char* chartLine = "\xEF\x88\x81";
static constexpr const char* eye = "\xEF\x81\xAE";
@@ -184,11 +217,11 @@ namespace Pinetime {
// lv_font_sys_48.c
static constexpr const char settings[] =
// "\xEE\xA4\x82"; // e902
- G(_, X, X,
- X, _, _,
- _, X, X,
- _, X, _,
- _, X, _);
+ H(X, X, X, _, _, _,
+ _, _, X, X, X, X,
+ _, _, X, X, X, X,
+ X, X, X, _, _, _,
+ _, _, _, _, _, _);
static constexpr const char brightnessHigh[] =
// "\xEE\xA4\x84"; // e904
@@ -229,16 +262,17 @@ namespace Pinetime {
static constexpr const char highlight[] =
// "\xEE\xA4\x87"; // e907
- G(X, X, X,
- X, X, X,
- _, X, _,
- _, X, _,
- _, X, _);
+ H(_, _, _, X, X, _,
+ X, X, X, _, _, X,
+ X, X, X, X, _, X,
+ X, X, X, _, _, X,
+ _, _, _, X, X, _);
}
}
}
}
+#undef H
#undef G
#undef X
#undef _