From 6334495ac1ee0a86228e67794b7a41ee91146f3b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 10 Jul 2014 19:22:07 -0400 Subject: [PATCH] Use zh-Hans / zh-Hant when converting OT language tag to hb_language_t --- src/hb-ot-tag.cc | 15 +++------------ test/api/test-ot-tag.c | 6 +++--- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc index 07ae3103b..89cc1e253 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 65290179a..b667c7d93 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");