Installing true type fonts for linux

While searching the ways of installing true type fonts to linux, I get all sort of solutions. Some will ask you to copy and paste to fonts:/// folders in nautilus, or fonts:/ in konqueror. Some may even ask you to copy your ttf fonts to /usr/share/fonts and run fc-cache. All sort of ways doesn’t works so well during last two years.

Nowadays, I think all sort of ways may works under particular linux distro, the steps to install font might vary between different linux distros, but its they a common way that it will works for any distro? For me, installing custom fonts should be as straight forward as ‘copy and paste’ ttf files to a specific folders without needing to run any command or configuration script.

Recently, I find the ‘copy and paste’ way. I just need to copy my downloaded ttf font files to ~/.fonts. If your home directory does not contain .fonts folder, create a new one

For examples, I download a font from a site, it consist of multiple ttf files.

Readme.txt
SF New Republic Bold Italic.ttf
SF New Republic Bold.ttf
SF New Republic Italic.ttf
SF New Republic Sample.jpg
SF New Republic SC Bold Italic.ttf
SF New Republic SC Bold.ttf
SF New Republic SC Italic.ttf
SF New Republic SC.ttf
SF New Republic.ttf

I create a new folder “SF New Republic” in ~/.fonts , and copy all these files into that folder. Next I open oowriter ( open office writer), straight away I can use the font without doing fc-cache or any configurations.

Anyway, there is a command to verify fonts have successfully installed to your system:

fc-list | grep "SF"
SF New Republic:style=Regular
SF New Republic:style=Bold
SF New Republic:style=Bold Italic
SF New Republic SC:style=Bold
SF New Republic SC:style=Italic
SF New Republic SC:style=Regular
SF New Republic SC:style=Bold Italic
SF New Republic:style=Italic

fc-list is actually listing all the installed fonts, with pipe over grep, we can verified whether are those fonts successfully installed.

I have tested this method on:
1. Ubuntu Hardy Heron 8.04
2. Fedora 8

I would like to do a survey at here, if you are running different distro listed above, can you try out this method?

p.s. You can download fonts at http://www.dafont.com

From : linuxbyexample

Đăng nhập quyền root.
Tạo thư mục:

Code:
# mkdir /usr/share/fonts/truetype

Copy các file ttf vào thư mục vừa tạo. (Giả sử bạn có các file font nằm trong thư mục /home/redpenguin/font/

Code:
# cd /usr/share/fonts/truetype
# cp /home/redpenguin/font/*.ttf ./

Tạo index cho các scalable fonts vừa mới copy vào thư mục truetype.

Code:
# mkfontscale && mkfontdir

Lệnh trên tạo 2 file fonts.scale and fonts.dir. Cập nhật font cache.

Code:
# fc-cache -fv

Finished, bạn bật Open Office lên là có thể sử dụng các loại font arial hoặc time news roman rồi đó

From : hocit.com

Leave a comment