For example, if you have a compressed tar file named /tmp/newfonts.tgz containing a folder named newfonts full of TrueType fonts and wish to install them for your own private use, you can use these commands:
$ cd ~/.fonts
$ tar xvzf /tmp/newfonts.tgz "*.ttf" "*.TTF"
Or, to install the fonts so that they are accessible to all users system-wide:
# cd /usr/share/fonts
# mkdir newfonts
# cd newfonts
# tar xvzf /tmp/newfonts.tgz "*.ttf" "*.TTF"
To delete all of your personal fonts:
$ rm -rf ~/.fonts/*
And to delete the system-wide fonts installed in newfonts :
# rm -rf /user/share/fonts/ newfonts
2.7.1.4. Installing the Microsoft fonts
Web pages and documents created on Microsoft systems often use fonts that are distributed with Windows. For a time, Microsoft made these fonts available free of charge on its web site; although they are no longer available directly from Microsoft, they are available from fontconfig.org under Microsoft's fairly simple licensing terms, documented in http://fontconfig.org/webfonts/Licen.TXT .
Installing these fonts makes it possible to view Word and Excel documents and web pages created under Windows as they were originally designed. Mozilla, Firefox, OpenOffice, and other applications can all use these fonts.
In order to install these fonts, you'll need to obtain a copy of the cabextract program to extract the fonts from archives created in Microsoft's proprietary CAB format:
# yum install cabextract
Once cabextract is installed, you can easily install the Microsoft fonts from the command line:
# wget http://fontconfig.org/webfonts/webfonts.tar.gz
# tar xvzf webfonts.tar.gz
# cd msfonts
# cabextract *.exe
# mkdir /usr/share/fonts/microsoft
# cp *.[tT]* /usr/share/fonts/microsoft
# cd ..
# rm -rf msfonts
# fc-cache
2.7.1.5. Using newly installed fonts
Applications load their font lists at startup time, so simply relaunching an application is usually all that is required before you can start using new fonts.
The command fc-cache will create an index cache to speed application startup. To use it:
$ fc-cache
# fc-cache
Running fc-cache as a regular user will create the index cache for ~/.fonts , which is not really necessary because the index cache will be created automatically. Running it as root will create the index cache for /usr/share/fonts and is strongly recommended; otherwise, an index of the system-wide fonts will be created for each individual user, wasting time and storage space.
2.7.1.6. Configuring font rendering options
Font rendering can be tuned to adjust the font appearance to suit user preferences and the display hardware in use. Both GNOME and KDE provide configuration tools to configure font rendering.
The GNOME configuration window shown in Figure 2-28 is accessed from the menu item System→Preferences→Font. The KDE rendering configuration panel shown in Figure 2-29 is accessed through the KDE Control Panel under Appearance & Themes→Fonts.
Figure 2-28. GNOME font-rendering preferences tool
Figure 2-29. KDE font rendering preferences tool
In both cases, you can enable or disable antialiasing, adjust the level of antialiasing hinting, and set subpixel order.
On an older system with a slow CPU and/or low memory resources, turning off antialiasing can make enough of a performance difference to turn an unbearably slow system into one that performs reasonably.
When antialiasing is enabled, the hinting level can be set according to user preferenceexperiment and see what looks best.
If you have an LCD screen, select "Smoothing: Subpixel (LCD)" in GNOME or "Use Subpixel Smoothing" in KDE. You'll also need to select the order of the red, green, and blue elements on your screen; since this information is almost never documented in the hardware specifications, use a large magnifying glass or experiment until you find the setting that looks the best.
2.7.2. How Does It Work?
X Window System programs use one of two different font systems. The old system, known as core fonts , is still used by a few applications and is needed to start the X server. Almost all current applications use a system comprising two components: FreeType and fontconfig , two software libraries that provide high-quality font rendering and font matching. Since these are client-side libraries accessed by applications, each application separately handles its own font operations.
FreeType's sub-pixel rendering capability is, by and large, useful only on LCDs. It involves treating each of the RGB color elements in a pixel as a partial pixel. Figure 2-30 shows an enlarged diagonal line border between black and white regions on an LCD screen, rendered using subpixel hinting.
Figure 2-30. Subpixel rendering on an LCD panel
Note that each pixel is comprised of a red, green, and a blue element; on this display, they are arranged horizontally in R-G-B order. In the first row, there is one white pixel. In the second row, there is a white pixel followed by one-third of a white pixelwhich, in this case, means a red pixel. The third row consists of a white pixel followed by two-thirds of a pixela red-plus-green pixel, which displays as yellow. The fourth row contains two white pixels.
It seems odd that a color pixel would be perceived as a partial pixel, but it works because of sophisticated algorithms and the fact that the subpixels are a continuation of the R-G-B element pattern on the line.
2.7.3. What About...
2.7.3.1. ...getting a list of available fonts?
The fc-list program (a utility provided with Fontconfig) will list all of the fonts available through the Xft/Fontconfig system:
$ fc-list
Luxi Serif:style=Regular
MiscFixed:style=Regular
Utopia:style=Bold Italic