[gtk/wip/otte/inscription: 4/5] inscription: Multiparagraph text is always multiline




commit 29f29cc5f936eb3e46a9b99752820e81826d4446
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jun 13 04:54:19 2022 +0200

    inscription: Multiparagraph text is always multiline
    
    Wrap this text and clip towards the bottom, no matter how high the
    inscription is.

 gtk/gtkinscription.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkinscription.c b/gtk/gtkinscription.c
index a06b78b30b..37ac5fdd95 100644
--- a/gtk/gtkinscription.c
+++ b/gtk/gtkinscription.c
@@ -476,7 +476,14 @@ gtk_inscription_allocate (GtkWidget *widget,
             PangoRectangle rect;
             pango_layout_iter_get_line_extents (iter, NULL, &rect);
             if (rect.y + rect.height > height * PANGO_SCALE)
-              pango_layout_set_width (self->layout, -1);
+              {
+                while (!pango_layout_line_is_paragraph_start (pango_layout_iter_get_line_readonly (iter)))
+                  pango_layout_iter_next_line (iter);
+                if (!pango_layout_line_is_paragraph_start (pango_layout_iter_get_line_readonly (iter)))
+                  {
+                    pango_layout_set_width (self->layout, -1);
+                  }
+              }
           }
       }
       break;


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