1
0
Fork 0

Fix label clipping when ascent/descent are fractional.

This commit is contained in:
Pāvels Nadtočajevs 2025-02-22 22:49:16 +02:00
parent 394508d26d
commit 33eb7724a0
1 changed files with 3 additions and 3 deletions

View File

@ -710,10 +710,10 @@ void Label::_notification(int p_what) {
Vector2 line_offset = _get_line_rect(p, i).position; Vector2 line_offset = _get_line_rect(p, i).position;
ofs.x = line_offset.x; ofs.x = line_offset.x;
int asc = TS->shaped_text_get_ascent(line_rid); double asc = TS->shaped_text_get_ascent(line_rid);
int dsc = TS->shaped_text_get_descent(line_rid); double dsc = TS->shaped_text_get_descent(line_rid);
if (asc + dsc < font_h) { if (asc + dsc < font_h) {
int diff = font_h - (asc + dsc); double diff = font_h - (asc + dsc);
asc += diff / 2; asc += diff / 2;
dsc += diff - (diff / 2); dsc += diff - (diff / 2);
} }