[ucdn] Fix Hangul composition

https://github.com/grigorig/ucdn/issues/23
This commit is contained in:
Behdad Esfahbod 2019-05-14 00:13:21 -07:00
parent b2ab15a78c
commit f39934983f
2 changed files with 6 additions and 1 deletions

View File

@ -163,7 +163,8 @@ static int hangul_pair_decompose(uint32_t code, uint32_t *a, uint32_t *b)
static int hangul_pair_compose(uint32_t *code, uint32_t a, uint32_t b)
{
if (a >= SBASE && a < (SBASE + SCOUNT) && b >= TBASE && b < (TBASE + TCOUNT)) {
if (a >= SBASE && a < (SBASE + SCOUNT) && b > TBASE && b < (TBASE + TCOUNT) &&
!((a - SBASE) % TCOUNT)) {
/* LV,T */
*code = a + (b - TBASE);
return 3;

View File

@ -755,6 +755,10 @@ test_unicode_normalization (gconstpointer user_data)
g_assert (hb_unicode_compose (uf, 0xCE20, 0x11B8, &ab) && ab == 0xCE31);
g_assert (hb_unicode_compose (uf, 0x110E, 0x1173, &ab) && ab == 0xCE20);
g_assert (!hb_unicode_compose (uf, 0xAC00, 0x11A7, &ab));
g_assert (hb_unicode_compose (uf, 0xAC00, 0x11A8, &ab) && ab == 0xAC01);
g_assert (!hb_unicode_compose (uf, 0xAC01, 0x11A8, &ab));
/* Test decompose() */