summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-01-25 22:25:57 -0500
committerMatthias Clasen <mclasen@redhat.com>2022-01-25 22:25:57 -0500
commitc4c96e4cf9fce193547f5de730b467810ec0c70b (patch)
treee329d23b357bf0c8947d32bb6fe94012cc95d9bd
parent175d85d6d7c3976ab7fe616332040ae0fdce2201 (diff)
downloadpango-line-breaker.tar.gz
layout: Go back to trimming start and endline-breaker
We want the first and the last line of the paragraph to have its leading trimmed, for the purposes of determining the paragraph extents.
-rw-r--r--pango/pango-layout.c9
1 files changed, 8 insertions, 1 deletions
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)