From: Matthias Clasen Date: Wed, 2 Aug 2023 14:50:03 +0000 (+0000) Subject: label: Another tweak to wrapping handling X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~15^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a51003661e2e093aad6bd0f6cb05e482a0ce4bbe;p=gtk4.git 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. --- 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)