From a51003661e2e093aad6bd0f6cb05e482a0ce4bbe Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 2 Aug 2023 14:50:03 +0000 Subject: [PATCH] label: Another tweak to wrapping handling This fixes a few reftests that were failing after the previous change because they ended up with x == -1. --- gtk/gtklabel.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 9f1d993b0d..8d59efe0c1 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1333,10 +1333,9 @@ get_layout_location (GtkLabel *self, xalign = 1.0 - xalign; pango_layout_get_pixel_extents (self->layout, NULL, &logical); - if (pango_layout_get_width (self->layout) > 0) + x = floor ((xalign * (widget_width - logical.width)) - logical.x); + if (x < 0) x = 0.f; - else - x = floor ((xalign * (widget_width - logical.width)) - logical.x); baseline = gtk_widget_get_baseline (widget); if (baseline != -1) -- 2.30.2