标题: 使用v0.4转ttf为bin后,显示字符间隔很窄的问题? [打印本页] 作者: lyzc11 时间: 2026-4-21 13:46 标题: 使用v0.4转ttf为bin后,显示字符间隔很窄的问题? 用lvglFontTool 0.4将一个tty文件取特定字符转成bin文件,再加载显示,为什么实际ttf字符间隔在电脑上显示比较宽,而通过bin显示的两个数字间比较窄。例如显示12,电脑上显示1和2间是比较正常的,但通过bin读取显示后1和2是很挨在一起的 作者: lyzc11 时间: 2026-4-21 15:39
我看官方LVGL定义的字体描述符是adv_w、box_w、box_h分别是uint32_t和uint16_t类型,但lvgl font tool是生成的glyph_dsc_t是uint8_t类型,LVGL font dsc结构体
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. 8.4 format (real_value * 16 is stored).*/
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*/
int8_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
#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).*/
uint16_t box_w; /**< Width of the glyph's bounding box*/
uint16_t box_h; /**< Height of the glyph's bounding box*/
int16_t ofs_x; /**< x offset of the bounding box*/
int16_t ofs_y; /**< y offset of the bounding box. Measured from the top of the line*/
#endif
} lv_font_fmt_txt_glyph_dsc_t;
如下是0.4版本工具生成的定义
typedef struct{
uint8_t adv_w;
uint8_t box_w;
uint8_t box_h;
int8_t ofs_x;
int8_t ofs_y;
uint8_t r;
}glyph_dsc_t;
是不是uint8_t这个问题导致的?