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

Raimund Steger rs at mytum.de
Wed Dec 12 14:31:29 PST 2012


Wendell P wrote:
> [...]
> Is it possible to make settings for specific applications in
> ~/.fonts.conf? If so, what is the syntax? For example, how would I
> change this to apply only to a specific app?
>
> <?xml version='1.0'?>
> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
> <fontconfig>
>    <match target="font">
>      <edit mode="assign" name="antialias"><bool>false</bool></edit>
>    </match>
> </fontconfig>

In addition to all the other suggestions you already got:

(1) sometimes it's easier to just provide virtual family names that you 
only use in some applications. E. g. I have in my config file:

   <match target="pattern">
     <test name="family"><string>HG-PGothicB-Sun-AA</string></test>
     <edit mode="assign" name="family">
       <string>HG-PGothicB-Sun</string>
     </edit>
     <edit mode="assign" name="antialias">
       <bool>true</bool>
     </edit>
     <edit mode="assign" name="prefer_bitmap">
       <bool>false</bool>
     </edit>
   </match>

...which means if I use "HG-PGothicB-Sun-AA" in an application, I get 
the font with anti-aliasing turned on, while if I use "HG-PGothicB-Sun" 
I would get it without anti-aliasing (which is the default in my 
configuration because of other rules). This would work the other way 
around as well, i. e. by disabling AA if it defaults to "on".

(2) you can set the environment variable FONTCONFIG_FILE to override 
your (/etc/fonts/fonts.conf) configuration file for individual apps, but 
in this case you'd have to repeat the system configuration in that file.

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