From: YAMAMOTO Mitsuharu Date: Wed, 30 Sep 2015 10:05:27 +0000 (+0900) Subject: * src/macfont.m (mac_font_descriptor_supports_languages): Regard "zh" as synonym... X-Git-Tag: emacs-25.0.90~1223^2~55 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ecedfd66fc18e9db206c9f9a49fd5226561f94a9;p=emacs.git * src/macfont.m (mac_font_descriptor_supports_languages): Regard "zh" as synonym of "zh-Hans". --- diff --git a/src/macfont.m b/src/macfont.m index cfe0e0a2b92..bab9f7cf9ff 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -3427,18 +3427,24 @@ mac_font_descriptor_supports_languages (CTFontDescriptorRef descriptor, result = false; else { - CFIndex desc_languages_count, i, languages_count; + CFRange range = CFRangeMake (0, CFArrayGetCount (desc_languages)); + CFIndex i, languages_count = CFArrayGetCount (languages); - desc_languages_count = CFArrayGetCount (desc_languages); - languages_count = CFArrayGetCount (languages); for (i = 0; i < languages_count; i++) - if (!CFArrayContainsValue (desc_languages, - CFRangeMake (0, desc_languages_count), - CFArrayGetValueAtIndex (languages, i))) - { - result = false; - break; - } + { + CFStringRef language = CFArrayGetValueAtIndex (languages, i); + + if (!CFArrayContainsValue (desc_languages, range, language) + /* PingFang SC contains "zh" and "zh-Hant" as covered + languages, but does not contain "zh-Hans". */ + && !(CFEqual (language, CFSTR ("zh-Hans")) + && CFArrayContainsValue (desc_languages, range, + CFSTR ("zh")))) + { + result = false; + break; + } + } CFRelease (desc_languages); }