X Window System Components

Checking Direct Rendering Infrastructure (DRI) Installation

DRI is a framework for allowing software to access graphics hardware in a safe and efficient manner. It is installed in X by default if you have a supported video card. To check if DRI is installed properly, check the log file /var/log/XFree86.0.log or /var/log/Xorg.0.log for statements like:

(II) R128(0): Direct rendering enabled

From an xterm, run glxinfo and look for the phrase:

direct rendering: Yes

You can also run the test program glxgears. This program brings up a window with three gears turning. The xterm will display how many frames were drawn every five seconds, so this is a reasonable benchmark. The window is scalable, and the frames drawn per second is highly dependent on the size of the window.

For troubleshooting problems, check the DRI Users Guide at http://dri.sourceforge.net/doc/DRIuserguide.html.

Adding TrueType Fonts to X

TrueType font support is built into X. The following items need to be completed to make the fonts available. Each item is described in detail after the list.

  • Establish a directory for the fonts and move any TrueType fonts you want into that directory. Ensure that any fonts you install are world readable. Incorrect permissions on fonts have been known to cause problems with some X applications.

  • Download the fonts.

  • Create the fonts.scale and fonts.dir files in the TrueType font directory.

  • Ensure the TrueType module is loaded in the XF86Config or xorg.conf.

  • Ensure the FontPath in XF86Config or xorg.conf contains the TrueType font directory.

  • Update the font cache files

Establish a TrueType Font Directory

The build of X as given above automatically creates a TrueType font directory: /usr/X11R6/lib/X11/fonts/TTF. This directory already has some TrueType fonts and is set up correctly. If this directory is satisfactory, copy any other TrueType fonts you want into that directory. If not, create a new directory, preferably in the /usr/X11R6/lib/X11/fonts/ directory and put your TrueType fonts there.

Download the Fonts

There are two known high quality free font resources: ftp://ftp.gnu.org/savannah/files/freefont/ and http://corefonts.sourceforge.net/. Copy the fonts (files with the .ttf suffix) to the directory you've just created.

Create 'fonts.scale' and 'fonts.dir'

Now change to the directory where you have your TrueType fonts and run:

mkfontscale &&

Ensure TrueType is Loaded in 'XF86Config' or 'xorg.conf'

The "Module" section should look like:

Section "Module"
    Load  "freetype"

Ensure the FontPath in 'XF86Config' or 'xorg.conf' Points to the TrueType Font Directory

The "Files" section should look like:

Section "Files"
    FontPath "/usr/X11R6/lib/X11/fonts/[TrueTypeDir]/"

Update the Font Cache Files

Ensure you have the following directory entries in /etc/fonts/local.conf, inside the fontconfig tags. Create /etc/fonts/local.conf using the following commands:

cat > /etc/fonts/local.conf << "EOF"
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->



The fc-cache program will automatically search the above directories and all subdirectories for needed fonts.

Finally, to update all the font cache files, run


X will now be able to use TrueType fonts when it is restarted. You can check to see if the new fonts are available with the xlsfonts or xfontsel program.



You should rerun mkfontscale and mkfontdir any time you add or delete TrueType fonts. You should also rerun fc-cache each time you add or remove any fonts.

Setting up Keyboards

In this version of X, non-Latin keyboard layouts do not include Latin configurations as was previous practice. To set up a keyboard for Latin and non-Latin input, change the XkbLayout keyboard driver option in the InputDevice section of the XF86Config or xorg.conf file. For example:

Section "InputDevice"
    Identifier          "Keyboard0"
    Driver              "Keyboard"
    Option "XkbModel"   "pc105"
    Option "XkbLayout"  "en_US,ru"
    Option "XkbOptions" "grp:switch,grp:alt_shift_toggle,grp_led:scroll"

In this example, you can use the Alt+Shift combination to switch between keyboard layouts and use the Scroll Lock LED to indicate when the second layout is active.

Setting up Fonts

Users using character sets other than ISO-8859-1 have to make a few adjustments to their font settings in order to make sure that fonts with the correct encoding are used for "fixed", "variable", "10x20" and similar aliases:

For Cyrillic alphabet, it is sufficient to put the following line into the top of the "Files" section in XF86Config or xorg.conf because this directory already contains the needed bitmap fonts and their aliases:

FontPath   "/usr/X11R6/lib/X11/fonts/cyrillic/"

For ISO-8859-[X] based locales, use the following command instead:

sed -i 's,iso8859-1\( \|$\),iso8859-[X]\1,g' \

Setting up XDM

xdm provides a graphical logon capability and is normally set up in /etc/inittab. Most of the information you need to customize xdm is found in its man page. To execute xdm during bootup, change the initdefault level to 5 and add the following lines to /etc/inittab:

# Run xdm as a separate service
x:5:respawn:/usr/X11R6/bin/xdm -nodaemon

If Linux-PAM is installed on your system, you should create a PAM entry for xdm by duplicating the login entry using the following command:

cp /etc/pam.d/login /etc/pam.d/xdm

Using X Resources

There are many options that can be set in X and X clients via resources. Typically resources are set in the ~/.Xresources file.

The layout of the ~/.Xresources file consists of a list of specifications in the form of

object.subobject[.subobject...].attribute: value

Components of a resource specification are linked together by either tight, represented by a dot (.), or loose, represented by an asterisk (*), bindings. A tight binding indicates that the components on either side of the dot must be directly next to each other as defined in a specific implementation. An asterisk is a wildcard character that means that any number of levels in a defined hierarchy can be between the components. For example, X offers two special cursors: redglass and whiteglass. To use one of these resources, you need to add the following line:

Xcursor.theme: whiteglass

However, you can specify the background for all clients with:

*background: blue

More specific resource variables will override less specific names.

Resource definitions can be found in the man pages for each respective client.

In order to load your resources, the xrdb program must be called with the appropriate parameters. Typically, the first time resources are loaded, you use:

xrdb -load <filename>

To add resources to X's database in memory, use:

xrdb -merge <filename>

The xrdb instruction is usually placed in ~/.xinitrc or ~/.xsession. To get more information, see the xrdb man page.

Last updated on 2005-08-01 13:29:19 -0600