[Fontconfig] Catching sans-serif fonts

Raimund Steger rs at mytum.de
Sun Apr 1 02:24:23 PDT 2012


ben.guillon wrote:
> Hi,
> I'm trying to use the fc commands in order to have a list of fonts that
> are sans-serif fonts, or monospaced fonts. I've found that for
> monospaced font the command 'fc-list ":spacing=mono" family' does the
> trick, but i've no idea about how to select sans-serif fonts.
> What I don't understand is that there's already a mechanism in font
> config files to associate a generic family like sans-serif alias to
> actual fonts.

That mechanism doesn't use a font property, but expands "sans" etc. to a 
list of well-known alternatives, which is then matched against what you 
actually have on your system.

Generally if you do

   fc-match --sort sans-serif
   fc-match --sort serif

the sans-serif or serif fonts will come out first, but I don't think 
there's any guarantee about what the fonts at the end of the list will 
look like.


More information about the Fontconfig mailing list