Due to Han unification there is often a need for font distributors to test if a font name is requested in a chinese, japanese or korean context. However, there are many chinese locales and writing an exact match is not possible.
The current pattern (used by Debian, Ubuntu, Fedora, etc) in this case is
<test compare="contains" name="lang">
but we do not really want to match every locale containing "ze". We want to match every ze-foo locale, not jze-foo or foo-ze
Please add a documented fonts.conf pattern to fontconfig that allows distributors to specify such an exact match.
lang-matching rule isn't necessarily based on the string comparison. when using "eq" operator, the mapping table in FcLangSet is compared as long as the lang matches to what fontconfig has as the orthography files. otherwise the string comparison is used for last resort. When using "contains" operator, the minimal requirements in the mapping tables are compared if it's provided as the orthography files. otherwise the string comparison is used though, it still matches even if only one of values contains the territory but not in other. e.g. "contains" operator considers "en" matches "en-us" and vice versa.
So what you need to do for:
(In reply to comment #0)
> but we do not really want to match every locale containing "ze". We want to
> match every ze-foo locale, not jze-foo or foo-ze
<test name="lang" compare="contains">
in that case. "contains" may still helps if any apps adds the lang from current locale with ll-cc but the orth file is ll.orth.
Added an example: http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz18726
Added some comments about compare stuff and committed into git master.
on Oct 24, 2016 at 05:11:47.
(provided by the Example extension).