[Fontconfig] <alias> replace dejavu sans with Verdana

Chris Jones cjns1989 at gmail.com
Tue Sep 22 15:44:24 PDT 2009


I’m getting an ugly font in mozilla browsers instead of Verdana.

The font is hard-coded in the html source, which makes customization via
the ~/../profile/../userChrome.css ineffective.

Since mozilla browsers “obtain” their fonts from fontconfig, I thought
that I could code the following in /etc/local.conf:

<match target="pattern">
        <test name="preferred">
                <bool>true</bool>
        </test>
        <test name="family">
                <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
                <string>Verdana</string>
        </edit>
</match>

<match target="pattern">
        <edit name="preferred">
                <bool>true</bool>
        </edit>
</match>

What I’m trying to do is tell fontconfig that any application that asks
for “sans-serif” is directed to “verdana” instead.

Mind you, this must be one of about fifty different versions that I
coded with endless variations on the name of the font that I wanted to
replace and that I wanted instead, and made any difference:

Whatever I coded, “fc_match -v sans”- or sans-serif, sans\-serif, or
"sans-serif", or 'sans', or 'sans-serif', or dejavu, dejavu sans,
"dejavu sans", "DejaVu Sans", "Dejavu\ Sans", 'Dejavu Sans', 'Dejavu\
Sans', 'dejavu', 'DejaVu', "DejaVu", etc. etc.… systematically pointed
to the DejaVu Sans font.

Obviously, each unsuccessful attempt was followed by an “fc-cache -r”,
that completed without any errors.

I even rebooted in case fc-cache does not suffice, to no avail. :-(

Am I misunderstanding fc-match?

Having spent about a week trying to get this to work, read the
fonts.conf man page about ten times, googled for a fontconfig tutorial
and found nothing, read many threads that discussed this issue, I’m
beginning to think I am missing something trivial, but I have no idea
why this is not working.

In a nutshell, I just want any application that asks for “sans-serif”,
to be redirected to “verdana” instead.

Or am I barking the wrong tree - i.e. the above has nothing to do with
what I’m trying to achieve and maybe fontconfig does not provide this
capability?

Is there anything I can do, short of removing the DejaVu fonts from my
system¹?

Thanks,

CJ

¹ Which would probably not address the issue anyway, sans-serif would
  just switch to another ugly font and I’d be back to square one.






More information about the Fontconfig mailing list