When I run
fc-mach Sans, it returns
DejaVuSans.ttf: "DejaVu Sans" "Book" but if it is run like
fc-match "Sans " or
fc-match "Sans 9" it returns
unifont.ttf: "unifont" "Medium". I prefer to always use DejaVu Sans but I can't figure out why fontconfig selects unifont. Neither the global nor the local config seems to mention unifont (
grep -ri unifont /etc/fonts/ ~/.fonts.conf returns nothing). Playing with LC_DEBUG didn't help me either. Is there a way to get the information why fontconfig behaves like this?
When I run
On a quick glance it looks like a genuine fontconfig bug to me, since it works properly here and I do have both DejaVu and Unifont installed:
But, on a closer look, we can see some more details. There still may be a fontconfig bug somewhere, but
The man page
Upon which you can simply say "screw you" and add another search on top of it to get matching the way you expect it:
But, your question is about how exactly it does the matching.
FontConfig matched attributes based on the "distance" from the match criteria. If you want to see what is going on behind the scenes, then set the environment variable FC_DEBUG=3 and rerun your search. This will show debugging information that might be helpful. You shouldn't need to read FontConfig code.