[glib: 1/2] guniprop: Set jungseong and jongseong points to zero-width for Old Korean
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] guniprop: Set jungseong and jongseong points to zero-width for Old Korean
- Date: Wed, 19 Jan 2022 11:20:35 +0000 (UTC)
commit 84202a2ef0859aaf310084988fe95f271b2f405c
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Jan 6 13:11:24 2022 +0000
guniprop: Set jungseong and jongseong points to zero-width for Old Korean
This mirrors what `wcwidth()` from glibc does as of June 2020 (commit
6e540caa2).
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Fixes: #2564
glib/guniprop.c | 9 ++++++++-
glib/tests/unicode.c | 5 +++++
2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/glib/guniprop.c b/glib/guniprop.c
index f2b56ed5f..daf31677e 100644
--- a/glib/guniprop.c
+++ b/glib/guniprop.c
@@ -421,8 +421,15 @@ g_unichar_iszerowidth (gunichar c)
if (G_UNLIKELY (ISZEROWIDTHTYPE (TYPE (c))))
return TRUE;
+ /* A few additional codepoints are zero-width:
+ * - Part of the Hangul Jamo block covering medial/vowels/jungseong and
+ * final/trailing_consonants/jongseong Jamo
+ * - Jungseong and jongseong for Old Korean
+ * - Zero-width space (U+200B)
+ */
if (G_UNLIKELY ((c >= 0x1160 && c < 0x1200) ||
- c == 0x200B))
+ (c >= 0xD7B0 && c < 0xD800) ||
+ c == 0x200B))
return TRUE;
return FALSE;
diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c
index 9d6596687..113725c3f 100644
--- a/glib/tests/unicode.c
+++ b/glib/tests/unicode.c
@@ -909,6 +909,11 @@ test_zerowidth (void)
g_assert_false (g_unichar_iszerowidth (G_UNICODE_LAST_CHAR + 1));
g_assert_false (g_unichar_iszerowidth (G_UNICODE_LAST_CHAR_PART1));
g_assert_false (g_unichar_iszerowidth (G_UNICODE_LAST_CHAR_PART1 + 1));
+
+ /* Hangul Jamo Extended-B block, containing jungseong and jongseong for
+ * Old Korean */
+ g_assert_true (g_unichar_iszerowidth (0xD7B0));
+ g_assert_true (g_unichar_iszerowidth (0xD7FB));
}
/* Test that g_unichar_istitle() returns the correct value for various
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]