Bug 22862

Summary: <alias> ignores <match> <test>s
Product: fontconfig Reporter: Baybal <nikulinpi>
Component: confAssignee: Akira TAGOH <akira>
Status: RESOLVED FIXED QA Contact: Behdad Esfahbod <freedesktop>
Severity: major    
Priority: high CC: akira, fontconfig-bugs, freedesktop
Version: 2.6   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Bugged file
New .fonts.conf

Description Baybal 2009-07-20 14:59:29 UTC
Created attachment 27862 [details]
Bugged file

FC 2.7 ignores lang test in ~/.fonts.conf and strongbinds first <edit> see attachment
Comment 1 Behdad Esfahbod 2009-07-20 15:29:50 UTC
How is the attachment supposed to show the bug!?
Comment 2 Behdad Esfahbod 2009-07-22 05:32:27 UTC
He sent me this note:

"If you setup the attachment as your ~/.fonts.conf you would see font from the first match tag being set as default sans-serif for every language, omiting lang test condition."
Comment 3 Behdad Esfahbod 2009-08-26 11:06:49 UTC
Unless you attach a much shorter conf file that I can verify, I assume there's a bug in your conf file.
Comment 4 Baybal 2009-08-26 19:58:19 UTC
Created attachment 28941 [details]
New .fonts.conf
Comment 5 Behdad Esfahbod 2009-08-26 20:14:53 UTC
For starter, the match should target="pattern", not target="font".
Comment 6 Baybal 2009-08-26 20:54:25 UTC
Same results
Comment 7 Behdad Esfahbod 2009-08-27 11:21:30 UTC
Ok, I found the bug.  Currently <alias> doesn't work inside tests.  <alias> is a syntactic sugar though, if you use the full form, it works:

<match target="pattern">
        <test name="lang">
                <string>ja</string>
        </test>
        <test name="family"><string>sans-serif</string></test>
        <edit name="family" mode="prepend"><string>MS Mincho</string></edit>
</match>

I'll fix the alias later.  Thanks for your patience.
Comment 8 Baybal 2009-11-27 23:40:31 UTC
Would we have syntactic sugar by the next release?
Comment 9 Behdad Esfahbod 2009-11-30 13:16:43 UTC
I don't get to work on this until January.  Needs a bit of restructuring of the internal code that I'm not really comfortable with right now.
Comment 10 Akira TAGOH 2012-04-03 22:51:47 UTC
proposed fix:
http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz22862

I guess that may be much better if we use the reference counted objects for FcTest and FcExpr as well as FcSharedStr perhaps.
Comment 11 Akira TAGOH 2012-04-05 19:20:24 UTC
simplified patch and merged in ddefa502.

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.