Font installation in XFree86OS/2

By Christian Hennecke

=Font installation in XFree86/OS2 3.3.x=

Thanks to Khairil Yusof and others on the XFree86/OS2 mailing list.

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.

1. Type1 fonts
To install Type1 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 Type1 fonts you want to install. Each must useend with slashes as path seperators and end with a slash "/". If the desired font directory is not located on the same drive as XFree86/OS2, you must specifiy 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 respective part of XF86Config would look like the following:  Section "Files"


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

RgbPath  "/XFree86/lib/X11/rgb"


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

FontPath  "/XFree86/lib/X11/fonts/misc/" FontPath  "/XFree86/lib/X11/fonts/75dpi/:unscaled" FontPath  "/XFree86/lib/X11/fonts/100dpi/:unscaled" FontPath  "/XFree86/lib/X11/fonts/Type1/" FontPath  "/XFree86/lib/X11/fonts/Speedo/" FontPath  "/XFree86/lib/X11/fonts/75dpi/" FontPath  "/XFree86/lib/X11/fonts/100dpi/" FontPath  "c:/PSFONTS/"
 * 1)    FontPath   "/XFree86/lib/X11/fonts/local/"


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


 * 1)    ModulePath

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 will crash, if those files are missing or contain incorrect information. Creating those files by hand is very unconvenient. The Perl script type1inst does it automatically. (You must have installed Perl to be able to run it!)

The archive contains the three files rencase.exe, type1inst and t1embed. Copy rencase.exe into your path and the other two files into the same directory (e.g. \Perl\lib). The tool rencase.exe can be used to convert filenames to upper- or lowercase. This is important since the type1inst script 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 command

perl path_to_type1inst\type1inst

Now the script should generate the description files. Whenever you add new fonts or remove old ones you'll have to do this again.

When you now fire up XFree86/OS2 the new fonts should be available.

2. TrueType fonts
The installation of TrueType fonts is more complicated, since XFree86/OS2 version 3.3.x does not support them. For version 3.3.x the following seems to be the best solution:


 * Get the TrueType fontserver xfsttos2 and unzip the archive into the root of your XFree86/OS2 drive.
 * Copy the TrueType fonts you want to install to /XFree86/lib/X11/fonts/Truetype.
 * Convert the fonts' filenames to lowercase using rencase -l * in the fonts' directory.
 * Start xfstt -once without starting XFree86/OS2.


 * Add the line FontPath "inet/127.0.0.1:7100" to the other Fontpath statements in Section "Files" in your XF86Config file. 7100 is the port which the font server is using.

The respective section of XF86Config should look similar to the following (with the same differences regarding drive letters as above):  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  "/XFree86/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   "/XFree86/lib/X11/fonts/local/" FontPath  "/XFree86/lib/X11/fonts/misc/" FontPath  "/XFree86/lib/X11/fonts/75dpi/:unscaled" FontPath  "/XFree86/lib/X11/fonts/100dpi/:unscaled" FontPath  "/XFree86/lib/X11/fonts/Type1/" FontPath  "/XFree86/lib/X11/fonts/Speedo/" FontPath  "/XFree86/lib/X11/fonts/75dpi/" FontPath  "/XFree86/lib/X11/fonts/100dpi/" FontPath  "c:/PSFONTS/" FontPath  "inet/127.0.0.1:7100"

# 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 
 * Insert the lines

font-service 7100/tcp #X Font Service font-service 7100/udp #X Font Service

into the %ETC%\services file (%ETC% is the value of the ETC environment variable, on Warp 4 bootdrive:\MPTN\ETC), if there are not already included. Again 7100 is the font server's port. The file's respective part should look similar to the following:

 #                         #Brian Hammill  dpserve        7020/tcp   #DP Serve dpserve        7020/udp   #DP Serve dpserveadmin   7021/tcp   #DP Serve Admin dpserveadmin   7021/udp   #DP Serve Admin #                         #Allan Stanley  lazy-ptop      7099/tcp   #lazy-ptop lazy-ptop      7099/udp   #lazy-ptop #                         #Guy Keren  font-service   7100/tcp   #X Font Service font-service   7100/udp   #X Font Service #                         #Stephen Gildea  virprot-lm     7121/tcp   #Virtual Prototypes License Manager virprot-lm     7121/tcp   #Virtual Prototypes License Manager 

CAUTION: If you have too many fonts in the directory you will run out of memory to load up GNOME applications as more fonts continue to be loaded. To solve this problem, limit the number of Truetype fonts in your directory or close the XFree86/OS2 session and XFSTT and reload both again. Limiting the number fonts in the font directory is the best solution. It also seems that following the original documentation doesn't work. On some systems the speed varies greatly depending on the used port. If you experience performance degradation try changing the port. Be sure to change both configuration files accordingly!

WARNING: If you select a corrupt font in an X program for display the fontserver may crash. Unfortunately, this leads to the X server also crashing. If you see your X programs not responding correctly after selecting a font, change to the WPS immediately and terminate the fontserver and the X session from there. You can start them again after this, but remember to delete the corrupt font's file and run the type1inst script.

=Font installation in XFree86/OS2 4.x=

Thanks to Frank Gießler and others on the XFree86/OS2 mailing list.

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"


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

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


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

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/"
 * 1)    FontPath   "/usr/X11R6/lib/X11/fonts/local/"


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


 * 1)    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:


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

Section "Module"


 * 1) This loads the DBE extension module.

Load  "dbe"


 * 1) This loads the miscellaneous extensions module, and disables
 * 2) initialisation of the XFree86-DGA extension within that module.

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

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


 * 1) 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 statements. Now add a new path 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:   <!DOCTYPE fontconfig SYSTEM "fonts.dtd">

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

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.