[pango/fix-empty-line-spacing] layout: handle empty lines better




commit 1661f1b2c1651009c324f851eeee1957db097910
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 8 22:17:54 2021 -0400

    layout: handle empty lines better
    
    When using line-spacing, we were not giving
    empty lines their expected width. Fix that.
    
    Fixes: #499

 pango/pango-layout.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 57ec7606..c483526f 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -5213,8 +5213,15 @@ pango_layout_line_get_extents_and_height (PangoLayoutLine *line,
       tmp_list = tmp_list->next;
     }
 
-  if (logical_rect && !line->runs)
-    pango_layout_line_get_empty_extents (line, logical_rect);
+  if (!line->runs)
+    {
+      PangoRectangle r, *rect;
+
+      rect = logical_rect ? logical_rect : &r;
+      pango_layout_line_get_empty_extents (line, rect);
+      if (height)
+        *height = rect->height;
+    }
 
   if (caching)
     {


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