[Top] [Prev] [Next] [Contents] [Index]

Font Use Overview

The X server depends on downloading fonts from hosts to satisfy most client font requests.

The X server locates fonts by searching the directories in its font path or handing off requests to font servers in its font path.The default font path directs the terminal to search the font directories supplied with the NCDware distribution.

After locating the requested font, the X server displays the requested characters in client windows.

Terminals also have built-in fonts to use with initial installation or to use with clients in case downloaded fonts are not available, and terminals have a default font for clients that do not request fonts.

Font Access Sequence

An NCD terminal accesses fonts in the following order:

  1. When the terminal is reset, it loads the built-in fonts and uses them for initial displays.

  2. When a client requests a font, the X server checks terminal memory to see if the font is already in use by another client. If the font is in use, the X server uses the font in memory for the new font request.

    If the font is not in use, the X server checks its font cache to see if the font was in use and was closed. A font is placed in the font cache after it is closed by the last client using it. If the font is in the cache, the X server retrieves it to satisfy the new font request.


    If the font is not in use and not in the cache, the X server checks each element (font directory or font server) in its font path.

  3. If the requested font is being handled by a font server, the X server hands off the font request to the font server. The font server creates a bitmap in the desired point size and resolution and returns it to the X server.

    If the font is not being handled by a font server, the X server directly opens the font file and reads it over the network into terminal memory.

  4. When the X server obtains a font, either through direct file access or from a font server, it displays the characters requested by the client on the screen.

  5. If the server does not find the font requested by the client, the X server returns an error message to the client. Usually, the client requests another font. If not, you can arrange to provide another font through font aliasing.

Font Names

In the X Window System, fonts are named using the XLFD (X Logical Font Description) conventions. XLFD names supply information about the developer of the font, the font family, and various characteristics of the font, including size, weight, and dots per inch.

An XLFD name consists of 14 fields separated by hyphens. The fields in the following example font name are described in Table 7-1:


-adobe-courier-medium-r-normal--8-80-100-100-m-50-iso8859-1

Table 7-1 XLFD Field Descriptions
Field Name Example
Description
Foundry adobe Developer of the font, also called the foundry.
Family courier The font family, such as Courier, Helvetica, or Times.
Weight medium Weight, usually bold or medium.
Slant r Slant (i for italic, o or oblique, r for roman, ri for reverse italic, and ot for other).
Set-width normal Width of the characters: condensed, semi-condensed, narrow, normal, or double-wide.
Style (not used) Additional information to identify a font: i for informal, r for roman, serif for serif, and sans for sans serif. This field is rarely used; two hyphens are used as a place holder.
Pixel size 8 Height of the characters in pixels; a zero in this field means the font is a scalable font.
Point size 80 Height of the font in tenths of a point (decipoints); a zero in this field means the font is scalable.
Horizontal dpi 100 Horizontal resolution in dpi (dots per inch); a zero in this field indicates a scalable font.
Vertical dpi 100 Vertical resolution in dpi (dots per inch); a zero in this field indicates a scalable font.
Spacing m Convention for placing characters next to each other, such as m for monospaced, p for proportional, and c for character-cell monospaced.
Average width 50 Average width in tenths of a pixel; a zero in this field indicates a scalable font.
Charset registry iso8859 The organization or standard registering the character set, usually ISO 8859.
Charset encoding 1 The actual character set. iso8859-1 is ISO Latin-1, an ASCII character set that includes special European characters.

Wildcards in Font Names

Any field in a font specification can be replaced by a wildcard, which is a special character that allows any font to match the property represented by a wildcard:

For example, the font name:


-*-fixed-bold-r-normal--13-120-*-*-*-*-*-*

matches these fonts:


-misc-fixed-bold-r-normal--13-120-75-75-c-70-iso8859-1
-misc-fixed-bold-r-normal--13-120-75-75-c-80-iso8859-1

When searching for a font, the X server uses the first font it finds that meets all the criteria specified in the font name. If you use wildcards instead of specifying all properties, the X server uses the first font that matches the properties you specify.

Wildcards provide flexibility because a usable font can be substituted if the intended font is not found. A complete font name specification with no wildcards may cause a client to fail if the X server cannot find the font that exactly matches the specification.

Bitmap and Outline Font Naming

Bitmap font names differ from outline (scalable) font names in the amount of information specified. A bitmap font name has data in all fields. An outline font name has 0s (zeros) in all of the size fields: the size of the characters in pixels, the size in tenths of points, horizontal resolution, vertical resolution, and average width. Outline font names look similar to the following:


-*-courier-*-*-*--0-0-0-0-m-0-*-*

Specifying Fonts for Clients

