HPlogo Using the X Window System > Chapter 6 Using Fonts

The fonts.alias File

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

A font can be referred to by an alias. The alias is shorter and easier to remember (and type) than the complete font description. Aliases are found in the fonts.alias file. The fonts.alias file need not be in each font directory, but the directory containing it must be in the font path.

A simple fonts.alias file is created as part of installing the font. The fonts.alias file is in this format:

   "FILE_NAME_ALIASES"

   alias-name xlfd-name

where:

alias-name

is the nickname for the font.

xlfd-name

is the XLFD name that specifies the font. If the family name contains spaces, enclose the whole XLFD name in quotation marks(").

The fonts.alias file provides for two types of alias names:

  • The font's file name.

    If the string "FILE_NAMES_ALIASES" occurs in the fonts.alias file, then a font can be referred to by its file name alone, without the path name or extensions. The X server will look in all the directories in your font path.

  • A name you select.

    You can specify what alias to use for referring to a font.

Any fonts not in the fonts.alias file must be referred to by the XLFD name.

When you edit a fonts.alias file, any X or font servers using that directory must be informed that they need to reread the file. To force an X server to read its font.alias files, run

   xset fp rehash

To force a font server to read its fonts.alias files, run

   kill -USR1 pid

where pid is the process ID of the font server.

Using Alias Names

For example, with this fonts.alias file and the fonts/hp_roman8/75dpi subdirectory of the system directory in the font search path:

   "FILE_NAMES_ALIASES"

   ellen *-adobe-courier-bold-r-normal-*-8-80-75-75-m-50-hp-roman8

then you can use any of the following commands to start a digital clock using this font:

  • The "FILE_NAMES_ALIASES" entry lets you use just the file name, without the path or extension.

       xclock -digital -fn CourB08
    

  • The alias name you specified.

       xclock -digital -fn ellen
    

  • You can always specify the XLFD name, whether or not you have a fonts.alias file.

       xclock -digital -fn *-adobe-courier-bold-r-normal-*-8-80-75-75-m-50-hp-roman8
    

  • You can specify enough of the XLFD fields to identify the font characteristics you want, and represent the rest with wildcards, with 14 dashes separating the fields. The X server selects the first font in its search path that matches the specification.

       xclock -digital -fn *- *-courier-bold-r-normal-*-8-*- *- *- *- *-hp-roman8
    

This is useful for vendor independence--you can have the same programs and default files on different vendors' computers, and customize by making the appropriate entry in the fonts.alias file.

© 1995 Hewlett-Packard Development Company, L.P.