diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-09-02 13:16:25 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-09-10 16:55:58 -0400 |
commit | 6a320f7acb2912a5f2af7cd7c113e0a8a7b2b88e (patch) | |
tree | f08264c05de4389e0f489877cc4390f6d4489edb | |
parent | e09aa42a458f0fb99cf7a9d803415b2bf4d01207 (diff) | |
download | pango-6a320f7acb2912a5f2af7cd7c113e0a8a7b2b88e.tar.gz |
layout: Fix indent
With multiple paragraphs, we need to indent
not just the first one, but all of them.
-rw-r--r-- | pango2/pango-layout.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pango2/pango-layout.c b/pango2/pango-layout.c index 19d3bdc4..4429c2c7 100644 --- a/pango2/pango-layout.c +++ b/pango2/pango-layout.c @@ -641,6 +641,7 @@ ensure_lines (Pango2Layout *layout) Pango2AttrList *attrs; int x, y, width; int line_no; + gboolean at_paragraph_start; check_context_changed (layout); @@ -664,6 +665,7 @@ ensure_lines (Pango2Layout *layout) x = y = 0; line_no = 0; + at_paragraph_start = TRUE; while (pango2_line_breaker_has_line (breaker)) { Pango2Line *line; @@ -672,10 +674,13 @@ ensure_lines (Pango2Layout *layout) Pango2EllipsizeMode ellipsize = PANGO2_ELLIPSIZE_NONE; Pango2LeadingTrim trim = PANGO2_LEADING_TRIM_NONE; - if ((line_no == 0) == (layout->indent > 0)) + if (at_paragraph_start == (layout->indent > 0)) { x = abs (layout->indent); - width = layout->width - x; + if (layout->width == -1) + width = -1; + else + width = layout->width - x; } else { @@ -689,6 +694,8 @@ ensure_lines (Pango2Layout *layout) retry: line = pango2_line_breaker_next_line (breaker, x, width, layout->wrap, ellipsize); + at_paragraph_start = line->ends_paragraph; + if (line->starts_paragraph) trim |= PANGO2_LEADING_TRIM_START; if (line->ends_paragraph) |