summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-05-08 15:09:45 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-05-08 20:24:49 -0400
commitd476d2a944500f8553a2c1d1054df37363f47460 (patch)
tree939c02f905665d7eb2ac8f2460d938c5826e1100
parent62ede003a14b03311885ee873725b8caa5f9ce53 (diff)
downloadpango-word-break-hyphens.tar.gz
layout: Don't insert hyphens at word boundariesword-break-hyphens
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
-rw-r--r--pango/pango-layout.c3
-rw-r--r--tests/layouts/valid-4.expected4
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 ac­tual­'
+i=1, index=0, chars=30, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'This paragraph should ac­tual­'
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, 'ra­graph tests in this ugh '
i=8, index=124, no run, line end