提交 738d096a 编写于 作者: B Behdad Esfahbod

Pass through unknown ISO 639-3 language tags to OpenType engine

In hb_ot_tag_from_language(), if first component of an unknown
language is three letters long, use it directly as OpenType language
tag (after case conversion and padding).
上级 ea02cbf0
......@@ -651,6 +651,14 @@ hb_ot_tag_from_language (hb_language_t language)
return HB_TAG('Z','H','S',' ');
}
s = strchr (lang_str, '-');
if (!s)
s = lang_str + strlen (lang_str);
if (s - lang_str == 3) {
/* Assume it's ISO-639-3 and upper-case and use it. */
return hb_tag_from_string (lang_str, s - lang_str) & ~0x20202000;
}
return HB_OT_TAG_DEFAULT_LANGUAGE;
}
......
......@@ -213,12 +213,17 @@ test_ot_tag_language (void)
test_tag_from_language ("dflt", "asdf-asdf-wer-x-hbot-zxc");
test_tag_from_language ("dflt", "xy");
test_tag_from_language ("XYZ", "xyz"); /* Unknown ISO 639-3 */
test_tag_from_language ("XYZ", "xyz-qw"); /* Unknown ISO 639-3 */
/* Test that x-hbot overrides the base language */
test_tag_from_language ("ABC", "fa-x-hbotabc-zxc");
test_tag_from_language ("ABC", "fa-ir-x-hbotabc-zxc");
test_tag_from_language ("ABC", "zh-x-hbotabc-zxc");
test_tag_from_language ("ABC", "zh-cn-x-hbotabc-zxc");
test_tag_from_language ("ABC", "zh-xy-x-hbotabc-zxc");
test_tag_from_language ("ABC", "xyz-xy-x-hbotabc-zxc");
}
int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册