Skip to content

Commit 204ad7c

Browse files
Riksu9000JF002
authored andcommitted
Update font readme, update fonts, add missing files
1 parent 4c92ed4 commit 204ad7c

7 files changed

Lines changed: 248 additions & 238 deletions

File tree

36 KB
Binary file not shown.
199 KB
Binary file not shown.

src/displayapp/fonts/README.md

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,12 @@
77
## Generate the fonts:
88

99
* Open the [LVGL font converter](https://lvgl.io/tools/fontconverter)
10-
* Name : jetbrains_mono_bold_20
11-
* Size : 20
12-
* Bpp : 1 bit-per-pixel
13-
* Do not enable font compression and horizontal subpixel hinting
14-
* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20-0x7f, 0x410-0x44f`
15-
* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following
16-
range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072`
17-
* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts`
18-
* Add the font .c file path to src/CMakeLists.txt
19-
* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h
10+
* Enter the settings for the font that you wish to convert
11+
* Click on Convert, download the file and place it in `src/DisplayApp/Fonts`
2012

21-
Add new symbols:
13+
### How to add new symbols:
2214

23-
* Browse the [cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and find your new symbols
15+
* Browse [this cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and pick symbols
2416
* For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *Range* list (Remember to keep this
2517
readme updated with newest range list)
2618
* Convert this hex value into a UTF-8 code
@@ -31,7 +23,18 @@ Add new symbols:
3123
static constexpr const char* newSymbol = "\xEF\x86\x85";
3224
```
3325

34-
Then fix an error that happens during the font conversion (the inner dot of the 'zero' symbol sticks to the boundary): edit `src/displayapp/fonts/jetbrains_mono_bold_20.c` and replace:
26+
### Small font
27+
28+
* Name: jetbrains_mono_bold_20
29+
* Size: 20
30+
* Bpp: 1 bit-per-pixel
31+
* Do not enable font compression or horizontal subpixel rendering
32+
* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20-0x7e, 0x410-0x44f`
33+
* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following
34+
range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015, 0xf072`
35+
* Fix an error in the font conversion.
36+
37+
Replace the following:
3538

3639
/* U+0030 "0" */
3740
0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f,
@@ -47,25 +50,34 @@ with
4750

4851
(there are two changes: 7f -> 7e and f7 -> b7)
4952

50-
## Simple method to generate a font
5153

52-
If you want to generate a basic font containing only numbers and letters, you can use the above settings but instead of specifying a range, simply list the characters you need in the Symbols field and leave the range blank. This is the approach used for the PineTimeStyle watchface.
53-
This works well for fonts which will only be used to display numbers, but will fail if you try to add a colon or other punctuation.
54+
### Medium font
55+
56+
* Name: jetbrains_mono_42
57+
* Size: 42
58+
* Bpp: 1 bit-per-pixel
59+
* Do not enable font compression or horizontal subpixel rendering
60+
* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x25, 0x30-0x3a`
61+
62+
### Large font
63+
* Name: jetbrains_mono_76
64+
* Size: 76
65+
* Bpp: 1 bit-per-pixel
66+
* Do not enable font compression or horizontal subpixel rendering
67+
* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x25, 0x2D, 0x2F, 0x30-0x3a`
68+
69+
### PineTimeStyle font
5470

55-
* Open the [LVGL font converter](https://lvgl.io/tools/fontconverter)
5671
* Name : open_sans_light
5772
* Size : 150
5873
* Bpp : 1 bit-per-pixel
59-
* Do not enable font compression and horizontal subpixel hinting
74+
* Do not enable font compression or horizontal subpixel rendering
6075
* Load the file `open_sans_light.tff` (use the file in this repo to ensure the version matches) and specify the following symbols : `0123456789`
61-
* Click on Convert, and download the file `open_sans_light.c` and copy it in `src/DisplayApp/Fonts`
62-
* Add the font .c file path to src/CMakeLists.txt (search for jetbrains to find the appropriate location/format)
63-
* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h (as above)
6476

6577
#### Navigation font
6678

6779
To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app)
68-
this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and creat a ttf file the
80+
this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and create a ttf file the
6981
project for the site is *lv_font_navi_80.json* you can import it to add or remove icons
7082

7183
You can also use the online LVGL tool to create the .c
@@ -74,5 +86,3 @@ ttf file : navigation.ttf name : lv_font_navi_80 size : 80px Bpp : 2 bit-per-pix
7486

7587
$lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o
7688
lv_font_navi_80.c
77-
78-
#### I use the method above to create the other ttf

src/displayapp/fonts/jetbrains_mono_42.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,26 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
6161
0xff, 0xf8,
6262

6363
/* U+0032 "2" */
64-
0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfe, 0x1f,
65-
0x7, 0xc7, 0xc0, 0x3c, 0xf0, 0x7, 0xbc, 0x0,
64+
0x3, 0xf8, 0x1, 0xff, 0xc0, 0xff, 0xfc, 0x1f,
65+
0x7, 0xc7, 0xc0, 0x7c, 0xf0, 0x7, 0xbc, 0x0,
6666
0x7f, 0x80, 0xf, 0xf0, 0x1, 0xe0, 0x0, 0x3c,
6767
0x0, 0x7, 0x80, 0x1, 0xf0, 0x0, 0x3c, 0x0,
6868
0xf, 0x80, 0x1, 0xe0, 0x0, 0x7c, 0x0, 0x1f,
69-
0x0, 0x7, 0xc0, 0x1, 0xf0, 0x0, 0x7e, 0x0,
70-
0xf, 0x80, 0x3, 0xe0, 0x0, 0xf8, 0x0, 0x3e,
69+
0x0, 0x7, 0xc0, 0x1, 0xf0, 0x0, 0x7c, 0x0,
70+
0x1f, 0x0, 0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3e,
7171
0x0, 0xf, 0x80, 0x3, 0xe0, 0x0, 0xf8, 0x0,
7272
0x3e, 0x0, 0x7, 0xff, 0xfe, 0xff, 0xff, 0xdf,
7373
0xff, 0xf8,
7474

7575
/* U+0033 "3" */
7676
0x7f, 0xff, 0x8f, 0xff, 0xf1, 0xff, 0xfe, 0x0,
7777
0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3c, 0x0, 0xf,
78-
0x0, 0x3, 0xc0, 0x0, 0xf0, 0x0, 0x3e, 0x0,
79-
0x7, 0x80, 0x1, 0xfe, 0x0, 0x3f, 0xf0, 0x7,
80-
0xff, 0x0, 0x3, 0xf0, 0x0, 0x1e, 0x0, 0x3,
81-
0xc0, 0x0, 0x3c, 0x0, 0x7, 0x80, 0x0, 0xf0,
78+
0x0, 0x3, 0xe0, 0x0, 0x78, 0x0, 0x1e, 0x0,
79+
0x7, 0x80, 0x1, 0xfc, 0x0, 0x3f, 0xe0, 0x7,
80+
0xfe, 0x0, 0xff, 0xe0, 0x0, 0x3e, 0x0, 0x3,
81+
0xc0, 0x0, 0x7c, 0x0, 0x7, 0x80, 0x0, 0xf0,
8282
0x0, 0x1e, 0x0, 0x3, 0xfc, 0x0, 0x7f, 0x80,
83-
0xf, 0xf0, 0x1, 0xef, 0x0, 0x79, 0xf0, 0x1f,
83+
0xf, 0xf0, 0x1, 0xff, 0x0, 0x79, 0xe0, 0x1f,
8484
0x1f, 0x7, 0xc3, 0xff, 0xf0, 0x1f, 0xfc, 0x0,
8585
0xfe, 0x0,
8686

@@ -245,7 +245,7 @@ lv_font_t jetbrains_mono_42 = {
245245
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
246246
.subpx = LV_FONT_SUBPX_NONE,
247247
#endif
248-
#if LV_VERSION_CHECK(7, 4, 0)
248+
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
249249
.underline_position = -7,
250250
.underline_thickness = 2,
251251
#endif

src/displayapp/fonts/jetbrains_mono_76.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -175,30 +175,30 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
175175
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
176176

177177
/* U+0032 "2" */
178-
0x0, 0x7, 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xe0,
178+
0x0, 0xf, 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xe0,
179179
0x0, 0x1f, 0xff, 0xfe, 0x0, 0xf, 0xff, 0xff,
180-
0xe0, 0x7, 0xff, 0xff, 0xfc, 0x3, 0xff, 0xff,
181-
0xff, 0x81, 0xff, 0xc0, 0x7f, 0xe0, 0xff, 0x80,
180+
0xc0, 0x7, 0xff, 0xff, 0xf8, 0x3, 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0xf, 0xf8, 0x0, 0x0, 0x7, 0xfc,
197197
0x0, 0x0, 0x3, 0xfe, 0x0, 0x0, 0x1, 0xff,
198198
0x0, 0x0, 0x0, 0xff, 0x80, 0x0, 0x0, 0x7f,
199199
0xc0, 0x0, 0x0, 0x3f, 0xe0, 0x0, 0x0, 0x1f,
200-
0xf8, 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, 0x7,
201-
0xfe, 0x0, 0x0, 0x1, 0xff, 0x0, 0x0, 0x0,
200+
0xf0, 0x0, 0x0, 0xf, 0xf8, 0x0, 0x0, 0x7,
201+
0xfc, 0x0, 0x0, 0x3, 0xfe, 0x0, 0x0, 0x0,
202202
0xff, 0x80, 0x0, 0x0, 0x7f, 0xc0, 0x0, 0x0,
203203
0x3f, 0xe0, 0x0, 0x0, 0x1f, 0xf0, 0x0, 0x0,
204204
0xf, 0xf8, 0x0, 0x0, 0x7, 0xfc, 0x0, 0x0,
@@ -214,22 +214,22 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
214214
0xff, 0x80, 0x0, 0x0, 0xf, 0xe0, 0x0, 0x0,
215215
0x7, 0xf0, 0x0, 0x0, 0x3, 0xf8, 0x0, 0x0,
216216
0x1, 0xfc, 0x0, 0x0, 0x0, 0xfe, 0x0, 0x0,
217-
0x0, 0x7f, 0x80, 0x0, 0x0, 0x1f, 0xc0, 0x0,
218-
0x0, 0xf, 0xe0, 0x0, 0x0, 0x7, 0xf0, 0x0,
217+
0x0, 0x7f, 0x80, 0x0, 0x0, 0x3f, 0xc0, 0x0,
218+
0x0, 0x1f, 0xe0, 0x0, 0x0, 0x7, 0xf0, 0x0,
219219
0x0, 0x3, 0xf8, 0x0, 0x0, 0x1, 0xfc, 0x0,
220-
0x0, 0x0, 0xfe, 0x0, 0x0, 0x0, 0x7f, 0x80,
220+
0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x7f, 0x80,
221221
0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0, 0x1f, 0xe0,
222-
0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x1, 0xff,
222+
0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x1, 0xff,
223223
0xfc, 0x0, 0x0, 0x7f, 0xff, 0xc0, 0x0, 0x1f,
224224
0xff, 0xf8, 0x0, 0x7, 0xff, 0xff, 0x0, 0x1,
225-
0xff, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xfc, 0x0,
226-
0x0, 0x1, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xe0,
225+
0xff, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xfc, 0x0,
226+
0x0, 0x1, 0xff, 0x0, 0x0, 0x0, 0x1f, 0xe0,
227227
0x0, 0x0, 0x7, 0xf8, 0x0, 0x0, 0x0, 0xfe,
228228
0x0, 0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0, 0x7,
229229
0xf0, 0x0, 0x0, 0x1, 0xfc, 0x0, 0x0, 0x0,
230230
0x7f, 0x0, 0x0, 0x0, 0x1f, 0xc0, 0x0, 0x0,
231231
0x7, 0xf0, 0x0, 0x0, 0x1, 0xfc, 0x0, 0x0,
232-
0x0, 0x7f, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80,
232+
0x0, 0x7f, 0xfe, 0x0, 0x0, 0x1f, 0xff, 0x80,
233233
0x0, 0x7, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xf8,
234234
0x0, 0x0, 0x7f, 0xff, 0x0, 0x0, 0x3f, 0xdf,
235235
0xc0, 0x0, 0xf, 0xe7, 0xf8, 0x0, 0x7, 0xf9,
@@ -466,10 +466,10 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
466466
{.bitmap_index = 878, .adv_w = 730, .box_w = 34, .box_h = 56, .ofs_x = 7, .ofs_y = 0},
467467
{.bitmap_index = 1116, .adv_w = 730, .box_w = 34, .box_h = 57, .ofs_x = 6, .ofs_y = 0},
468468
{.bitmap_index = 1359, .adv_w = 730, .box_w = 34, .box_h = 57, .ofs_x = 5, .ofs_y = -1},
469-
{.bitmap_index = 1602, .adv_w = 730, .box_w = 32, .box_h = 56, .ofs_x = 6, .ofs_y = 0},
469+
{.bitmap_index = 1602, .adv_w = 730, .box_w = 32, .box_h = 56, .ofs_x = 5, .ofs_y = 0},
470470
{.bitmap_index = 1826, .adv_w = 730, .box_w = 32, .box_h = 57, .ofs_x = 7, .ofs_y = -1},
471471
{.bitmap_index = 2054, .adv_w = 730, .box_w = 36, .box_h = 58, .ofs_x = 5, .ofs_y = -1},
472-
{.bitmap_index = 2315, .adv_w = 730, .box_w = 36, .box_h = 56, .ofs_x = 5, .ofs_y = 0},
472+
{.bitmap_index = 2315, .adv_w = 730, .box_w = 36, .box_h = 56, .ofs_x = 6, .ofs_y = 0},
473473
{.bitmap_index = 2567, .adv_w = 730, .box_w = 36, .box_h = 58, .ofs_x = 5, .ofs_y = -1},
474474
{.bitmap_index = 2828, .adv_w = 730, .box_w = 36, .box_h = 57, .ofs_x = 5, .ofs_y = 0},
475475
{.bitmap_index = 3085, .adv_w = 730, .box_w = 13, .box_h = 44, .ofs_x = 16, .ofs_y = -1}
@@ -541,7 +541,7 @@ lv_font_t jetbrains_mono_76 = {
541541
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
542542
.subpx = LV_FONT_SUBPX_NONE,
543543
#endif
544-
#if LV_VERSION_CHECK(7, 4, 0)
544+
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
545545
.underline_position = -12,
546546
.underline_thickness = 4,
547547
#endif

0 commit comments

Comments
 (0)