[Fontconfig] Catching sans-serif fonts

ben.guillon ben.guillon at gmail.com
Sun Apr 1 09:22:21 PDT 2012


Hi,

On Sun, 01 Apr 2012 11:24:23 +0200, Raimund Steger <rs at mytum.de> wrote:

>> 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.
>
> 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.

Thanks for your explanation. It's strange because the command gives  
something, but not all the fonts aliasing sans-serif defined in  
/etc/fonts/conf.avail are listed:

For example "Liberation Sans" is installed:

$ fc-list | grep "Liberation Sans"
Liberation Sans:style=Regular
Liberation Sans:style=Bold
Liberation Sans:style=Bold Italic
Liberation Sans:style=Italic

This font is put in the sans-serif generic family group thanks to the  
/etc/fonts/conf.avail/45-latin.conf:

<!--
   Sans-serif faces
  -->
	<alias>
		<family>Bitstream Vera Sans</family>
		<family>DejaVu Sans</family>
		<family>Liberation Sans</family>
		<family>Arial</family>
		<family>Helvetica</family>
		<family>Verdana</family>
		<family>Albany AMT</family>
		<family>Albany</family>
		<family>Nimbus Sans L</family>
		<family>Luxi Sans</family>
		<default><family>sans-serif</family></default>
	</alias>

But it is not listed by fc-match:

$ fc-match --sort sans-serif|grep "Liberation Sans"

That gives nothing.

Any idea how it works?

Thanks,
BG


More information about the Fontconfig mailing list