How to Determine Which Font File is Chosen for a System Generic Font Alias

fontconfigfonts

In Fedora 22, in KDE (plasma) System Settings -> Font -> Fonts, the setting for "General" is "Sans Serif 10", for "Fixed width" is "Monospace 10", for "small" is "Sans Serif 8", for "Toolbar" is "Sans Serif 9", for "Menu" is "Sans Serif 10", and for "Window title" is "OxygenSans 10".

How can I figure out which font file is being used for the generic "Monospace" alias? (I'm sure I can follow the same procedure to figure out Sans Serif.)

fc-list shows 30 files, but fc-list | grep -I monospace shows nothing. ("Monospace" must be an alias, and isn't the name of an actual font.)

fc-match --all shows 30 files, but likewise, fc-match | grep -I monospace shows nothing.

ls -la ~/.config | grep font shows nothing. (No ~/.config/fontconfig)

/etc/fonts/fonts.conf lists font directories, accepts deprecated aliases, and points to /etc/fonts/conf.d.

/etc/fonts/conf.d/60-latin.conf is an XML file with element alias, with child family ("monospace") and prefer families ("Bitstream Vera Sans Mono", "DejaVu Sans Mono", "Incolsolata", "Andale Mono", "Courier New", "Cumberland AMT", "Luxi Mono", "Nimbus Mono L", Nimbus Mono", and "Courier").

/etc/fonts/conf.d/61-oxygen-mono.conf has child family ("monospace") and prefer family ("Oxygen Mono").

/etc/fonts/conf.d/69-gnu-free-mono has child family ("monospace") and prefer family ("FreeMono").

/etc/fonts/conf.d/69-unifont.conf has child family ("monospace") and prefer family ("FreeMono").

Now, in this case, the only prefer family quoted above that is installed is "Oxygen Mono" (in OxygenMono-Regular.ttf), so the system must be using that font.

But, what if some of the other prefer families were installed?

Isn't there a simple command that lets you see what a generic system alias like "Monospace" is mapped to? I only see fc-{cache, cat, list, match, pattern, query, scan, and validate} on my system, and the only two that looks like they might perform this (list, match) don't seem to have this feature.

Best Answer

fc-match is the utility to use. For example, fc-match monospace will tell you the font used for monospace, and fc-match -s monospace will tell you fallback fonts as well, in order. The first font on the list will be what is used in most cases, and all fonts after are fallback fonts for missing glyphs.

Related Question