Virtual OS/2 International Consumer Education
VOICE Home Page: http://www.os2voice.org
April 2004

Newsletter Index
< Previous Page | Next Page >
Feature Index

editor@os2voice.org


Installing fonts for XFree86/OS2 Version 4

By Christian Hennecke © April 2004

The XFree86/OS2 distribution contains several font packages. To be able to additionally use the Type1 and TrueType fonts (e.g. in The GIMP) installed on "normal" OS/2 some things have to be done.

In XFree86/OS2 there are two seperate font systems, the X11 core system and the Xft system. The X11 core system has been included since the very first version of X11. Step by step, its functionality has been extended, but it does not support advanced features like anti-aliasing. In contrast, the Xft system has been designed for usage of scalable fonts from the start, and it also supports features like anti-aliasing or subpixel-rendering.

CAUTION: Even though Xft has been introduced with version 4, it is still recommended to make fonts available in the traditional way, because many applications are not capable of using Xft yet.

1. X11 core system

To install fonts open your XF86Config file and go to the section containing several FontPath statements. Now add a new FontPath path statement to the Section "Files" for every directory containing fonts you want to install. Each must use slashes as path seperators and end with a slash "/". Furthermore, you must always specify the drive letter.

If your bootdrive was C: and you wanted to add your OS/2 system font directory PSFONTS to the existing font paths, for instance, the corresponding part of XF86Config would look like the following (with an automatically created configuration file, there will probably be no comments):

Section "Files"

# The location of the RGB database.  Note, this is the name of the
# file minus the extension (like ".txt" or ".db").  There is normally
# no need to change the default.

     RgbPath   "/usr/X11R6/lib/X11/rgb"

# Multiple FontPath entries are allowed (which are concatenated together),
# as well as specifying multiple comma-separated entries in one FontPath
# command (or a combination of both methods)

#    FontPath   "/usr/X11R6/lib/X11/fonts/local/"
    FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
    FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath   "/usr/X11R6/lib/X11/fonts/Speedo/"
    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
    FontPath   "c:/PSFONTS/"

# For OSs that support Dynamically loaded modules, ModulePath can be
# used to set a search path for the modules.  This is currently supported
# for Linux ELF, FreeBSD 2.x and NetBSD 1.x.  The default path is shown
# here.

#    ModulePath

EndSection

Meanwhile, the X11 core system also supports TrueType fonts. For this reason, a seperate installation is no longer required. You how to make sure, however, that the corresponding server module is loaded by inserting the Load "freetype" statement:

# **********************************************************************
# Module section -- this is an optional section which is used to specify
# which run-time loadable modules to load when the X server starts up.
# **********************************************************************

Section "Module"

# This loads the DBE extension module.

    Load   "dbe"

# This loads the miscellaneous extensions module, and disables
# initialisation of the XFree86-DGA extension within that module.

    SubSection   "extmod"
    Option   "omit xfree86-dga"
    EndSubSection

    Load   "glx"
    Load   "record"
    Load   "xtrap"
    Load   "speedo"

# This loads the Type1 and FreeType font modules

    Load   "type1"
    Load   "freetype"

EndSection

Unfortunately, there is more to do. All these directories have to contain the files fonts.dir and fonts.scale which carry information about the fonts. Your X-server may crash, if those files are missing or contain incorrect information. Creating those files by hand is very unconvenient. However, XFree86/OS2 version 4 comes with tools to create these files automatically.

Download the archive type1inst. The archive contains the three files rencase.exe, type1inst and t1embed. Copy rencase.exe into your path. The other two files are no longer required starting with version 4. The tool rencase.exe can be used to convert filenames to upper- or lowercase. This is important since OS/2 isn't case sensitive, but the X server is and it will not start if the entries in the desription files don't exactly match the filenames.

Go to each font directory which you want to add and convert all filenames to lowercase using:

rencase -l *

Then issue the commands:

mkfontscale
mkfontscale -b -s -l

The font description files for this directory should be generated. When you add new fonts or remove old ones later, you'll have to do this again.

If you now start XFree86/OS2, the new fonts should be availble.

2. Xft font system

Among others, Xft supports Type1 and TrueType fonts, so no seperate installation is required.

To install fonts, open the \etc\fonts\fonts.conf file and go to the section containing several <dir> statements. Now add a new <dir>path</dir> statement for every directory containing fonts you want to install. Each must use slashes as path seperators. Furthermore, you must always specify the drive letter. Subdirectories of the directories specified are taken account of automatically.

If your bootdrive was C: and you wanted to add your OS/2 system font directory PSFONTS to the existing font paths, for instance, the corresponding part of fonts.conf would look like the following:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts.conf file to configure system font access -->
<fontconfig>

<!--
    The intent of this standard configuration file is to be adequate for
    most environments.  If you have a reasonably normal environment and
    have found problems with this configuration, they are probably
    things that others will also want fixed.  Please send any suggested
    changes to fonts@xfree86.org so that future releases can include
    such changes.

    Note that the normal 'make install' procedure for XFree86 is to
    replace any existing fonts.conf file with the new version.  Place
    any local customizations in local.conf which this file references.

    Keith Packard
-->

<!-- Font directory list configured on Mon Mar  1 17:26:10 MEZ 2004 -->

    <dir>y:/usr/X11R6/lib/X11/fonts</dir>
    <dir>y:/usr/share/fonts</dir>
    <dir>~/.fonts</dir>
    <dir>c:/PSFONTS</dir>

Now open a command line window on the XFree86/OS2 installation drive and create the cache files containing the font descriptions by issueing the following command:

fc-cache -f -v

Afterwards, the list of available fonts can be displayed with the following command:

fc-list

Each time you add new fonts to the font directories or remove old ones, you have to run the following command again:

fc-cache

If you now start your X server, the new fonts should be available. For information regarding which applications support Xft, please see their documentation. Some, like xterm, are still using the core system by default, but can switch to Xft if certain parameters are specified. Others, like those based on GTK 2.2, already use Xft by default.

For further information regarding Xft system configuration, e.g. on fine-tuning anti-aliasing and subpixel-rendering for selected fonts, please see the file \usr\X11R6\lib\X11\doc\README.fonts that is included in the XFree86/OS2 distribution.

References:

XFree86/OS2 distribution: ftp://ftp.netlabs.org/pub/xfree86/
type1inst: http://www.os2world.com/os2files/files/type1inst.zip
XFree86.org: http://www.xfree86.org/


Feature Index
editor@os2voice.org
< Previous Page | Newsletter Index | Next Page >
VOICE Home Page: http://www.os2voice.org