[Fontconfig] Please clarify matching rules

Colin Caine colin.caine at manchester.ac.uk
Thu Aug 3 10:44:29 UTC 2017


I'm trying to understand how fontconfig decides what to return for a
given pattern. I've read a fair chunk of the user documentation at [1],
but I don't think it's complete enough.

I've got a simple set up: a clean install of arch-linux + fontconfig,
noto-fonts.

I would like `fc-match monospace` to give "Noto Mono". I currently only
have Noto {Mono,Sans,Serif} and some pixel fonts installed. So I'm
expecting `fc-match monospace` to receive "Noto Mono" or one of the
pixel fonts. But what I actually get is "Noto Sans".

So I add:


    <alias>
      <family>Noto Mono</family>
      <default>
        <family>monospace</family>
      </default>
    </alias>


But I still get Sans. I've tried with 'binding="same"' and with <accept>
instead of <default> with no succuess. I've also tried after deleting
all the other fontconfig .conf files and only setting the above.

Can I get fontconfig to pick Noto Mono without forcing it with <prefer>?

I would like to avoid <prefer> because if a user prefers a very
different font, and something needs extra glyphs, I want font-config to
pick a donor font based on its own logic.

As it happens, font-config looks to be pretty poor at picking sensible
donor fonts for glyphs in my use case, so maybe I shouldn't be too
worried about that (if I install DejaVu Sans, disable its configs, and
then `fc-match "Noto Sans" -s`, I get Noto Sans, then DejaVu Sans, then
the Noto Sans variants). I would appreciate insight into why this is so.

[1]: https://www.freedesktop.org/software/fontconfig/fontconfig-user.html


More information about the Fontconfig mailing list