Saturday, May 16, 2009

How to Install True Type Fonts on Ubuntu

You've just installed Ubuntu, and you need some good fonts for Open Office, Gimp, or another reason. You've found some nice .ttf fonts for Windows, but you're not sure on how you can use them, or even if it's possible. Following this guide properly, it'll be as easy as copying fonts to the /fonts directory in Windows!

1. Move all your fonts to the ~/ Directory. The ~/ Directory is your home folder. So if you were logged in as cruddpuppet, the directory would be /home/cruddpuppet/ .
2. Open up the terminal. I'm assuming you've already extracted the font to the ~/ directory. Type: "cd /usr/local/share/fonts/truetype" without the quotes (the path is "/usr/share/fonts/truetype" on some distros). What this does is changes the directory to the truetype fonts directory.
3. Type in "sudo mkdir myfonts" also without quotes. Assuming you're not logged in as root, this will ask you for your password. Anything you type will not be seen, but it is there. Just type in your password, press enter, and the directory 'myfonts' will be created.
4. Type in "cd myfonts" . Then type in "sudo cp ~/fontname.ttf ." . These will get your font in the /myfonts directory.
5. In order to install the font, ownership has to belong to root, so type in "sudo chown root.root fontname.ttf" and after that "sudo mkfontdir" which makes a directory for your font.
6. Now your font is installed, but it will disappear the next time ubuntu starts up, so you just need to type "cd .." and after that "fc-cache" .

More info in installing open type fonts that are supported since Open Office 3. will handle binary encoded Type1 fonts (".pfb" suffix) as well as text encoded Type1 fonts (".pfa" suffix). However, you still need to have the corresponding Adobe Font Metric file (AFM) installed. This file needs to have the same base name as the font file (i.e. Times.pfa plus Times.afm or Helvetica.pfb plus Helvetica.afm). It must be installed in the same directory as the font file or in a subdirectory named "afm".

If you are not sure that you have installed the font correctly you can examine the "user/psprint/pspfontcache" file, or if you made a network installation, the "share/psprint/pspfontcache" file. This file is kind of hard to read but it states all font files that have been found during the last run of "| grep" is your friend. Even though it is safe to remove this file please be careful not to modify it.

Installing OpenType Fonts
just to make sure... when you placed your fonts into /usr/share/fonts, did you update the font db? try the following commands exactly (these are just slightly modified instructions from that wiki page:


cd /usr/share/fonts/type1
sudo mkdir opentype
cd opentype
sudo cp /where/your/fonts/are/located/* .
sudo mkfontdir
cd ..
sudo fc-cache

that and then try restarting gnome/rebooting..

No comments:

Blog Archive

About Me

Exclusion of liability Regarding StillStupid: The use you make of the guides, tips and downloads that you listed on this web site or on another website to which I refer is entirely at your own risk. In no way can I be held liable for damage or consequential damages of any kind, which occurs as a result of that use.