Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
Applies to SUSE Linux Enterprise Server 11 SP4

16 The X Window System

The X Window System (X11) is the de facto standard for graphical user interfaces in UNIX. X is network-based, enabling applications started on one host to be displayed on another host connected over any kind of network (LAN or Internet). This chapter describes the setup and optimization of the X Window System environment, and provides background information about the use of fonts in SUSE® Linux Enterprise Server.

Tip
Tip: IBM System z: Configuring the Graphical User Interface

IBM System z does not have any input or output devices supported by X.Org. Therefore, none of the configuration procedures described in this section apply. More relevant information for IBM System z can be found in Chapter 4, Installation on IBM System z.

16.1 Manually Configuring the X Window System

By default, the X Window System is configured with the SaX2 interface, described in Section 8.2, “Setting Up Graphics Card and Monitor”. Alternatively it can be configured manually by editing its configuration files.

Warning
Warning: Faulty X Configurations can Damage Your Hardware

Be very careful when configuring your X Window System. Never start the X Window System until the configuration is finished. A misconfigured system can cause irreparable damage to your hardware (this applies especially to fixed-frequency monitors). The creators of this book and SUSE Linux Enterprise Server cannot be held responsible for any resulting damage. This information has been carefully researched, but this does not guarantee that all methods presented here are correct and cannot damage your hardware.

The command sax2 creates the /etc/X11/xorg.conf file. This is the primary configuration file of the X Window System. Find all the settings here concerning your graphics card, mouse and monitor.

Important
Important: Using X -configure

Use X -configure to configure your X setup if previous tries with SUSE Linux Enterprise Server's SaX2 have failed. If your setup involves proprietary binary-only drivers, X -configure does not work.

The following sections describe the structure of the configuration file /etc/X11/xorg.conf. It consists of several sections, each one dealing with a certain aspect of the configuration. Each section starts with the keyword Section <designation> and ends with EndSection. The following convention applies to all sections:

Section "designation"
  entry 1
  entry 2
  entry n
EndSection

The section types available are listed in Table 16.1, “Sections in /etc/X11/xorg.conf”.

Table 16.1: Sections in /etc/X11/xorg.conf

Type

Meaning

Files

The paths used for fonts and the RGB color table.

ServerFlags

General switches for the server behavior.

Module

A list of modules the server should load

InputDevice

Input devices like keyboards and special input devices (touchpads, joysticks, etc.) are configured in this section. Important parameters in this section are Driver and the options defining the Protocol and Device. You normally have one InputDevice section per device attached to the computer.

Monitor

The monitor used. Important elements of this section are the Identifier, which is referred to later in the Screen definition, the refresh rate VertRefresh and the synchronization frequency limits (HorizSync and VertRefresh). Settings are given in MHz, kHz and Hz. Normally, the server refuses any modeline that does not correspond with the specification of the monitor. This prevents too high frequencies from being sent to the monitor by accident.

Modes

The modeline parameters for the specific screen resolutions. These parameters can be calculated by SaX2 on the basis of the values given by the user and normally do not need to be changed. Intervene manually at this point if, for example, you want to connect a fixed frequency monitor. Find details of the meaning of individual number values in the HOWTO files in /usr/share/doc/howto/en/html/XFree86-Video-Timings-HOWTO (available in the howtoenh package). To calculate VESA modes manually, you can use the tool cvt. For example, to calculate a modeline for a 1680x1050@60Hz monitor, use the command cvt 1680 1050 60.

Device

A specific graphics card. It is referenced by its descriptive name. The options available in this section strongly depend on the driver used. For example, if you use the i810 driver, find more information about the available options in the manual page man 4 i810.

Screen

Combines a Monitor and a Device to form all the necessary settings for X.Org. In the Display subsection, specify the size of the virtual screen (Virtual), the ViewPort and the Modes used with this screen.

Note that some drivers demand that all of the used configurations must be present in the Display section at some place. For example, if you use a laptop and want to use an external monitor that is bigger than the internal LCD, it might be necessary to add a bigger resolution than supported by the internal LCD at the end of the Modes line.

ServerLayout

The layout of a single or multihead configuration. This section binds the input devices InputDevice and the display devices Screen.

DRI

Provides information for the Direct Rendering Infrastructure (DRI).

Monitor, Device and Screen are explained in more detail. Further information about the other sections can be found in the manual pages of X.Org and xorg.conf.

There can be several different Monitor and Device sections in xorg.conf. Even multiple Screen sections are possible. The ServerLayout section determines which of these sections is used.

16.1.1 Screen Section

The screen section combines a monitor with a device section and determines the resolution and color depth to use. A screen section might resemble Example 16.1, “Screen Section of the File /etc/X11/xorg.conf”.

