summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2017-05-23 22:14:36 -0700
committerBehdad Esfahbod <behdad@behdad.org>2017-05-23 22:18:45 -0700
commitc6d6cfff40ba2e80c2fda7d33d2942a0b4a2d14a (patch)
tree8a37ffa0331cf29452ea6853b6f399a5f77bff6e
parent92cc73c898e4665fd739704417d487d137dd271b (diff)
downloadpango-c6d6cfff40ba2e80c2fda7d33d2942a0b4a2d14a.tar.gz
[break-thai] Fix two bugs in libthai glue layer
First bug is, we were passing as count to th_brk, the UTF-8 length instead of TIS length. Ouch! I'm not sure how this was never caught... The other one was, break-thai was possibly marking a position is_line_break when break.c has already set it to is_char_break=FALSE. This broke the invariant that if a position is line-break, then it must be char-break as well. This, in turn was hitting assertions in certain conditions. Hit it with this for example: $ ./pango-view --text 'ส์" (S' --width 43 --font 156px Note that in a correct world the Latin part of that string should not reach break-thai.c at all, but that's not how pango-layout.c breaks right now. See comment before pango_break() call in pango-layout.c.
-rw-r--r--pango/break-thai.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/pango/break-thai.c b/pango/break-thai.c
index 5560c9fe..c9bf3e81 100644
--- a/pango/break-thai.c
+++ b/pango/break-thai.c
@@ -83,10 +83,15 @@ break_thai (const char *text,
/* find line break positions */
G_LOCK (th_brk);
- len = th_brk (tis_text, brk_pnts, len);
+ len = th_brk (tis_text, brk_pnts, cnt);
G_UNLOCK (th_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;