Xft

From the outset, the programmers of Xft made sure that scalable fonts including antialiasing are well supported. 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. 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 openSUSE, the two desktop environments (KDE and GNOME), Mozilla and many other applications already use Xft by default. 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. Special configurations should be added to /etc/fonts/local.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 (:scalable=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:scalable=true" family style weight

The output of this command could look like the following:

Lucida Sans:style=Demibold:weight=200
DejaVu Sans:style=Bold Oblique:weight=200
Lucida Sans Typewriter:style=Bold:weight=200
FreeSerif:style=Bold,polkrepko:weight=200
FreeSerif:style=Italic,ležeče:weight=80
FreeSans:style=Medium,navadno:weight=80
DejaVu Sans:style=Oblique:weight=80
FreeSans:style=Oblique,ležeče:weight=80

Important parameters that can be queried with fc-list:

Table 12.1. Parameters of fc-list

Parameter

Meaning and Possible Values

family

Name of the font family, for example, FreeSans.

foundry

The manufacturer of the font, for example, urw.

style

The font style, such as Medium, Regular, Bold, Italic or Heavy.

lang

The language that the font supports, for example, de for German, ja for Japanese, zh-TW for traditional Chinese or zh-CN for simplified Chinese.

weight

The font weight, such as 80 for regular or 200 for bold.

slant

The slant, usually 0 for none and 100 for italic.

file

The name of the file containing the font.

outline

true for outline fonts or false for other fonts.

scalable

true for scalable fonts or false for other fonts.

bitmap

true for bitmap fonts or false for other fonts.

pixelsize

Font size in pixels. In connection with fc-list, this option only makes sense for bitmap fonts.