1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

feat(draw/sw): added support for 3 bpp font rendering (#7350)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
RomanLuchyshyn 2024-12-20 14:50:01 +02:00 committed by GitHub
parent 3146313e44
commit 27ebfc20ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 1314 additions and 1432 deletions

View File

@ -221,7 +221,8 @@ However, there are some limitations:
Compressed fonts
----------------
The bitmaps of fonts can be compressed by
The built-in font engine supports compressed bitmaps.
Compressed fonts can be generated by
- ticking the ``Compressed`` check box in the online converter
- not passing the ``--no-compress`` flag to the offline converter (compression is applied by default)
@ -235,6 +236,8 @@ because
- they can be compressed better
- and probably they are used less frequently then the medium-sized fonts, so the performance cost is smaller.
Compressed fonts also support ``bpp=3``.
Kerning
-------

View File

@ -83,6 +83,7 @@ static void LV_ATTRIBUTE_FAST_MEM draw_letter_cb(lv_draw_unit_t * draw_unit, lv_
break;
case LV_FONT_GLYPH_FORMAT_A1:
case LV_FONT_GLYPH_FORMAT_A2:
case LV_FONT_GLYPH_FORMAT_A3:
case LV_FONT_GLYPH_FORMAT_A4:
case LV_FONT_GLYPH_FORMAT_A8:
case LV_FONT_GLYPH_FORMAT_A1_ALIGNED:

View File

@ -100,6 +100,7 @@ static void draw_letter_cb(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * gly
switch(glyph_draw_dsc->format) {
case LV_FONT_GLYPH_FORMAT_A1:
case LV_FONT_GLYPH_FORMAT_A2:
case LV_FONT_GLYPH_FORMAT_A3:
case LV_FONT_GLYPH_FORMAT_A4:
case LV_FONT_GLYPH_FORMAT_A8:
case LV_FONT_GLYPH_FORMAT_A1_ALIGNED:

View File

@ -39,6 +39,7 @@ typedef enum {
/**< Legacy simple formats with no byte padding at end of the lines*/
LV_FONT_GLYPH_FORMAT_A1 = 0x01, /**< 1 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A2 = 0x02, /**< 2 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A3 = 0x03, /**< 3 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A4 = 0x04, /**< 4 bit per pixel*/
LV_FONT_GLYPH_FORMAT_A8 = 0x08, /**< 8 bit per pixel*/

View File

@ -293,7 +293,7 @@ add_library(test_common
src/test_assets/test_font_montserrat_ascii_1bpp.c
src/test_assets/test_font_montserrat_ascii_2bpp.c
src/test_assets/test_font_montserrat_ascii_4bpp.c
src/test_assets/test_font_montserrat_ascii_4bpp_compressed.c
src/test_assets/test_font_montserrat_ascii_3bpp_compressed.c
src/test_assets/test_font_1_bin.c
src/test_assets/test_font_2_bin.c
src/test_assets/test_font_3_bin.c

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because it is too large Load Diff

View File

@ -33,14 +33,12 @@ static void all_labels_create(const char * name, lv_style_t * style)
LV_FONT_DECLARE(test_font_montserrat_ascii_1bpp);
LV_FONT_DECLARE(test_font_montserrat_ascii_2bpp);
LV_FONT_DECLARE(test_font_montserrat_ascii_4bpp);
LV_FONT_DECLARE(test_font_montserrat_ascii_4bpp_compressed);
// LV_FONT_DECLARE(test_font_montserrat_ascii_4bpp_subpx);
LV_FONT_DECLARE(test_font_montserrat_ascii_3bpp_compressed);
label_create(&test_font_montserrat_ascii_1bpp, style, "1bpp font");
label_create(&test_font_montserrat_ascii_2bpp, style, "2bpp font");
label_create(&test_font_montserrat_ascii_4bpp, style, "4bpp font");
label_create(&test_font_montserrat_ascii_4bpp_compressed, style, "4bpp compressed font");
// label_create(&test_font_montserrat_ascii_4bpp_subpx, style, "4bpp subpx font");
label_create(&test_font_montserrat_ascii_3bpp_compressed, style, "3bpp compressed font");
char buf[64];
lv_snprintf(buf, sizeof(buf), "draw/label_%s.png", name);