14

Question-1: Is there a way to know what all fonts are installed on the CentOS 6.2 through command-line?

I have checked the fonts with the following command

ls /usr/share/fonts/default/ghostscript/ and have got the following results:

bchb.afm   bchri.afm  fcyri.afm  fkarw.pfm    hrgero.gsf  hrgrro.gsf  hrpldb.gsf   hrplrbo.gsf  hrpls.gsf    hrplt.pfa   hrscso.gsf  putri.pfa     u004006t.afm
bchbi.afm  bchri.pfa  fcyri.gsf  fonts.dir    hrger.pfa   hrgrr.pfa   hrpldbi.gsf  hrplr.gsf    hrplso.gsf   hrsccb.gsf  hrscs.pfa   putr.pfa      u004006t.gsf
bchbi.pfa  bchr.pfa   fhirw.gsf  fonts.scale  hrgkc.gsf   hritrb.gsf  hrpldi.pfa   hrplro.gsf   hrpltb.gsf   hrscco.gsf  hrsyr.gsf   u003043t.afm  u004006t.pfm
bchb.pfa   fcyr.afm   fhirw.pfm  hrgerb.gsf   hrgks.gsf   hritro.gsf  hrpld.pfa    hrplsb.gsf   hrpltbi.gsf  hrscc.pfa   putbi.pfa   u003043t.gsf
bchr.afm   fcyr.gsf   fkarw.gsf  hrgerd.gsf   hrgrrb.gsf  hritr.pfa   hrplrb.gsf   hrplsbo.gsf  hrplti.pfa   hrscsb.gsf  putb.pfa    u003043t.pfm

and similar results I have got from running ls /usr/share/fonts/default/Type1 but I am not able to make out what kind font files are these (I know about .ttf, .otn and .fnt) and what all fonts does it contain like "courier new", "times new roman" etc.

Also there are other directories which have fonts:

ls /usr/share/fonts/opensymbol/ has opens___.ttf
ls /usr/share/fonts/dejavu/ has

DejaVuSans-BoldOblique.ttf           DejaVuSansCondensed.ttf         DejaVuSansMono.ttf          DejaVuSerifCondensed-BoldItalic.ttf  DejaVuSerif.ttf
DejaVuSans-Bold.ttf                  DejaVuSans-ExtraLight.ttf       DejaVuSans-Oblique.ttf      DejaVuSerifCondensed-Bold.ttf
DejaVuSansCondensed-BoldOblique.ttf  DejaVuSansMono-BoldOblique.ttf  DejaVuSans.ttf              DejaVuSerifCondensed-Italic.ttf
DejaVuSansCondensed-Bold.ttf         DejaVuSansMono-Bold.ttf         DejaVuSerif-BoldItalic.ttf  DejaVuSerifCondensed.ttf
DejaVuSansCondensed-Oblique.ttf      DejaVuSansMono-Oblique.ttf      DejaVuSerif-Bold.ttf        DejaVuSerif-Italic.ttf

Question-2:: Are there other directories for fonts and are these fonts installed on my system?

Question-3: Also is there a way to check if a particular font is installed on the system, for eg: I want to see whether Courier New is installed on my system or not.

Any help would be appreciated.
Thanks

4 Answers 4

27

As for question one, fc-list gives you all fonts.

${HOME}/.fonts will contain additional fonts for your user.

fc-list | grep "Courier New" allows you to check if that particular font is installed.

2
  • sorry to sound naive but what path would be {HOME}?
    – Prakash K
    Jul 30, 2013 at 8:58
  • 1
    ${HOME} is your home directory, you can check it using: echo ${HOME} in terminal. It might be such path like: /home/username
    – rwxrwxrwx
    Jul 30, 2013 at 9:03
4

Besides

# fc-list

You can find all true type fonts in your disk with find: (caution: it can take long time to process)

# find / -type f -name "*.ttf"
3

There is a command xlsfonts to list all fonts available in X.

2
  • doesn't work: -bash: xlsfonts: command not found
    – Prakash K
    Jul 30, 2013 at 8:56
  • 2
    @PrakashK: you may need to install x11-utils package Jul 30, 2013 at 11:05
3

you can also try with python. For example using matplotlib:

python -c 'import matplotlib.font_manager; print "\n".join(matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext="ttf"))'

on my linux it gives me output like:

/usr/share/fonts/truetype/kacst/KacstTitle.ttf
/usr/share/fonts/truetype/tlwg/TlwgTypo-Oblique.ttf
/usr/share/fonts/truetype/ttf-indic-fonts-core/Malige-b.ttf
/usr/share/fonts/truetype/msttcorefonts/verdanab.ttf
/usr/share/fonts/truetype/tlwg/Umpush.ttf
/usr/share/fonts/truetype/horai-umefont/ume-tgo5.ttf
/usr/share/fonts/truetype/tlwg/Garuda-Bold.ttf
...

UPDATE: Ofcourse you need python-matplotlib package for that. Try with yum, if not found , you can install it via pip or easy install, so:

sudo yum install python-matplotlib

or

pip install matplotlib

or

easy_install matplotlib
2
  • Doesn't work: ImportError: No module named matplotlib.font_manager I think I would have to install the module
    – Prakash K
    Jul 30, 2013 at 8:57
  • @PrakashK: see update Jul 30, 2013 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .