[Fontconfig] Rejecting and accepting fonts

Donn Ingle donn.ingle at gmail.com
Tue Nov 14 10:59:54 UTC 2017

 I have been fiddling with fontconfig with the aim of rejecting fonts by
glob, and then accepting a small sub-set. (*See end of post for why.)

I can't get the voodoo right. After a rejectfont glob on
"/usr/share/fonts/*", no amount of "acceptfont" seems to work.

What I have found that *does* work is this strategy:

1. I reject all like this:

The reject file in ~/.config/fontconfig/conf.d/1.killemall.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

2. I then place soft links to a few "standard" fonts in
~/.local/share/fonts, (user fonts dir) say:
cd ~/.local/share/fonts
ln -s /usr/share/fonts/truetype/freefont/FreeSans.ttf .

Now FreeSans shows along with whatever other fonts I have in my user fonts
dir, when I use fc-list

Done. I think...?

My thinking is that I can keep a small pack of typical fonts like DejaVu,
FreeXXX, LiberationXXX, UbuntXXX around so that apps don't crash.

1. Is this a valid strategy to reject/accept, or is it a bug in fontconfig?
(Allowing ln -s paths through a reject glob. It seems like it's not a bug,
but I don't know if it's intentional.)

2. Is there a better/safer way to do this all in the XML files?

3. What "system" fonts are essential to keep gui apps from failing? I
realize this is a complex question because of the vast range of locales and
distros. Is there some informal list of fonts which one should never reject?
(In the end, I am going to leave this up to the user - they will choose the
fonts that must never be rejected.)


* Why: I am aiming for a way to cut down on the crazy font clutter on my
system. I can't use Inkscape or Gimp effectively when there are hundreds of
font names in the choosers. I want a way to filter them out while I work.
(They'd come back after by some toggle.) That's the plan.

I posted here about a month ago. Jerry Casiano's posts got me to where I am
now. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20171114/21213a69/attachment.html>

More information about the Fontconfig mailing list