[Fontconfig] Problem when <alias> is followed by more than one <family>

Akira TAGOH akira at tagoh.org
Mon Jan 16 01:24:39 PST 2012

I'm assuming that the document is always true to explain the behavior.
IMHO that would be good to discuss changing it as long as it less
affects for existing applications though.

On Mon, Jan 16, 2012 at 5:48 PM, lolilolicon <lolilolicon at gmail.com> wrote:
> On Mon, Jan 16, 2012 at 10:00 AM, Akira TAGOH <akira at tagoh.org> wrote:
>> See the document. <alias> allows to have only one <family>
> Yes, that's what I thought at first.  But then, I find it's not true that
> <alias> can have only one family, with several clues:
> First, the configs shipped with fontconfig have <alias> followed by a
> bunch of <family> elements, namely 30-metric-aliases.conf,
> 40-nonlatin.conf and 45-latin.conf.  I thought it's wrong configuration,
> but now I realize it's not that simple.

I suppose it's a bug for the config in fontconfig. please file a bug then.

> Second, I tested with the equivalent <match> rules:
>   <match>
>    <test name="family">
>      <string>Helvetica</string>
>      <string>Arial</string>
>    </test>
>    <edit name="family" mode="prepend" binding="same">
>       <string>HelveticaNeueLT Pro 55 Roman</string>
>    </edit>
>   </match>
> and I get exactly the same results as before.

I'm not sure what this "before" points to, given that it doesn't work
as you expected as in the original mail, this is also correct behavior
and also documented.  see also a comment in

> Third, I've tested that <family> following <alias> are all somehow taken
> into account:
>  <alias binding="same">
>    <family>Helvetica</family>
>    <family>Arial</family>
>    <family>lolfont</family>
>    <prefer>
>      <family>Helvetica LT Std</family>
>    </prefer>
>  </alias>
> The "lolfont" is not a real font name, and I get the result:
>  $ fc-match Helvetica
>  HelveticaLTStd-Roman.otf: "Helvetica LT Std" "Roman"
>  $ fc-match Arial
>  arial.ttf: "Arial" "Normal"
>  $ fc-match lolfont
>  HelveticaLTStd-Roman.otf: "Helvetica LT Std" "Roman"

That may depends on the priority of the "Helbetica LT Std". though
these seems some bugs in fontconfig to deal with <alias>. it may be
one of them.

> This makes me believe that <alias> can have one or more <family> elements,
> and is equivalent to the corresponding <match> rules like the one above,
> but somehow the first one following the opening <alias> or <test> is
> treated differently from the others, i.e. order matters...  This is where
> I'm really confused.
>> and one of <prefer>, <accept> or <default>. the behavior is surely
>> following what the document says.
> No, the document says the <family> element can be "followed optional
> <prefer>, <accept> and <default> elements", not "one of" them.  I'm
> referring to the fonts-conf(5) man page and fonts.dtd.

Sure. though it doesn't take any effects without any of them.


More information about the Fontconfig mailing list