[pango/pango2: 100/301] layout: Go back to trimming start and end
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 100/301] layout: Go back to trimming start and end
- Date: Wed, 22 Jun 2022 15:53:36 +0000 (UTC)
commit 3c3d77413de796f3d0ac915fd9fb857bef365fe6
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 ++++++++-
tests/layouts/no-space.layout | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index c218422ec..ba96589cb 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)
diff --git a/tests/layouts/no-space.layout b/tests/layouts/no-space.layout
index 8ce553742..010cc56a2 100644
--- a/tests/layouts/no-space.layout
+++ b/tests/layouts/no-space.layout
@@ -76,7 +76,7 @@
{
"position" : [
0,
- 40448
+ 38912
],
"line" : {
"start-index" : 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]