HPlogo Using the X Window System > Chapter 6 Using Fonts

The fonts.dir File

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

In directories containing scalable and/or bitmapped fonts, the X and font servers associate each font file name with the XLFD font name by means of the fonts.dir file. This file is created by the installation process, or by executing the mkfontdir (for directories that contain only bitmapped fonts), or stmkdirs (for directories that contain bitmapped and/or scalable fonts) utility. The stmkdirs utility is described in more detail in the section on font administration.

You should run mkfontdir or stmkdirs after you add or delete fonts from a directory, so that the change is reflected in fonts.dir. You can view the list of fonts in a font directory, and their XLFD names, by examining the fonts.dir file in that directory.

Scalable typefaces listed in fonts.dir have some values set to zero.

A fonts.dir file looks similar to this:

   7

   helvO08.pcf.Z -adobe-helvetica-medium-o-normal--8-80-75-75-P-47-hp-roman8

   helvBO08.pcf.Z -adobe-helvetica-bold-o-normal--8-80-75-75-P-48-hp-roman8

   helvR08.pcf.Z -adobe-helvetica-medium-r-normal--8-80-75-75-P-46-hp-roman8

   ant_oliv.ifo -agfa-antique olive bold-bold-r-normal-91118-0-0-0-0-p-0-hp-td00000000

   ant_oliv.ifo -agfa-antique olive compact-normal-r-compact-91120-0-0-0-0-p-0-hp-td00000000

   ant_oliv.ifo -agfa-antique olive italic-normal-i-normal-91846-0-0-0-0-p-0-hp-td00000000

   ant_oliv.ifo -agfa-antique olive-normal-r-normal-91119-0-0-0-0-p-0-hp-td00000000

In this example:

  • The first line lists how many bitmapped fonts and scalable typefaces are described by the file, in this case 7.

  • The rest of the lines give the file name and XLFD name that describes the file.

    • The 3 lines starting with helv... are 3 different bitmapped fonts. They are different versions of the "Helvetica" style made by Adobe. They are all 8-points in size, but differ in the slant and boldness.

    • The last 4 lines are 4 scalable typefaces. Several fields in the reference XLFD name are set to zero. In the request XLFD name you use to request one of these fonts, you supply values for either the PointSize or the PixelSize.

The X server tries to match your request with the bitmapped fonts and scalable typefaces listed in the fonts.dir file as follows: The server looks in the directories in your font path in the order shown by xset q.

  • Bitmap fonts.

    The server uses the first font that it finds that meets all the criteria you specified in the XLFD name. If you specified everything, it will try to find the exact match. If you used the wild cards (* or ?), it will use the first font that matches the parts you did specify.

  • Scalable typefaces.

    The PixelSize, PointSize, ResolutionX, and ResolutionY fields in the reference XLFD name are zero. Your request XLFD name should specify either the PixelSize or PointSize (but not both). The server returns a font made from the outline with the specifications you requested.

If none of the above results in a font being returned, the X server returns an error message.

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