feat(draw/sw): added support for 3 bpp font rendering (#7350)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
@@ -221,7 +221,8 @@ However, there are some limitations:
|
|||||||
Compressed fonts
|
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
|
- ticking the ``Compressed`` check box in the online converter
|
||||||
- not passing the ``--no-compress`` flag to the offline converter (compression is applied by default)
|
- 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
|
- they can be compressed better
|
||||||
- and probably they are used less frequently then the medium-sized fonts, so the performance cost is smaller.
|
- 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
|
Kerning
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ static void LV_ATTRIBUTE_FAST_MEM draw_letter_cb(lv_draw_unit_t * draw_unit, lv_
|
|||||||
break;
|
break;
|
||||||
case LV_FONT_GLYPH_FORMAT_A1:
|
case LV_FONT_GLYPH_FORMAT_A1:
|
||||||
case LV_FONT_GLYPH_FORMAT_A2:
|
case LV_FONT_GLYPH_FORMAT_A2:
|
||||||
|
case LV_FONT_GLYPH_FORMAT_A3:
|
||||||
case LV_FONT_GLYPH_FORMAT_A4:
|
case LV_FONT_GLYPH_FORMAT_A4:
|
||||||
case LV_FONT_GLYPH_FORMAT_A8:
|
case LV_FONT_GLYPH_FORMAT_A8:
|
||||||
case LV_FONT_GLYPH_FORMAT_A1_ALIGNED:
|
case LV_FONT_GLYPH_FORMAT_A1_ALIGNED:
|
||||||
|
|||||||
@@ -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) {
|
switch(glyph_draw_dsc->format) {
|
||||||
case LV_FONT_GLYPH_FORMAT_A1:
|
case LV_FONT_GLYPH_FORMAT_A1:
|
||||||
case LV_FONT_GLYPH_FORMAT_A2:
|
case LV_FONT_GLYPH_FORMAT_A2:
|
||||||
|
case LV_FONT_GLYPH_FORMAT_A3:
|
||||||
case LV_FONT_GLYPH_FORMAT_A4:
|
case LV_FONT_GLYPH_FORMAT_A4:
|
||||||
case LV_FONT_GLYPH_FORMAT_A8:
|
case LV_FONT_GLYPH_FORMAT_A8:
|
||||||
case LV_FONT_GLYPH_FORMAT_A1_ALIGNED:
|
case LV_FONT_GLYPH_FORMAT_A1_ALIGNED:
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ typedef enum {
|
|||||||
/**< Legacy simple formats with no byte padding at end of the lines*/
|
/**< 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_A1 = 0x01, /**< 1 bit per pixel*/
|
||||||
LV_FONT_GLYPH_FORMAT_A2 = 0x02, /**< 2 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_A4 = 0x04, /**< 4 bit per pixel*/
|
||||||
LV_FONT_GLYPH_FORMAT_A8 = 0x08, /**< 8 bit per pixel*/
|
LV_FONT_GLYPH_FORMAT_A8 = 0x08, /**< 8 bit per pixel*/
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ add_library(test_common
|
|||||||
src/test_assets/test_font_montserrat_ascii_1bpp.c
|
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_2bpp.c
|
||||||
src/test_assets/test_font_montserrat_ascii_4bpp.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_1_bin.c
|
||||||
src/test_assets/test_font_2_bin.c
|
src/test_assets/test_font_2_bin.c
|
||||||
src/test_assets/test_font_3_bin.c
|
src/test_assets/test_font_3_bin.c
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
1304
tests/src/test_assets/test_font_montserrat_ascii_3bpp_compressed.c
Normal 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_1bpp);
|
||||||
LV_FONT_DECLARE(test_font_montserrat_ascii_2bpp);
|
LV_FONT_DECLARE(test_font_montserrat_ascii_2bpp);
|
||||||
LV_FONT_DECLARE(test_font_montserrat_ascii_4bpp);
|
LV_FONT_DECLARE(test_font_montserrat_ascii_4bpp);
|
||||||
LV_FONT_DECLARE(test_font_montserrat_ascii_4bpp_compressed);
|
LV_FONT_DECLARE(test_font_montserrat_ascii_3bpp_compressed);
|
||||||
// LV_FONT_DECLARE(test_font_montserrat_ascii_4bpp_subpx);
|
|
||||||
|
|
||||||
label_create(&test_font_montserrat_ascii_1bpp, style, "1bpp font");
|
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_2bpp, style, "2bpp font");
|
||||||
label_create(&test_font_montserrat_ascii_4bpp, style, "4bpp 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_3bpp_compressed, style, "3bpp compressed font");
|
||||||
// label_create(&test_font_montserrat_ascii_4bpp_subpx, style, "4bpp subpx font");
|
|
||||||
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
lv_snprintf(buf, sizeof(buf), "draw/label_%s.png", name);
|
lv_snprintf(buf, sizeof(buf), "draw/label_%s.png", name);
|
||||||
|
|||||||