How to add a font on Ubuntu
Tutorial for adding a TrueType font in a Ubuntu system.
By exercising the profession of web designer or webmaster, it's important to have a good amount of fonts available on your system.
The best site on this scope, it's certainly dafont.com, which presents an infinite number of fonts, simplifying the consultation through the division by categories. On this site you can also try fonts before downloading, by displaying a preview of individual words or entire sentences.
After downloading the desired font, for example on your Desktop, many ubuntists like me will wonder how to install it on your operating system. There are two major modes, each of which has more than one method: the first of them needs root access and make fonts available to all users of the system, the second is used to load fonts without root privileges. Pick the one that best suits your needs.
Add fonts with root access
With root privileges, you can ensure that fonts are available to all users on the operating system. The cases that we are going to analyse are essentially two: the first will require your password each time you want to load a new set of fonts, the second will require root access only for the addition of a symlink.
In the first case, you have to copy the ".ttf" downloaded file to the folder where all TrueType system fonts reside (/usr/share/fonts/truetype/). For example, if the file was downloaded to your Desktop, run the following command, replacing user with the name of your login username and font_name with the name of the downloaded font.
sudo cp /home/user/Desktop/ font_name.ttf /usr/share/fonts/truetype/
Next step is to write in cache the font just copied, executable by the command:
fc-cache -f -v
After this sequence of operations, the desired font will be available in any applications you want, from The Gimp for graphics to OpenOffice for the drafting of texts.
The second method needs root privileges only for creating a symbolic link to the folder that contains the system fonts (/usr/share/fonts/truetype/).
The procedure is as simple as ingenious: the first step is creating a folder in your user's home, for example called Fonts; after that you have to create the symlink described above, so whenever you upload a file into the folder ~/Fonts/ you'll have it available on all your Ubuntu system.
Here is the sequence of commands, remembering to replace user with your username access:
mkdir /home/user/Fonts sudo ln -s /home/user/Fonts /usr/share/fonts/truetype fc-cache -f-v
Add fonts without root privileges
We are going to explain how you can add fonts that will remain available only to your user account on the operating system.
The first step is to type fonts:/// in the address bar of your file manager (usually Nautilus), for displaying a list of available fonts. The same screen can be reached in Ubuntu Gutsy, even selecting from the menu System → Preferences selecting Appearance, then you will get a screen and you have to select Fonts → Details → Go to the characters folder. I think you'll understand that the first way is the fastest...
To add a font copy and paste it into the virtual directory fonts:///.
For beginners, here are the steps:
Save the desired font on your "Desktop" or in a location of your choice
If it's in ".zip" or ".tar.gz" format, you'll have to extract the data it contains, by selecting "Extract here" from the menu that appears by right-clicking on it
Now we have a .ttf file; right-click on it and select "Copy"
Open Nautilus (by double-clicking on any folder)
Type fonts:/// in the address bar at the top and confirm with "Enter"
Right-click within an empty space of this folder and select "Paste" from the menu
Note: as said on the official forum, in Ubuntu Hardy Heron we've not a "fonts:///" directory. Then we have to copy the font into ~/.font directory.
Following these simple steps, the font will be automatically loaded in the hidden directory /home/user/.fonts/, where all personal fonts are stored.
Another solution is to copy the desired font directly in this folder through the command:
cp /home/user/Desktop/font_name.ttf /home/user/.fonts/
Remembering to replace user with the name of your buntu login username and font_name with the name of the selected font.
To complete the process and ensure that fonts are available within your favourite software, you may need to restart it.
Category: Ubuntu e Linux
Published by: loris.genetti on date: 06.04.2008 10:51:20
Last edit by: loris.genetti on date: 06.06.2008 17:11:28
Based total views
Leave a comment
All comments must be approved by site administrator.
Please write comments on topic. Spam will be never approved.