Example 16.1: Screen Section of the File /etc/X11/xorg.conf
Section "Screen"1
  DefaultDepth  162
  SubSection "Display"3
    Depth       164
    Modes       "1152x864" "1024x768" "800x600"5
    Virtual     1152x8646
  EndSubSection
  SubSection "Display"
    Depth       24
    Modes       "1280x1024"
  EndSubSection
  SubSection "Display"
    Depth       32
    Modes "640x480"
  EndSubSection
  SubSection "Display"
    Depth        8
    Modes       "1280x1024"
  EndSubSection
  Device        "Device[0]"
  Identifier    "Screen[0]"7
  Monitor       "Monitor[0]"
EndSection

1

Section determines the section type, in this case Screen.

2

DefaultDepth determines the color depth to use by default unless another color depth is explicitly specified.

3

For each color depth, different Display subsections are specified.

4

Depth determines the color depth to be used with this set of Display settings. Possible values are 8, 15, 16, 24 and 32, though not all of these might be supported by all X server modules or resolutions.

5

The Modes section comprises a list of possible screen resolutions. The list is checked by the X server from left to right. For each resolution, the X server searches for a suitable Modeline in the Modes section. The Modeline depends on the capability of both the monitor and the graphics card. The Monitor settings determine the resulting Modeline.

The first resolution found is the Default mode. With CtrlAlt+ (on the number pad) switch to the next resolution in the list to the right. With CtrlAlt (on the number pad) switch to the previous. This enables you to vary the resolution while X is running.

6

The last line of the Display subsection with Depth 16 refers to the size of the virtual screen. The maximum possible size of a virtual screen depends on the amount of memory installed on the graphics card and the desired color depth, not on the maximum resolution of the monitor. If you omit this line, the virtual resolution is just the physical resolution. Because modern graphics cards have a large amount of video memory, you can create very large virtual desktops. However, you may no longer be able to use 3D functionality if you fill most of the video memory with a virtual desktop. If, for example, the card has 16 MB of video RAM, the virtual screen can take up to 4096x4096 pixels in size at 8-bit color depth. Especially for accelerated cards, however, it is not recommended to use all your memory for the virtual screen, because the card's memory is also used for several font and graphics caches.

7

The Identifier line (here Screen[0]) gives this section a defined name with which it can be uniquely referenced in the following ServerLayout section. The lines Device and Monitor specify the graphics card and the monitor that belong to this definition. These are just links to the Device and Monitor sections with their corresponding names or identifiers. These sections are discussed in detail below.

16.1.2 Device Section

A device section describes a specific graphics card. You can have as many device entries in xorg.conf as you like, provided their names are differentiated using the keyword Identifier. If you have more than one graphics card installed, the sections are simply numbered in order. The first one is called Device[0], the second one Device[1], and so on. The following file shows an excerpt from the Device section of a computer with a Matrox Millennium PCI graphics card (as configured by SaX2):

Section "Device"
  BoardName     "MGA2064W"
  BusID         "0:19:0"1
  Driver        "mga"2
  Identifier    "Device[0]"
  VendorName    "Matrox"
  Option        "sw_cursor"
EndSection

1

The BusID refers to the PCI or AGP slot in which the graphics card is installed. This matches the ID displayed by the command lspci. The X server needs details in decimal form, but lspci displays these in hexadecimal form. The value of BusID is automatically detected by SaX2.

2

The value of Driver is automatically set by SaX2 and specifies which driver to use for your graphics card. If the card is a Matrox Millennium, the driver module is called mga. The X server then searches through the ModulePath defined in the Files section in the drivers subdirectory. In a standard installation, this is the /usr/lib/xorg/modules/drivers directory or the /usr/lib64/xorg/modules/drivers directory for 64-Bit operating systems directory. _drv.o is added to the name, so, in the case of the mga driver, the driver file mga_drv.o is loaded.

The behavior of the X server or of the driver can also be influenced through additional options. An example of this is the option sw_cursor, which is set in the device section. This deactivates the hardware mouse cursor and depicts the mouse cursor using software. Depending on the driver module, there are various options available (which can be found in the description files of the driver modules in the directory /usr/share/doc/packages/package_name ). Generally valid options can also be found in the manual pages (man xorg.conf, man 4 <driver module>, and man 4 chips).

If the graphics card has multiple video connectors, it is possible to configure the different devices of this single card as one single view. Use SaX2 to set up your graphics interface this way.

16.1.3 Monitor and Modes Section

Like the Device sections, the Monitor and Modes sections describe one monitor each. The configuration file /etc/X11/xorg.conf can contain as many Monitor sections as desired. Each Monitor section references a Modes section with the line UseModes if available. If no Modes section is available for the Monitor section, the X server calculates appropriate values from the general synchronization values. The server layout section specifies which Monitor section is relevant.

Monitor definitions should only be set by experienced users. The modelines are an important part of the Monitor sections. Modelines set horizontal and vertical timings for the respective resolution. The monitor properties, especially the allowed frequencies, are stored in the Monitor section. Standard VESA modes can be generated with the utility cvt. For more information read the manual page of cvt man cvt.

