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. How can I do that with command lines? Regards, BG
Hi, 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. Raimund
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
Hi, ben.guillon wrote:> 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>I believe this rule works the other way round (matches what''s in <family>, not in <default>). Other examples are in 60-latin.conf. If you insert Liberation Sans there in the <prefer> list for the sans-serif alias, the position of Liberation Sans in the sorted list should go up. But on my system, the pruning done by --sort (which apparently corresponds to the ''trim'' argument of FcFontSort(3)) weeds out Liberation Sans; --all however should include it in any case. So, ''fc-match --all sans-serif|nl|grep Liberation\ Sans'' should give you lower line numbers when you adjust 60-latin.conf. Raimund
On Sun, 01 Apr 2012 20:02:17 +0200, Raimund Steger <rs at mytum.de> wrote:> Hi, > > ben.guillon wrote: >> This font is put in the sans-serif generic family group thanks to the >> /etc/fonts/conf.avail/45-latin.conf: > > I believe this rule works the other way round (matches what''s in > <family>, not in <default>). > > Other examples are in 60-latin.conf. If you insert Liberation Sans there > in the <prefer> list for the sans-serif alias, the position of > Liberation Sans in the sorted list should go up. > > But on my system, the pruning done by --sort (which apparently > corresponds to the ''trim'' argument of FcFontSort(3)) weeds out > Liberation Sans; --all however should include it in any case. > > So, ''fc-match --all sans-serif|nl|grep Liberation\ Sans'' should give you > lower line numbers when you adjust 60-latin.conf.Thanks much for your replies, I begin to understand how things work. Regards, BG