src/hb-icu.cc | 8 +++----- test/test-unicode.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-)
New commits: commit 36a4f4a482456ee816dcb59befa0b0538ba487df Author: Behdad Esfahbod <[email protected]> Date: Wed Jan 18 22:16:49 2012 -0500 Replace u_strlen() with u_countChar32() The latter is what I meant. diff --git a/src/hb-icu.cc b/src/hb-icu.cc index cc551d3..5cf09b2 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -36,7 +36,7 @@ #include <unicode/uversion.h> #include <unicode/uchar.h> #include <unicode/unorm.h> -#include <unicode/unistr.h> +#include <unicode/ustring.h> @@ -190,8 +190,7 @@ hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, len = unorm_normalize (utf16, len, UNORM_NFC, 0, normalized, ARRAY_LENGTH (normalized), &icu_err); if (icu_err) return FALSE; - normalized[len] = 0; - if (u_strlen (normalized) == 1) { + if (u_countChar32 (normalized, len) == 1) { U16_GET_UNSAFE (normalized, 0, *ab); ret = TRUE; } else { @@ -227,8 +226,7 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, if (icu_err) return FALSE; - normalized[len] = 0; - len = u_strlen (normalized); + len = u_countChar32 (normalized, len); if (len == 1) { U16_GET_UNSAFE (normalized, 0, *a); commit 055fb24d03ae518fa0aa6c2860a03f3cb6a5ef0d Author: Behdad Esfahbod <[email protected]> Date: Wed Jan 18 21:58:34 2012 -0500 Add test for bug in ICU decompose As reported by Kenichi Ishibashi on 2011-10-28. diff --git a/test/test-unicode.c b/test/test-unicode.c index 3482a05..a420bf3 100644 --- a/test/test-unicode.c +++ b/test/test-unicode.c @@ -781,7 +781,6 @@ test_unicode_script_roundtrip (gconstpointer user_data) } -/* TODO test compose() and decompose() */ static void test_unicode_normalization (gconstpointer user_data) { @@ -826,6 +825,7 @@ test_unicode_normalization (gconstpointer user_data) /* Not decomposable */ g_assert (!hb_unicode_decompose (uf, 0x0041, &a, &b) && a == 0x0041 && b == 0); g_assert (!hb_unicode_decompose (uf, 0xFB01, &a, &b) && a == 0xFB01 && b == 0); + g_assert (!hb_unicode_decompose (uf, 0x1F1EF, &a, &b) && a == 0x1F1EF && b == 0); /* Singletons */ g_assert (hb_unicode_decompose (uf, 0x212B, &a, &b) && a == 0x00C5 && b == 0); _______________________________________________ HarfBuzz mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/harfbuzz
