From b30ca6e5a57fd40cf8f94ef2869e742498bc0577 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 21 Jul 2011 16:05:43 -0400 Subject: [PATCH] Bug 655076 - Our normalization code misses some Full_Composition_Exclusion=True. --- glib/gen-unicode-tables.pl | 4 ++++ glib/tests/unicode.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/glib/gen-unicode-tables.pl b/glib/gen-unicode-tables.pl index b419d8b..a8fe7bf 100755 --- a/glib/gen-unicode-tables.pl +++ b/glib/gen-unicode-tables.pl @@ -1109,6 +1109,10 @@ sub output_composition_table @values = map { hex ($_) } split /\s+/, $compositions{$code}; # non-starters + if ($cclass[$code]) { + delete $compositions{$code}; + next; + } if ($cclass[$values[0]]) { delete $compositions{$code}; next; diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c index c13937d..00dd0f5 100644 --- a/glib/tests/unicode.c +++ b/glib/tests/unicode.c @@ -432,6 +432,10 @@ test_compose (void) g_assert (!g_unichar_compose (0x0041, 0, &ch) && ch == 0); g_assert (!g_unichar_compose (0x0066, 0x0069, &ch) && ch == 0); + /* Tricky non-composable */ + g_assert (!g_unichar_compose (0x0308, 0x0301, &ch) && ch == 0); /* !0x0344 */ + g_assert (!g_unichar_compose (0x0F71, 0x0F72, &ch) && ch == 0); /* !0x0F73 */ + /* Singletons should not compose */ g_assert (!g_unichar_compose (0x212B, 0, &ch) && ch == 0); g_assert (!g_unichar_compose (0x00C5, 0, &ch) && ch == 0); @@ -466,6 +470,10 @@ test_decompose (void) g_assert (g_unichar_decompose (0x212B, &a, &b) && a == 0x00C5 && b == 0); g_assert (g_unichar_decompose (0x2126, &a, &b) && a == 0x03A9 && b == 0); + /* Tricky pairs */ + g_assert (g_unichar_decompose (0x0344, &a, &b) && a == 0x0308 && b == 0x0301); + g_assert (g_unichar_decompose (0x0F73, &a, &b) && a == 0x0F71 && b == 0x0F72); + /* Pairs */ g_assert (g_unichar_decompose (0x00C5, &a, &b) && a == 0x0041 && b == 0x030A); g_assert (g_unichar_decompose (0x00F4, &a, &b) && a == 0x006F && b == 0x0302); @@ -509,6 +517,10 @@ test_fully_decompose_canonical (void) TEST2 (0x212B, 0x0041, 0x030A); TEST1 (0x2126, 0x03A9); + /* Tricky pairs */ + TEST2 (0x0344, 0x0308, 0x0301); + TEST2 (0x0F73, 0x0F71, 0x0F72); + /* General */ TEST2 (0x00C5, 0x0041, 0x030A); TEST2 (0x00F4, 0x006F, 0x0302); @@ -555,6 +567,10 @@ test_canonical_decomposition (void) TEST2 (0x212B, 0x0041, 0x030A); TEST1 (0x2126, 0x03A9); + /* Tricky pairs */ + TEST2 (0x0344, 0x0308, 0x0301); + TEST2 (0x0F73, 0x0F71, 0x0F72); + /* General */ TEST2 (0x00C5, 0x0041, 0x030A); TEST2 (0x00F4, 0x006F, 0x0302); -- 2.7.4