Bug 18726 - RFE: help write locale-specific tests
Summary: RFE: help write locale-specific tests
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.6
Hardware: Other All
: medium enhancement
Assignee: Akira TAGOH
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-27 01:30 UTC by Nicolas Mailhot
Modified: 2012-06-21 22:33 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Nicolas Mailhot 2008-11-27 01:30:42 UTC
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">
   <string>zh</string>
</test>

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.
Comment 1 Akira TAGOH 2012-04-24 02:55:12 UTC
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

is:

  <test name="lang" compare="contains">
    <string>ze</string>
  </test>

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.
Comment 2 Akira TAGOH 2012-04-24 03:13:42 UTC
Added an example: http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz18726

Please review.
Comment 3 Akira TAGOH 2012-06-21 22:33:00 UTC
Added some comments about compare stuff and committed into git master.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.