You can specify fonts for a client as X resources or in the client's command line, with the -fn option. When specifying a font you must use the XLFD font name, with or without wildcards. The following examples show font specifications in a resource setting and in a command line:


xterm*boldfont: -adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1
% xterm -fn -adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1

If you are using a font name with asterisks in a command line, the font name must be surrounded by single quotes to prevent the UNIX shell from interpreting the asterisks. For example:


% xterm -fn '-*-courier-bold-r-normal--20-140-*-*-*-*-*-*'

For outline fonts, you must provide a well-formed font name in the font specification. A well-formed font name contains all 14 hyphens specified in the XLFD convention. Wildcards are permitted for any field. For example, this is not a well-formed name because it does not contain all 14 hyphens:


-*-helvetica-bold-o-*-*-*-120-*

This is a well-formed name:


-*-courier-*-*-*--0-0-0-0-m-0-*-*

Obtaining Fonts

The NCDware distribution includes the full set of fonts in the MIT X Window System distribution plus several outline fonts. If you installed fonts when you ran ncdinstall, you should have some or all of the following fonts installed:

You can obtain X fonts from vendors of the X Window System, from font vendors, and from the public domain. In addition, your host computers may already have fonts installed on them. Fonts must be in a format that the terminal can use. (See "Font Formats".)

The NCDware distribution also includes outline, or scalable, fonts. For information about outline fonts, see "Usable Font Formats with a Font Server".

Font Download Methods

Fonts can be accessed from the network by using the file service and network protocols or by using one more font servers. If you are accessing fonts through the file service, you can use the following network protocols:

By default, an NCD terminal searches for fonts on the boot host (the host from which the X server is downloaded). If you have set up initial file server hosts, the terminal also searches for fonts on the initial file servers.

Considerations in Using Downloaded Fonts

Font files require a lot of disk space, so make sure you install only the fonts you need. Fonts in the NCDware distribution may be duplicates of fonts already installed on network hosts.

Fonts can be installed on any computer on the network, and the fonts used by a given terminal can be distributed on several hosts.

The font path uses terminal memory so you should include in the font path only the directories required by clients you are running.

Problems with Client Font Requests

When a client requests a font that the X server cannot find, an error response is sent to the client. Usually, clients continue to run, using the X server's default font. Occasionally, a client crashes when requested fonts are not available.

Problems with client font requests can be overcome by changing the font path, using font aliasing, using X resources to change the fonts requested by the client, using wildcards in font requests, or installing the fonts needed by the client.

The Font Path

A terminal's font path is made up of two types of elements: font directories and font servers. An NCD terminal attempts to access only fonts represented by elements in its font path. The X server searches the font directories (and font servers) in the order in which they are listed in the font path and uses the first match it finds.

Fonts are usually stored in subdirectories of the /usr/lib/X11/ncd/fonts directory. The default font path for NCD terminals assumes all fonts are located in subdirectories of this directory.

Font Formats

The format of a font is revealed by its filename extension. The font formats a terminal can use depend on whether the terminal is using a host-based font server. For information about fonts you can use with the NCD font server, see "Usable Font Formats with a Font Server".

Without a font server, NCD terminals use only bitmap fonts. NCD terminals use the bitmap formats listed in Table 7-2, in either uncompressed or compressed format.

Table 7-2 Usable Font Formats without a Font Server
Font Format
Description
Filename Extension
PCF (Portable Compiled Font) The standard format for X11R5 and the format of fonts in the NCDware distribution. PCF files may be shared among machines with different architectures. .pcf
SNF (Server Normal Font) A server-dependent format. NCD X servers can still read the SNF fonts supplied on previous NCDware distributions. .snf
DWF (DECWindows Format) NCD terminals can read these fonts from VMS hosts. .dwf

Bitmap fonts are often distributed in BDF (Bitmap Distribution Format), the format used to exchange fonts between systems. BDF fonts are stored as ASCII text. If you are not using a font server, you must convert BDF fonts to a binary format, such as PCF or SNF, before the terminal can use them. A utility for converting BDF to PCF is included in the NCDware distribution. For information about conversion from BDF format, see "NCD Font Management Utilities".

Font Directories and Files

Fonts are organized into font directories. Font directories contain font files and font management files. Font management files are used to locate font files.

Font Directories

Table 7-3 lists the bitmap font directories on the NCDware distribution and describes the fonts in each directory. When using TFTP to access fonts, font directories must be world-executable. When using NFS, permissions may differ. For more information about using TFTP and NFS, see Chapter 5, Configuring Network Services.

