Linux

How do I install and use fonts in Linux?

Jack Wallen shows you how to install True Type fonts on your Fedora or Ubuntu Linux machine and how to make key applications (such as OpenOffice and Scribus) aware of those fonts.

If you are a graphic artist, writer, designer, or desktop publisher, then you are likely to need specific fonts installed on your computer. For Linux users this used to be a more difficult task. The good news is that more modern distributions make font installation much easier. Gone are the days of editing your xorg.conf font path information.

Installing fonts in Ubuntu

Once you have your handy collection of True Type fonts, you are going to want to create a directory to hold them. Installing the fonts system-wide will give all users access to them. First, create a font directory in /usr/share/fonts/truetype. Call this directory newfonts. Issue the command sudo mkdir /usr/share/fonts/truetype/newfonts. You will have to enter your sudo password to complete this task.

Once this directory is created, place all your *ttf or *TTF files in the newfonts directory. With the fonts in place you will then need to issue the command fc-cache -f -v to make the system aware of the new fonts. Once this is done, the system knows about the new fonts and all the system users will have access to them.

If you want to make these fonts available only to specific users, then you will follow the same directions except you will add the fonts only to the users' ~/.fonts directory. If the ~/.fonts directory doesn't exist, create it with mkdir ~/.fonts (while logged into the specific users' accounts). Now move (or copy) all of the *ttf and/or *TTF files into the new directory and run fc-cache -f -v to make the users' accounts aware of the fonts.

If you have a single-user machine, go with the latter version.

Installing fonts in Fedora 7 (or higher)

Installing fonts in Fedora is a simpler task. You really only need to dump your *ttf or *TTF files into the user's ~/.fonts directory, log out, and log back in. The fonts will be recognized without any special tricks.

Installing MS Fonts

There are many times you will want Microsoft fonts on your system. Fortunately this is only a matter of installing the msttcorefonts package. This is done one of two ways:

on an apt-based machine:

apt-get install msttcorefonts

on a yum based machine:

wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec

yum install rpm-build cabextract

rpmbuild -ba msttcorefonts-2.0-1.spec

yum localinstall --nogpgcheck /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
Both of the above instructions will complete the job for you. The former command will require you to OK the process (see Figure A below.)

Figure A

This installation will prompt you to install x-ttcidfont-conf also, which is not necessary, but will add even more fonts to your system.

Getting applications to recognize your new fonts

  • OpenOffice: This one is a piece of cake. If you have installed the fonts into ~/.fonts and issued the command fc-cache -f -v, OpenOffice will be able to take advantage of them.
  • Gimp: The Gimp enjoys the same ease of use as OpenOffice.
  • Scribus: With Scribus you have to actually configure the new font path. To do this go to File | Preferences and you will see the Font icon (see Figure B below.)

Figure B

From here you configure all aspects of the Scribus desktop publishing application.

Click on the Fonts icon and then click on the Additional Paths tab (see Figure C below.)

Figure C

Click on Add and then navigate to your new font path to add the new path.

You will notice that when you click Add to add the new path, the .fonts directory doesn't show up. That is because it is a hidden directory. You will have to type in .fonts in the directory text area and click OK in order to add the hidden directory.

GNOME/KDE: Both GNOME and KDE will automatically make use of the fonts that are placed in the ~/.fonts directory. You will have to go to each environment's control panel where you can configure each to use various fonts for each element of the desktop.

Gotchas

I have, on a number of occasions, taken my collection of fonts (which is rather large) and placed them all into my ~/.fonts directory only to find out that one of those fonts was being used by Firefox as the default font. In some instances, this turned out to be not so great as the "replacement" font was not a font that should be used to view Web pages. It took me a long time to find the offending font and I now know to never add that particular font to my ~/.fonts directory. I honestly have no idea why this happened. If Firefox suddenly starts rendering pages with a rather funky font, you will have to dig through your font collection, find the offending font, and remove it from the directory.

Another gotcha: With Scribus and The Gimp, the more fonts you add, the longer it will take for the applications to start up. So if your collection is reaching into the thousands, expect those applications to take a moment to start.

All in all, adding fonts to Linux is far easier than it once was. You shouldn't have to manually edit X configuration files. With a more Windows-like approach to adding fonts, working with Linux in areas such as graphics or desktop publishing is no longer a chore.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

0 comments

Editor's Picks