[pango] Don't break run in the middle of Hangul jamo sequence
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] Don't break run in the middle of Hangul jamo sequence
- Date: Wed, 30 Jul 2014 22:59:02 +0000 (UTC)
commit 61aeba6257ec7691a7a5222fb69aec3cc042435b
Author: Behdad Esfahbod <behdad behdad org>
Date: Wed Jul 30 18:58:14 2014 -0400
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
pango/pango-context.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 4e1fb1f..4817fac 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]