[pango] [break-thai] Fix two bugs in libthai glue layer
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] [break-thai] Fix two bugs in libthai glue layer
- Date: Wed, 24 May 2017 05:19:50 +0000 (UTC)
commit c6d6cfff40ba2e80c2fda7d33d2942a0b4a2d14a
Author: Behdad Esfahbod <behdad behdad org>
Date: Tue May 23 22:14:36 2017 -0700
[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.
pango/break-thai.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/pango/break-thai.c b/pango/break-thai.c
index 5560c9f..c9bf3e8 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]