Fix lang matching logic

Previous code was broken logically, but harmless.
This commit is contained in:
Behdad Esfahbod 2014-07-10 19:20:35 -04:00
parent ee5350d667
commit f381e320df
2 changed files with 2 additions and 1 deletions

View File

@ -845,7 +845,7 @@ hb_ot_tag_from_language (hb_language_t language)
{
const LangTagLong *lang_tag;
lang_tag = &ot_languages_zh[i];
if (lang_matches (lang_tag->language, lang_str))
if (lang_matches (lang_str, lang_tag->language))
return lang_tag->tag;
}

View File

@ -195,6 +195,7 @@ test_ot_tag_language (void)
test_language_two_way ("ZHH", "zh-hk"); /* Chinese (Hong Kong) */
test_tag_from_language ("ZHS", "zh"); /* Chinese */
test_tag_from_language ("ZHS", "zh-cn"); /* Chinese (China) */
test_tag_from_language ("ZHS", "zh-sg"); /* Chinese (Singapore) */
test_tag_from_language ("ZHT", "zh-mo"); /* Chinese (Macao) */