[Fontconfig] target pattern or font?

Raimund Steger rs at mytum.de
Mon Jul 28 12:13:09 PDT 2014

BubuXP wrote:
> I'm trying to understand the difference between <match target="pattern">
> and <match target="font">:
> == If 'target' is set to "font" instead of the default "pattern", then
> this element applies to the font name resulting from a match rather than
> a font pattern to be matched. ==
> It should be a clear statement but probably my english (or better my
> head) is not good enough to understand. Some examples could help me.
> Reading further in the fontconfig official documentation I found this in
> an example user-configuration file:
> <!-- use rgb sub-pixel ordering to improve glyph appearance
> on LCD screens.  Changes affecting rendering, but not
> matching should always use target="font". -->
> <match target="font">
> <edit name="rgba" mode="assign"><const>rgb</const></edit>
> </match>
> Is that statement valid only for normal users configurations? Because
> the system-wide configuration for the same setting (you can found it in
> conf.avail/) uses target="pattern".
> When one should use "pattern" and when "font"?

In the above example both target="pattern" as well as target="font" 
should work, because the property is propagated to the font after 
matching (which is useful because it allows specifying such options as 
part of the Xft font name).

This would be different if:

(1) you're trying to enable the property for individual fonts only (by 
family name) -- in this case target="pattern" doesn't make sense because 
patterns contain a list of family names, hence you won't hit the right one;

(2) you're trying to control a property that is used to calculate the 
score in the matcher, because that would influence your matching result 
(e. g. "antialias", which would result in an altered priority for 
non-scalable fonts if it's already set in the matcher stage).

So if all you want to do is assign "rgba" to all fonts regardless of 
family, both approaches should really produce equivalent results.


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