Fix centered text in labels

When the text is rtl, pango will put the text at the right end of
its given width, causing the logical.x to be big, and in turn, our
computed position to be negative. If we don't allow that, centered
text will end up at the right side if it is rtl.

Fixes: #6836
This commit is contained in:
Matthias Clasen
2024-09-21 10:06:33 +02:00
parent 13364cea74
commit e205f13495

View File

@@ -1387,8 +1387,6 @@ get_layout_location (GtkLabel *self,
pango_layout_get_pixel_extents (self->layout, NULL, &logical);
x = floor ((xalign * (widget_width - logical.width)) - logical.x);
if (x < 0)
x = 0.f;
baseline = gtk_widget_get_baseline (widget);
if (baseline != -1)