[pango/pango2: 79/135] layout: Go back to trimming start and end




commit 0f9075987644c9bbb314cdd499530fbbc8a4367e
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 25 22:25:57 2022 -0500

    layout: Go back to trimming start and end
    
    We want the first and the last line of the paragraph
    to have its leading trimmed, for the purposes of
    determining the paragraph extents.

 pango/pango-layout.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 0214997e..97afea01 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -653,6 +653,7 @@ ensure_lines (PangoLayout *layout)
       PangoRectangle ext;
       int offset;
       PangoEllipsizeMode ellipsize = PANGO_ELLIPSIZE_NONE;
+      PangoLeadingTrim trim = PANGO_LEADING_TRIM_NONE;
 
       if ((line_no == 0) == (layout->indent > 0))
         {
@@ -670,7 +671,13 @@ ensure_lines (PangoLayout *layout)
 
 retry:
       line = pango_line_breaker_next_line (breaker, x, width, layout->wrap, ellipsize);
-      pango_line_get_extents (line, NULL, &ext);
+
+      if (line->starts_paragraph)
+        trim |= PANGO_LEADING_TRIM_START;
+      if (line->ends_paragraph)
+        trim |= PANGO_LEADING_TRIM_END;
+
+      pango_line_get_trimmed_extents (line, trim, &ext);
 
       if (layout->height >= 0 && y + 2 * ext.height >= layout->height &&
           ellipsize != layout->ellipsize)


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