[pango/pango2: 92/168] layout: Go back to trimming start and end
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 92/168] layout: Go back to trimming start and end
- Date: Wed, 8 Jun 2022 10:22:17 +0000 (UTC)
commit 7bcf0ae1effe70d8dede10d9f5ae1b56bf1f2c64
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 c218422e..ba96589c 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 8ce55374..010cc56a 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]