inscription: Fixate layout at top when it doesn't fit
authorBenjamin Otte <otte@redhat.com>
Sat, 11 Jun 2022 14:28:27 +0000 (16:28 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 11 Jun 2022 14:28:27 +0000 (16:28 +0200)
Ellipsized and clipped layouts shouldn't reposition themselves according
to yalign when they don't fully fit.

gtk/gtkinscription.c

index 155f334ad80a13a26fe29a1c7d90fe4021474b55..6a2260027ac6e8a1e72b0ac97534abab1045e21e 100644 (file)
@@ -395,9 +395,15 @@ gtk_inscription_get_layout_location (GtkInscription *self,
       /* yalign is 0 because we can't support yalign while baseline aligning */
       y = baseline - layout_baseline;
     }
+  else if (pango_layout_is_ellipsized (self->layout))
+    {
+      y = 0.f;
+    }
   else
     {
       y = floor ((widget_height - logical.height) * self->yalign);
+      if (y < 0)
+        y = 0.f;
     }
 
   *x_out = x;