You are here

Install new fonts

Uditha Atukorala's picture

These steps are tested in Debian Lenny (Testing) and should work with any Linux installation.

1 - Linux Font Path
In Linux, the default system font path is /usr/share/fonts.
$ ls -l /usr/share/fonts/
total 12
drwxr-xr-x 8 root root 4096 2008-05-17 10:46 truetype
drwxr-xr-x 3 root root 4096 2008-03-07 17:56 type1
drwxr-xr-x 8 root root 4096 2008-03-07 17:59 X11

All these directories in /usr/share/fonts are used to organize the different types of fonts.

2 - Install fonts
Simply you can copy your new font file to the relevant directory and that should install the font for you.
e.g: If you want to install a new true-type font, you can copy the *.ttf file to /usr/share/fonts/truetype/

Note: Copying the fonts to the relevant directory is not necessary but it will keep your font system more organized
Note: For the changes to take affect you have to log out and log back in again

If you want to make it more manageable and organized, you can create a subdirectory and install all your fonts there.

# mkdir /usr/share/fonts/truetype/newfonts
# chmod 755 /usr/share/fonts/truetype/newfonts
# cd /usr/share/fonts/truetype/newfonts
# cp ~/.ttf .
# chown root:root .ttf
# chmod 744 .ttf

2.1 - Installing fonts for users
All users have a directory named .fonts in their home directory. If you install any fonts to this directory those fonts will be only available for that user.

Lets say you want to install some fonts for you and not for the other users (Or in a situation you don't have root access), you can copy your font files to ~/.fonts.

2.1.1 - Installing Tahoma.ttf
$ cp Tahoma.ttf ~/.fonts/
$ fc-cache -fv

3 - Additional information
The command 'mkfontdir' can be used to create an index of X font files in a directory and the command 'fc-cache' can be used to clear the font cache so you can test your installed fonts without having to logout.
# mkfontdir
$ fc-cache -vf

Note: Even though you use fc-cache, you might have to exit your web browser or any other application that uses fonts (OpenOffice) and start back again to see the changes