Warning
Warning

Unless you have in-depth knowledge of monitor and graphics card functions, do not change the modelines, because this could severely damage your monitor.

Those who try to develop their own monitor descriptions should be very familiar with the documentation in /usr/share/X11/doc. Install the package xorg-x11-doc to find PDFs and HTML pages.

Manual specification of modelines is rarely required today. If you are using a modern multisync monitor, the allowed frequencies and optimal resolutions can, as a rule, be read directly from the monitor by the X server via DDC, as described in the SaX2 configuration section. If this is not possible for some reason, use one of the VESA modes included in the X server. This will work with most graphics card and monitor combinations.

16.2 Installing and Configuring Fonts

The installation of additional fonts in SUSE Linux Enterprise Server is very easy. Simply copy the fonts to any directory located in the X11 font path (see Section 16.2.1, “X11 Core Fonts”). To the enable use of the fonts, the installation directory should be a subdirectory of the directories configured in /etc/fonts/fonts.conf (see Section 16.2.2, “Xft”) or included into this file with /etc/fonts/suse-font-dirs.conf.

The following is an excerpt from /etc/fonts/fonts.conf. This file is the standard configuration file that should be appropriate for most configurations. It also defines the included directory /etc/fonts/conf.d. In this directory, all files or symbolic links starting with a two digit number are loaded by fontconfig. For a more detailed explanation of this functionality, have a look at /etc/fonts/conf.d/README.

<!-- Font directory list -->
<dir>/usr/share/fonts</dir>
<dir>/usr/X11R6/lib/X11/fonts</dir> 
<dir>/opt/kde3/share/fonts</dir>
<dir>/usr/local/share/fonts</dir>
<dir>~/.fonts</dir>

/etc/fonts/suse-font-dirs.conf is automatically generated to pull in fonts that ship with (mostly third party) applications like LibreOffice, Java or Adobe Reader. A typical entry would look like the following:

<dir>/usr/lib/Adobe/Reader9/Resource/Font</dir>
<dir>/usr/lib/Adobe/Reader9/Resource/Font/PFM</dir>

To install additional fonts system-wide, manually copy the font files to a suitable directory (as root), such as /usr/share/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 font configuration. For more information on this script, refer to its manual page (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 into any directory.

X.Org 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.

16.2.1 X11 Core Fonts

Today, the X11 core font system supports not only bitmap fonts but also scalable fonts, like Type1 fonts, TrueType, and OpenType fonts. Scalable fonts are only supported without anti-aliasing and subpixel rendering and the loading of large scalable fonts with glyphs for many languages may take a long time. Unicode fonts are also supported, but their use may be slow and require more memory.

The X11 core font system has a few inherent weaknesses. It is outdated and can no longer be extended in any meaningful way. Although it must be retained for reasons of backward compatibility, the more modern Xft and fontconfig system should be used if at all possible.

For its operation, the X server needs to know which fonts are available and where in the system it can find them. This is handled by a FontPath variable, which contains the path to all valid system font directories. In each of these directories, a file named fonts.dir lists the available fonts in this directory. The FontPath is generated by the X server at start-up. It searches for a valid fonts.dir file in each of the FontPath entries in the configuration file /etc/X11/xorg.conf. These entries are found in the Files section. Display the actual FontPath with xset q. This path may also be changed at runtime with xset. To add an additional path, use xset +fp <path>. To remove an unwanted path, use xset -fp <path>.

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. Because the command xset needs access to the running X server, this only works 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 acquire root permissions by entering su and the root password. su 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 Enterprise Server 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 Enterprise Server contain at least the glyphs needed for European languages (formerly encoded as iso-8859-*).

16.2.2 Xft

From the outset, the programmers of Xft made sure that scalable fonts including anti-aliasing 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 SUSE Linux Enterprise Server, 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 anti-aliasing 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 anti-aliasing 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
DejaVu Sans:style=Oblique:weight=80
Lucida Sans Typewriter:style=Regular:weight=80
DejaVu Sans:style=Book:weight=80
DejaVu Sans:style=Bold:weight=200
Lucida Sans:style=Regular:weight=80

Important parameters that can be queried with fc-list:

Table 16.2: 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.

16.3 For More Information

Install the packages xorg-x11-doc and howtoenh to get more in-depth information about X11. More information on the X11 development can be found on the project's home page at http://www.x.org.

Many of the drivers delivered with the package xorg-x11-driver-video are described in detail in a manual page. For example, if you use the nv driver, find more information about this driver in man 4 nv.

Information about third-party drivers should be available in /usr/share/doc/packages/<package_name>. For example, the documentation of x11-video-nvidiaG01 is available in /usr/share/doc/packages/x11-video-nvidiaG01 after the package was installed.

Print this page