1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(label) fix clipped italic letters

fixes: #2559
This commit is contained in:
Gabor Kiss-Vamosi 2021-10-18 15:41:33 +02:00
parent 9ece84de16
commit 2efa6dce78

View File

@ -757,6 +757,15 @@ static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_label_revert_dots(obj);
lv_label_refr_text(obj);
}
else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
/* Italic or other non-typical letters can be drawn of out of the object.
* It happens if box_w + ofs_x > adw_w in the glyph.
* To avoid this add some extra draw area.
* font_h / 4 is an empirical value. */
const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font);
lv_event_set_ext_draw_size(e, font_h / 4);
}
else if(code == LV_EVENT_SIZE_CHANGED) {
lv_label_revert_dots(obj);
lv_label_refr_text(obj);