Bug 28958 - lang=en matches other langs
Summary: lang=en matches other langs
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.8
Hardware: Other All
: medium normal
Assignee: Keith Packard
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
: 25670 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-07 23:17 UTC by Akira TAGOH
Modified: 2012-04-17 02:49 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Akira TAGOH 2010-07-07 23:17:17 UTC
I'm not quite sure if this is really a bug or a feature. so please close if it's inappropriate.

I'm trying following rule for testing:
<match>
  <test name="lang">
    <string>ja</string>
  </test>
  <edit name="family" mode="append">
    <string>bogus fonts</string>
  </edit>
</match>

with the pattern of :lang=en. let's see how fontconfig processes it:

$ FC_DEBUG=4 fc-match :lang=en
...
Add Subst match
        pattern any lang Equal "ja"
edit
        Edit family Append "bogus fonts";
...
FcConfigSubstitute Pattern has 1 elts (size 16)
        lang: en(s)
...
FcConfigSubstitute test pattern any lang Equal "ja"
Substitute match
        pattern any lang Equal "ja"
edit
        Edit family Append "bogus fonts";

Append list before  [snip] "monospace"(w)
Append list after  [snip] "monospace"(w) "bogus fonts"(w)
FcConfigSubstitute editPattern has 2 elts (size 16)
        family: [snip] "monospace"(w) "bogus fonts"(w)
        lang: en(s)

This behaviour looks weird to me. lang "en" should not be EQUAL to lang "ja".
Comment 1 Behdad Esfahbod 2010-09-21 10:30:37 UTC
I'm guessing that you have other config files around that are adding 'ja' to lang.
Comment 2 Akira TAGOH 2010-09-27 03:43:43 UTC
(In reply to comment #1)
> I'm guessing that you have other config files around that are adding 'ja' to
> lang.

for "bogus fonts"?, no. it's just a testcase and not expecting how it looks like on the applications, but wanted to make a minimal testcase that looks similar on the debugging log. so I did exactly write "bogus fonts" as a font name like the above example. not having anything else rules for "bogus fonts".
Comment 3 Akira TAGOH 2010-12-05 21:53:42 UTC
I've tracked this issue down. the lang wasn't set in FcLangSetPromote() due to the invalid map_size. it has to be initialized anyway.

the proposed one-line patch is here:
http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz28958&id=5759eafcf5cb9cc5b69317f26d2e930ff54ee60c
Comment 4 Behdad Esfahbod 2010-12-07 15:51:01 UTC
Doh!  Thanks.  Fixed!
Comment 5 Akira TAGOH 2012-04-17 02:49:12 UTC
*** Bug 25670 has been marked as a duplicate of this bug. ***


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.