summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2014-07-30 18:58:14 -0400
committerBehdad Esfahbod <behdad@behdad.org>2014-07-30 18:58:52 -0400
commit61aeba6257ec7691a7a5222fb69aec3cc042435b (patch)
tree8f9d4dd9f6140a52ace3208f00ed9d573616dbf1
parent2b414de9d93989950667d5642b548d427a89dc1c (diff)
downloadpango-61aeba6257ec7691a7a5222fb69aec3cc042435b.tar.gz
Don't break run in the middle of Hangul jamo sequence
See comments. Bug 705727 - Incorrect rendering w/ Hangul syllable composition GSUB https://bugzilla.gnome.org/show_bug.cgi?id=705727
-rw-r--r--pango/pango-context.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 4e1fb1fa..4817fac8 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -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)
+ return TRUE;
+
+ return g_unichar_iswide (ch);
+}
+
static void
width_iter_next(PangoWidthIter* iter)
{
@@ -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);
}