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

lolilolicon lolilolicon at gmail.com
Mon Jan 16 03:36:53 PST 2012


Resending reply to list.  Sorry about the noise!


---------- Forwarded message ----------
From: lolilolicon <lolilolicon at gmail.com>
Date: Mon, Jan 16, 2012 at 4:48 PM
Subject: Re: [Fontconfig] Problem when <alias> is followed by more
than one <family>
To: Akira TAGOH <akira at tagoh.org>


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.

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.

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"

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.


More information about the Fontconfig mailing list