Sunday, August 23, 2009

Add fonts to linux

one way is to add the fonts to the linux fonts.its a simple procedure.
create a directory for the fonts in /usr/share/fonts/trutype
# cd /usr/share/fonts/truetype
# mkdir newfonts

copy the fonts you want to add to that directory.
Now change the ownership of the fonts as well as make sure they have a right of 644 .
# chown root.root *.ttf
# chmod 644 *.ttf

Now run the command mkfontdir while in the newfonts directory.
# mkfontdir

This will create an index of the fonts in the directory. It will also create two files fonts.dir and fonts.cache-1 .
Now moving to the parent directory, edit the file fonts.cache-1 using your favourate editor and append the following line to it.
#File: /usr/share/fonts/truetype/fonts.cache-1
...
"newfonts" 0 ".dir"

Lastly run the command fc-cache.
# fc-cache

This command will scan the font directories on the system and build font information cache files for applications using fontconfig for their font handling.
That's it. Now you can have access to the new fonts in all your X applications including firefox and OpenOffice.org.

No comments:

Post a Comment