diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc index 07ae3103b5511b8869a0f79b9ca9804f7b8ae6b9..89cc1e253212d79c58ccd2f8f82a80d41302fa33 100644 --- a/src/hb-ot-tag.cc +++ b/src/hb-ot-tag.cc @@ -880,18 +880,9 @@ hb_ot_tag_to_language (hb_tag_t tag) if ((tag & 0xFFFF0000) == 0x5A480000) { switch (tag) { case HB_TAG('Z','H','H',' '): return hb_language_from_string ("zh-hk", -1); /* Hong Kong */ - default: { - /* Encode the tag... */ - unsigned char buf[14] = "zh-x-hbot"; - buf[9] = tag >> 24; - buf[10] = (tag >> 16) & 0xFF; - buf[11] = (tag >> 8) & 0xFF; - buf[12] = tag & 0xFF; - if (buf[12] == 0x20) - buf[12] = '\0'; - buf[13] = '\0'; - return hb_language_from_string ((char *) buf, -1); - } + case HB_TAG('Z','H','S',' '): return hb_language_from_string ("zh-Hans", -1); /* Simplified */ + case HB_TAG('Z','H','T',' '): return hb_language_from_string ("zh-Hant", -1); /* Traditional */ + default: break; /* Fall through */ } } diff --git a/test/api/test-ot-tag.c b/test/api/test-ot-tag.c index 65290179a4b6b759207697e464712a63f28e0fa4..b667c7d93ba0d35a6fdbc8c0a1302ab9307ec7c8 100644 --- a/test/api/test-ot-tag.c +++ b/test/api/test-ot-tag.c @@ -207,9 +207,9 @@ test_ot_tag_language (void) test_tag_from_language ("ZHS", "zh"); /* Chinese */ test_tag_from_language ("ZHS", "zh-xx"); - test_tag_to_language ("ZHS", "zh-x-hbotzhs"); - test_tag_to_language ("ZHT", "zh-x-hbotzht"); - test_tag_to_language ("ZHP", "zh-x-hbotzhp"); + test_tag_to_language ("ZHS", "zh-Hans"); + test_tag_to_language ("ZHT", "zh-Hant"); + test_tag_to_language ("ZHP", "x-hbotzhp"); test_language_two_way ("ABC", "x-hbotabc"); test_tag_from_language ("ABC", "asdf-asdf-wer-x-hbotabc-zxc");