[gtk/wip/otte/inscription: 1/3] inscription: Fixate layout at top when it doesn't fit




commit 393ef4d0a23053fdfd0445c37af55da72aa66f30
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jun 11 16:28:27 2022 +0200

    inscription: Fixate layout at top when it doesn't fit
    
    Ellipsized and clipped layouts shouldn't reposition themselves according
    to yalign when they don't fully fit.

 gtk/gtkinscription.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gtk/gtkinscription.c b/gtk/gtkinscription.c
index 155f334ad8..6a2260027a 100644
--- a/gtk/gtkinscription.c
+++ b/gtk/gtkinscription.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]