Skip to content

Commit

Permalink
fix(label) fix clipped italic letters
Browse files Browse the repository at this point in the history
fixes: #2559
  • Loading branch information
kisvegabor committed Oct 18, 2021
1 parent 9ece84d commit 2efa6dc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/widgets/lv_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2efa6dc

Please sign in to comment.