summaryrefslogtreecommitdiff
path: root/pango/break-thai.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-24 00:52:53 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-08-24 00:52:53 +0000
commit4740e552b3c8ca005beea88001a82ea6bb266076 (patch)
tree25a7c9825d322932b58038db4aac44ecf010dbc5 /pango/break-thai.c
parent8cae1c0762fa35cbe41d35a34d8e048965d287ac (diff)
parent1349e9a424dc5425dd087b382d6042f5cba3b661 (diff)
downloadpango-4740e552b3c8ca005beea88001a82ea6bb266076.tar.gz
Merge branch 'log-attr-things' into 'main'
break-thai: Fix up word break handling See merge request GNOME/pango!434
Diffstat (limited to 'pango/break-thai.c')
-rw-r--r--pango/break-thai.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/pango/break-thai.c b/pango/break-thai.c
index 871c0869..02a18cc5 100644
--- a/pango/break-thai.c
+++ b/pango/break-thai.c
@@ -92,15 +92,27 @@ break_thai (const char *text,
G_UNLOCK (thai_brk);
for (cnt = 0; cnt < len; cnt++)
- if (attrs[brk_pnts[cnt]].is_char_break)
{
- /* Only allow additional line breaks if line-breaking is NOT
- * prohibited. (The alternative would be to set is_char_break to
- * TRUE as well. NOT setting it will break invariants that any
- * line break opportunity is also a char break opportunity. */
- attrs[brk_pnts[cnt]].is_line_break = TRUE;
- attrs[brk_pnts[cnt]].is_word_start = TRUE;
- attrs[brk_pnts[cnt]].is_word_end = TRUE;
+ if (!attrs[brk_pnts[cnt]].is_line_break)
+ {
+ /* Insert line breaks where there wasn't one.
+ * Satisfy invariants by marking it as char break too.
+ */
+ attrs[brk_pnts[cnt]].is_char_break = TRUE;
+ attrs[brk_pnts[cnt]].is_line_break = TRUE;
+ }
+ if (!(attrs[brk_pnts[cnt]].is_word_start ||
+ attrs[brk_pnts[cnt]].is_word_end))
+ {
+ /* If we find a break in the middle of a sequence
+ * of characters, end and start a word. We must
+ * be careful only to do that if default_break
+ * did not already find a word start or end,
+ * otherwise we mess up the sequence.
+ */
+ attrs[brk_pnts[cnt]].is_word_start = TRUE;
+ attrs[brk_pnts[cnt]].is_word_end = TRUE;
+ }
}
if (brk_pnts != brk_stack)