The installation of additional fonts in SUSE LINUX is very easy. Simply copy the fonts to any directory that is located in the X11 font path (see Section 4.2.1.2. “X11 Core Fonts”). To enable use of the fonts with the new xft font rendering system, the installation directory should be a subdirectory of the directories configured in /etc/fonts/fonts.conf (see Section 4.2.1.1. “Xft”).
The font files can be copied manually (as root) to a suitable directory, such as /usr/X11R6/lib/X11/fonts/truetype. Alternatively, the task can be performed with the KDE font installer in the KDE Control Center. The result is the same.
Instead of copying the actual fonts, you can also create symbolic links. For example, you may want to do this if you have licensed fonts on a mounted Windows partition and want to use them. Subsequently, run SuSEconfig --module fonts.
SuSEconfig --module fonts executes the script /usr/sbin/fonts-config, which handles the configuration of the fonts. To see what exactly this script does, refer to the manual page of the script (man fonts-config).
The procedure is the same for bitmap fonts, TrueType and OpenType fonts, and Type1 (PostScript) fonts. All these font types can be installed in any directory. Only CID-keyed fonts require a slightly different procedure. For this, see Section 4.2.1.3. “CID-Keyed Fonts”.
XFree contains two completely different font systems: the old X11 core font system and the newly designed Xft and fontconfig system. The following sections briefly describe these two systems.
From the outset, the programmers of Xft made sure that scalable fonts including antialiasing are supported well. If Xft is used, the fonts are rendered by the application using the fonts, not by the X server as in the X11 core font system. In this way, the respective application has access to the actual font files and full control of how the glyphs are rendered. This constitutes the basis for the correct display of text in a number of languages. Moreover, direct access to the font files is very useful for embedding fonts for printing to make sure that the printout looks the same as the screen output.
In SUSE LINUX, the two desktop environments KDE and GNOME, Mozilla, and many other applications already use Xft by default. Thus, Xft is already used by more applications than the old X11 core font system.
Xft uses the fontconfig library for finding fonts and influencing how they are rendered. The properties of fontconfig are controlled by the global configuration file /etc/fonts/fonts.conf and the user-specific configuration file ~/.fonts.conf. Each of these fontconfig configuration files must begin with
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig>
and end with
</fontconfig>
To add directories to search for fonts, append lines such as the following:
<dir>/usr/local/share/fonts/</dir>
However, this is usually not necessary. By default, the user-specific directory ~/.fonts is already entered in /etc/fonts/fonts.conf. Accordingly, all you need to do to install additional fonts is to copy them to ~/.fonts.
You can also insert rules that influence the appearance of the fonts. For example, enter
<match target="font"> <edit name="antialias" mode="assign"> <bool>false</bool> </edit> </match>
to disable antialiasing for all fonts or
<match target="font"> <test name="family"> <string>Luxi Mono</string> <string>Luxi Sans</string> </test> <edit name="antialias" mode="assign"> <bool>false</bool> </edit> </match>
to disable antialiasing for specific fonts.
By default, most applications use the font names sans-serif (or the equivalent sans), serif, or monospace. These are not real fonts but only aliases that are resolved to a suitable font, depending on the language setting.
Users can easily add rules to ~/.fonts.conf to resolve these aliases to their favorite fonts:
<alias> <family>sans-serif</family> <prefer> <family>FreeSans</family> </prefer> </alias> <alias> <family>serif</family> <prefer> <family>FreeSerif</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>FreeMono</family> </prefer> </alias>
Because nearly all applications use these aliases by default, this affects almost the entire system. Thus, you can easily use your favorite fonts almost everywhere without having to modify the font settings in the individual applications.
Use the command fc-list to find out which fonts are installed and available for use. For instance, the command fc-list "" returns a list of all fonts. To find out which of the available scalable fonts (:outline=true) contain all glyphs required for Hebrew (:lang=he), their font names (family), their style (style), their weight (weight), and the name of the files containing the fonts, enter the following command:
fc-list ":lang=he:outline=true" family style weight file
The output of this command could appear as follows:
/usr/X11R6/lib/X11/fonts/truetype/FreeSansBold.ttf: FreeSans:style=Bold:weight=200 /usr/X11R6/lib/X11/fonts/truetype/FreeMonoBoldOblique.ttf: FreeMono:style=BoldOblique:weight=200 /usr/X11R6/lib/X11/fonts/truetype/FreeSerif.ttf: FreeSerif:style=Medium:weight=80 /usr/X11R6/lib/X11/fonts/truetype/FreeSerifBoldItalic.ttf: FreeSerif:style=BoldItalic:weight=200 /usr/X11R6/lib/X11/fonts/truetype/FreeSansOblique.ttf: FreeSans:style=Oblique:weight=80 /usr/X11R6/lib/X11/fonts/truetype/FreeSerifItalic.ttf: FreeSerif:style=Italic:weight=80 /usr/X11R6/lib/X11/fonts/truetype/FreeMonoOblique.ttf: FreeMono:style=Oblique:weight=80 /usr/X11R6/lib/X11/fonts/truetype/FreeMono.ttf: FreeMono:style=Medium:weight=80 /usr/X11R6/lib/X11/fonts/truetype/FreeSans.ttf: FreeSans:style=Medium:weight=80 /usr/X11R6/lib/X11/fonts/truetype/FreeSerifBold.ttf: FreeSerif:style=Bold:weight=200 /usr/X11R6/lib/X11/fonts/truetype/FreeSansBoldOblique.ttf: FreeSans:style=BoldOblique:weight=200 /usr/X11R6/lib/X11/fonts/truetype/FreeMonoBold.ttf: FreeMono:style=Bold:weight=200
Important parameters that can be queried with fc-list:
Table 4.2. Parameters of fc-list
Parameter | Meaning and Possible Values |
---|---|
family | Name of the font family, e.g., FreeSans. |
foundry | The manufacturer of the font, e.g., urw. |
style | The font style, e.g., Medium, Regular, Bold, Italic, Heavy. |
lang | The language that the font supports, e.g., de for German, ja for Japanese, zh-TW for traditional Chinese, zh-CN for simplified Chinese. |
weight | The font weight, e.g., 80 for regular, 200 for bold. |
slant | The slant, usually 0 for none, 100 for italic. |
file | The name of the file containing the font. |
outline | true for outline fonts, false for other fonts. |
scalable | true for scalable fonts, false for other fonts. |
bitmap | true for bitmap fonts, false for other fonts. |
pixelsize | Font size in pixels. In connection with fc-list, this option only makes sense for bitmap fonts. |
Today, the X11 core font system supports not only bitmap fonts but also scalable fonts, like Type1 fonts, TrueType and OpenType fonts, and CID-keyed fonts. Unicode fonts have also been supported for quite some time. In 1987, the X11 core font system was originally developed for X11R1 for the purpose of processing monochrome bitmap fonts. All extensions mentioned above were added later.
Scalable fonts are only supported without antialiasing and subpixel rendering and the loading of large scalable fonts with glyphs for many language may take a long time. The use of Unicode fonts may also be slow and consume much more memory than necessary.
The X11 core font system has many other inherent weaknesses. It is hopelessly outdated and can no longer be extended meaningfully. Although it must be retained for reasons of backward compatibility, the more modern Xft/fontconfig system should be used if at all possible.
Remember that only directories meeting the following requirements are taken into account by the X server:
Directories entered as FontPath in the Files section in the file /etc/X11/XF86Config.
Directories that have a valid font.dir file (generated by SuSEconfig).
Directories that are not disabled with the command xset -fp when the X server is active.
Directories that are not enabled with the command xset +fp when the X server is active.
If the X server is already active, newly installed fonts in mounted directories can be made available with the command xset fp rehash. This command is executed by SuSEconfig --module fonts.
As the command xset needs access to the running X server, this will only work if SuSEconfig --module fonts is started from a shell that has access to the running X server. The easiest way to achieve this is to assume root permissions by entering sux and the root password. sux transfers the access permissions of the user who started the X server to the root shell. To check if the fonts were installed correctly and are available by way of the X11 core font system, use the command xlsfonts to list all available fonts.
By default, SUSE LINUX uses UTF-8 locales. Therefore, Unicode fonts should be preferred (font names ending with iso10646-1 in xlsfonts output). All available Unicode fonts can be listed with xlsfonts | grep iso10646-1. Nearly all Unicode fonts available in SUSE LINUX contain at least the glyphs needed for European languages (formerly encoded as iso-8859-*).
In contrast to the other font types, you cannot simply install CID-keyed fonts in just any directory. CID-keyed fonts must be installed in /usr/share/ghostscript/Resource/CIDFont. This is not relevant for Xft/fontconfig, but it is necessary for Ghostscript and the X11 core font system.
Tip | |
---|---|
See http://www.xfree86.org/current/fonts.html for more information about fonts under X11. |