[pango/word-break-hyphens: 2/2] layout: Don't insert hyphens at word boundaries
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/word-break-hyphens: 2/2] layout: Don't insert hyphens at word boundaries
- Date: Sun, 9 May 2021 00:25:43 +0000 (UTC)
commit d476d2a944500f8553a2c1d1054df37363f47460
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 8 15:09:45 2021 -0400
layout: Don't insert hyphens at word boundaries
We only want to insert hyphens when we are breaking
inside a word.
Update affected tests (hyphen-or-not shows up in the
analysis flags in the output of test-layout).
Fixes: #558
pango/pango-layout.c | 3 +++
tests/layouts/valid-4.expected | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index fa499ef3..e847e789 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3611,6 +3611,9 @@ break_needs_hyphen (PangoLayout *layout,
if (state->log_widths_offset + pos == 0)
return FALSE;
+ if (layout->log_attrs[state->start_offset + pos].is_line_break)
+ return FALSE;
+
if (state->need_hyphen[state->log_widths_offset + pos - 1])
return TRUE;
diff --git a/tests/layouts/valid-4.expected b/tests/layouts/valid-4.expected
index 66796cb5..2534b6fc 100644
--- a/tests/layouts/valid-4.expected
+++ b/tests/layouts/valid-4.expected
@@ -23,11 +23,11 @@ i=6, index=152, paragraph-start=1, dir=ltr ''
--- runs
-i=1, index=0, chars=30, level=0, gravity=south, flags=4, font=OMITTED, script=latin, language=en-us, 'This
paragraph should actual'
+i=1, index=0, chars=30, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'This
paragraph should actual'
i=2, index=32, no run, line end
i=3, index=32, chars=31, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'ly
have multiple lines, unlike '
i=4, index=63, no run, line end
-i=5, index=63, chars=29, level=0, gravity=south, flags=4, font=OMITTED, script=latin, language=en-us, 'all
the other wannabe äöü pa'
+i=5, index=63, chars=29, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'all
the other wannabe äöü pa'
i=6, index=96, no run, line end
i=7, index=96, chars=27, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us,
'ragraph tests in this ugh '
i=8, index=124, no run, line end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]