From e205f1349551fd081d5b2da2dbfc45311d70db44 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 21 Sep 2024 10:06:33 +0200 Subject: [PATCH] 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 --- gtk/gtklabel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 156f060626..152b287a99 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -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)