Table 7-3 Bitmap Font Directories
Font Directory
Contents
pcf/100dpi Fonts for 100-dpi terminals
pcf/75dpi Fonts for 85-dpi and 75-dpi terminals
pcf/Xol Fonts from AT&T for OPEN LOOK clients
pcf/dw100dpi Fonts for DECwindows applications on 100-dpi terminals
pcf/dw75dpi Fonts for DECwindows applications on 85-dpi and 75-dpi terminals
pcf/misc Miscellaneous fonts
pcf/Java Fonts for Java
PEX Fonts for PEX 1

1 PEX fonts are in a special PEX format.

Font Files

Font files are compiled in a specific format and must be world-readable. The name of a font file usually indicates the font family, weight, and size of the font and the font format. Font files supplied by NCD are compressed using 12-bit compression. If you add compressed font files, you must use 12-bit compression.

Font Management Files

Font management files enable the X server to locate font files.

The fonts.dir File

Each font directory contains a font directory management file called fonts.dir, which contains an entry for each font file in the directory. A fonts.dir file is required in every font directory for the X server to access any fonts in the directory. When searching for a font, the X server reads the fonts.dir files in the directories in the terminal's font path to find out where fonts are located. An example fonts.dir file follows.


200
courBO08.snf     -adobe-courier-bold-o-normal--11-80-100-100-m-60-iso8859-1
courBO10.snf     -adobe-courier-bold-o-normal--14-100-100-100-m-90-iso8859-1
courBO12.snf     -adobe-courier-bold-o-normal--17-120-100-100-m-100-iso8859-1
courBO14.snf     -adobe-courier-bold-o-normal--20-140-100-100-m-110-iso8859-1
courBO18.snf     -adobe-courier-bold-o-normal--25-180-100-100-m-150-iso8859-1
courBO24.snf     -adobe-courier-bold-o-normal--34-240-100-100-m-200-iso8859-1

The first line in the file lists how many bitmap fonts or outline fonts are described by the file. The rest of the file lists the filenames and XLFD names for all the files in the directory. The .snf filename extension shows the format in which the font is stored. For more information about font formats, see "Font Formats".

The font directory management files in bitmap font directories are not designed to be edited by hand. Use the ncdmkfontdir(1) utility. Font management utilities are included on the NCDware distribution; their use is described in "NCD Font Management Utilities".

The fonts.alias File

Applications sometimes request unavailable fonts. As a result, the application might use undesirable default fonts, crash, refuse to run, or run poorly. To avoid such problems, you can instruct the server to substitute a different font for the one requested by creating an entry in the font alias management file, called fonts.alias, in the font directory where the substitute font resides.

Entries in the font alias management file consist of the name used by the application in the font request and the XLFD description of the substitute font. A portion of an example fonts.alias file follows.


lucidasans-8 -b&h-lucida-medium-r-normal-sans-11-80-100-100-p-63-iso8859-1
lucidasans-10 -b&h-lucida-medium-r-normal-sans-14-100-100-100-p-80-iso8859-1
lucidasans-12 -b&h-lucida-medium-r-normal-sans-17-120-100-100-p-96-iso8859-1
lucidasans-14 -b&h-lucida-medium-r-normal-sans-20-140-100-100-p-114-iso8859-1
lucidasans-18 -b&h-lucida-medium-r-normal-sans-25-180-100-100-p-142-iso8859-1
lucidasans-24 -b&h-lucida-medium-r-normal-sans-34-240-100-100-p-191-iso8859-1
fixed -misc-fixed-medium-r-semicondensed--13-120-100-100-c-60-iso8859-1
variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-*-*
5x8 -misc-fixed-medium-r-normal--8-80-100-100-50-iso8859-1
6x9 -misc-fixed-medium-r-normal--9-90-100-100-c-50-iso8859-1
6x10 -misc-fixed-medium-r-normal--10-100-100-100-c-50-iso8859-1
6x13bold -misc-fixed-bold-r-semicondensed--13-120-100-100-c-50-iso8859-1

The first font specification on a line is the unavailable font, and the second is the substitute font. When both font names are too long for one line, the line automatically wraps to the next line.

As illustrated in the example file, you can specify a variety of font names, including names that were used with Releases 1 and 2 of the X11 server (the last six entries).

NCD Font Management Utilities

The following font utilities are installed by ncdinstall in /usr/bin/X11:

Built-In Fonts Summary

HMX series and Explora series terminals have the following built-in fonts:

10x20.snf
6x10.snf
6x13.snf
8x13.snf
9x15.snf
cursor.snf
helvB10.snf
helvB12.snf
term14.snf

If the terminal is licensed for PEX, the roman.phont and roman_m.phont built-in fonts are also available.



[Top] [Prev] [Next] [Contents] [Index]

Send comments, suggestions, or questions about this document to the NCD Technical Publications Department by Internet e-mail. Write to us at techpubs@ncd.com.
Copyright © 1997, NCD Inc. All rights reserved.