diff --git a/src/widgets/lv_label.c b/src/widgets/lv_label.c index dbd400b3d..a13421c13 100644 --- a/src/widgets/lv_label.c +++ b/src/widgets/lv_label.c @@ -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);