Tuesday, August 30, 2011

How to install fonts in Linux – Ubuntu, Debian

How to install fonts in Linux – Ubuntu, Debian

Ubuntu Linux searches for fonts in specific locations as listed in the /etc/fonts/fonts.conf file.
A look at the contents of /etc/fonts/fonts.conf file indicates the following directories which are searched by Ubuntu Linux for fonts. They are :
  1. /usr/share/fonts
  2. /usr/share/X11/fonts
  3. /usr/local/share/fonts
  4. ~/.fonts
So if you want to install new fonts in Ubuntu Linux or Debian for that matter, you can copy the fonts to any one of the 4 directories listed above.

The last directory ~/.fonts is a local hidden directory in every user’s  Home folder. If you install the new fonts in this directory, the fonts will be available only for the person logged into that particular user account.

If you want your new fonts to be available system wide, to all users, then you should install them in any one of the first three directories listed above.

Once all your fonts are copied to the specific font directories, you have to make Ubuntu Linux aware of the new fonts so that it can make use of them. This is done by running the following command in the console :

$ sudo fc-cache -f -v
 
Please note that you have to have super user powers to run this command. In Debian Linux, it means you have to be logged in as root user.

What the fc-cache command does is, it reads and caches all the fonts installed in the font directories. You have to run this command each time you install any new fonts in Linux.

0 Comments: