Skip to content

Commit

Permalink
Don't break run in the middle of Hangul jamo sequence
Browse files Browse the repository at this point in the history
See comments.

Bug 705727 - Incorrect rendering w/ Hangul syllable composition GSUB
https://bugzilla.gnome.org/show_bug.cgi?id=705727
  • Loading branch information
behdad committed Jul 30, 2014
1 parent 2b414de commit 61aeba6
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions pango/pango-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,25 @@ update_end (ItemizeState *state)
state->run_end = state->width_iter.end;
}

/* g_unichar_iswide() uses EastAsianWidth, which is broken.
* We should switch to using VerticalTextLayout:
* http://www.unicode.org/reports/tr50/#Data50
*
* In the mean time, fixup Hangul jamo to be all wide so we
* don't break run in the middle. The EastAsianWidth has
* 'W' for L-jamo, and 'N' for T and V jamo!
*
* https://bugzilla.gnome.org/show_bug.cgi?id=705727
*/
gboolean
width_iter_iswide (gunichar ch)
{
if (0x1100u <= ch && ch <= 0x11FF)

This comment has been minimized.

Copy link
@dohyunkim

dohyunkim Jul 31, 2014

Hangul Jamo also comprises 0xA960 .. 0xA97C and 0xD7B0 .. 0xD7FB.
See hb-ot-shape-complex-hangul.cc.

This comment has been minimized.

Copy link
@behdad

behdad Jul 31, 2014

Author Contributor

Thanks. Will fix.

return TRUE;

return g_unichar_iswide (ch);
}

static void
width_iter_next(PangoWidthIter* iter)
{
Expand All @@ -862,13 +881,13 @@ width_iter_next(PangoWidthIter* iter)
if (iter->end < iter->text_end)
{
gunichar ch = g_utf8_get_char (iter->end);
iter->wide = g_unichar_iswide (ch);
iter->wide = width_iter_iswide (ch);
}

while (iter->end < iter->text_end)
{
gunichar ch = g_utf8_get_char (iter->end);
if (g_unichar_iswide (ch) != iter->wide)
if (width_iter_iswide (ch) != iter->wide)
break;
iter->end = g_utf8_next_char (iter->end);
}
Expand Down

0 comments on commit 61aeba6

Please sign in to comment.