[pango/line-breaker] layout: Go back to trimming start and end
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/line-breaker] layout: Go back to trimming start and end
- Date: Wed, 26 Jan 2022 04:16:19 +0000 (UTC)
commit c4c96e4cf9fce193547f5de730b467810ec0c70b
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]