Changing fonts

Creating a font alias

You can assign aliases to fonts so you can specify them without having to type their complete font names. This is particularly useful if you tend to set a font often.

If you are creating aliases for fonts that exist within the /usr/lib/X11/fonts subdirectories, you must be logged into the system as root. You should also ensure that /usr/bin/X11 has been added to root's $PATH environment variable.

To create a font alias, perform the following steps.

  1. In the directory that contains the font that you want to alias, edit the file fonts.alias so that it contains at least one line with the following format:

    alias  fontname

  2. Reset the X server's font database with the following command:

    xset fp rehash

Once you have aliased a font and reset the X server, you can use the alias rather than the full font name whenever you refer to that font.

Step 1: Editing the fonts.alias file

In most cases, fonts are located in /usr/lib/X11/fonts in one of the following subdirectories: 75dpi, 100dpi, misc, Speedo, or Type1. The first three of these directories contain a fonts.alias file by default. You must be logged in as root to edit any of these files.

When you add an alias to a fonts.alias file, you must enter the alias, the name by which you want to refer to the font, in the first column, and the fontname, the font's full name, in the second column.

An easy way to include a font's full name in the fonts.alias file is to open two scoterm windows, one in which you are editing the fonts.alias file and one in which you open the fonts.dir file that contains the full name of the desired font. Use scoterm's cut and paste functionality to copy the full font name from the fonts.dir file to the fonts.alias file. This approach reduces the possibility of making a typographical error in typing the font's full name.

If you make an error entering a font's full name in the fonts.alias file, the alias will not work when specified.

A typical fonts.alias file in /usr/lib/X11/fonts/75dpi might contain these two aliases:

   courier10  -adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-1
   courier12  -adobe-courier-bold-o-normal--12-120-75-75-m-60-iso8859-1

NOTE: The directory that contains the font you want to alias must be included in the font search path. By default, the font search path includes the misc, 75dpi, and 100dpi directories in /usr/lib/X11/fonts.

You can specify any number of aliases in fonts.alias files.

Step 2: Resetting the font database

If you created a font alias during a Graphical Environment session, you must tell the X server to reread the font database so it recognizes your new alias. To reset the font database, enter the following command from a scoterm window:

xset fp rehash

You must reset the font database whenever you edit a fonts.alias file while running a Graphical Environment session.

If you created a font alias from the operating system command line (and your SCO OpenServer system was not running), there is no need to update the X server. The changes that you made to fonts.alias are incorporated automatically the next time you start your system.

Next topic: Adding a font to your system
Previous topic: Other command line font options

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003