diff --git a/lv_conf_template.h b/lv_conf_template.h index 7fd64b138f..08e9beb9ec 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -275,6 +275,11 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i /*Always set a default font from the built-in fonts*/ #define LV_FONT_DEFAULT &lv_font_roboto_16 +/* Enable it if you have fonts with a lot of characters. + * The limit depends on the font size, font face and bpp + * but with > 10,000 characters if you see issues probably you need to enable it.*/ +#define LV_FONT_FMT_TXT_LARGE 0 + /*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ typedef void * lv_font_user_data_t; diff --git a/src/lv_conf_checker.h b/src/lv_conf_checker.h index 00ad944924..ff7ac05df5 100644 --- a/src/lv_conf_checker.h +++ b/src/lv_conf_checker.h @@ -385,6 +385,13 @@ #define LV_FONT_DEFAULT &lv_font_roboto_16 #endif +/* Enable it if you have fonts with a lot of characters. + * The limit depends on the font size, font face and bpp + * but with > 10,000 characters if you see issues probably you need to enable it.*/ +#ifndef LV_FONT_FMT_TXT_LARGE +#define LV_FONT_FMT_TXT_LARGE 0 +#endif + /*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ /*================= diff --git a/src/lv_font/lv_font_fmt_txt.h b/src/lv_font/lv_font_fmt_txt.h index d166e934c0..8e19f4b2ed 100644 --- a/src/lv_font/lv_font_fmt_txt.h +++ b/src/lv_font/lv_font_fmt_txt.h @@ -35,9 +35,13 @@ extern "C" { /** This describes a glyph. */ typedef struct { +#if LV_FONT_FMT_TXT_LARGE == 0 uint32_t bitmap_index : 20; /**< Start index of the bitmap. A font can be max 1 MB. */ - uint32_t adv_w :12; /**< Draw the next glyph after this width. 12.4 format (real_value * 16 is stored). */ - + uint32_t adv_w :12; /**< Draw the next glyph after this width. 8.4 format (real_value * 16 is stored). */ +#else + uint32_t bitmap_index; /**< Start index of the bitmap. A font can be max 4 GB. */ + uint32_t adv_w; /**< Draw the next glyph after this width. 28.4 format (real_value * 16 is stored). */ +#endif uint8_t box_w; /**< Width of the glyph's bounding box*/ uint8_t box_h; /**< Height of the glyph's bounding box*/ int8_t ofs_x; /**< x offset of the bounding box*/