Le dimanche 20 novembre 2005 à 01:11 +0000, Dave Mitchell a écrit :
On Sun, Nov 20, 2005 at 01:55:47AM +0100, Nicolas Mailhot wrote:
> Le samedi 19 novembre 2005 à 22:59 +0000, Dave Mitchell a écrit :
>
> > This is a bit hand-wavy because I'm not familiar with the font.conf
> > schema, but for example
> >
> > substitute name=family /mono/ "monospace"
>
> Perfect example of subtle flat-file syntax no one can understand without
> the man page under its eyes. Push a few more lines like this, each with
> its own rules hidden in magic characters like /, and you get something
> pretty much impossible to administer (let alone write a robust parser
> for)
And you'd be able to understand the XML version without having the
"part of the schema for font name substitutions within font.conf" manual
in front of you?
Yes, I can understand that :
<match target="pattern">
<test qual="any" name="family">
<string>mono</string>
</test>
<edit name="family" mode="assign">
<string>monospace</string>
</edit>
</match>
means
« For a font which got the string mono in its family metadata field
(qual="any" is not defined but I'd guess any means as global as you can)
assign the string monospace as the family field »
And this is only by reading the xml tags (pattern with test + associated
action), without going into the schema or anywhere else. Of course you
need to know beforehand fonts declare metadata, which include "family".
In your example I have to guess the second field is a pattern, the third
is the substitution, it does not permit changing one field based on
another, you've used space as separator which will bite you later, etc
etc.
XML is good for text markup. It's really crap for anything else.
(IMHO of course).
Except configuration files need to be readable and explicit tags are way
better than magic "//" expressions for this (or implicit arguments based
on ordering)
Regards,
--
Nicolas Mailhot