[Fontconfig] Per application settings in .fonts.conf?

Raimund Steger rs at mytum.de
Thu Dec 13 01:05:55 PST 2012


Wendell P wrote:
> On Wed, Dec 12, 2012, at 02:31 PM, Raimund Steger wrote:
>> (1) sometimes it's easier to just provide virtual family names that you
>> only use in some applications.
>
> I tried this approach on my system, but it didn't work. Did I make an
> error?
>
> On Debian Wheezy, here is the ~/.fonts.conf. I intended to have
> antialiasing on by default, but off when "Monospace" font is chosen.
>
> --------------------------------------------------------------------------------------
> <?xml version='1.0'?>
> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
> <fontconfig>
>    <match target="font">
>      <edit mode="assign" name="rgba"><const>rgb</const></edit>
>      <edit mode="assign" name="embeddedbitmap"><bool>true</bool></edit>
>      <edit mode="assign" name="autohint"><bool>false</bool></edit>
>      <edit mode="assign" name="hinting"><bool>true</bool></edit>
>      <edit mode="assign" name="antialias"><bool>true</bool></edit>
>      <edit mode="assign"
>      name="lcdfilter"><const>lcddefault</const></edit>
>      <edit mode="assign" name="hintstyle"><const>hintfull</const></edit>
>    </match>
>
>    <match target="pattern">
>      <test name="family"><string>Monospace</string></test>
>      <edit mode="assign" name="antialias"><bool>false</bool></edit>
>    </match>
>
> </fontconfig>
> --------------------------------------------------------------------------------------
>

At first glance it looks like you assign antialias=true with a 
target="font" rule. This is applied later than any target="pattern" 
rule. (fontconfig first substitutes the pattern from the application 
according to target="pattern" rules, then picks a font (**), and then 
modifies that font according to target="font" rules.)

This could be fixed by putting the antialias=true edit (or the whole 
upper block) in a target="pattern" rule, above the antialias=false rule. 
But note that this might give you different match results (but normally 
this is negligible) because some properties might also be used in the 
match (**).

Raimund





-- 
Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
+49-179-2981632 icq 16845346           work: <rs at interface-ag.de>


More information about the Fontconfig mailing list