HPlogo Using the X Window System > Chapter 6 Using Fonts

Using the X11R5 Font Server

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

The Networked font server provides font services to one or more X display servers in a networked environment. It allows a font administrator to distribute fonts to all X servers from a central administration point. The font server also provides increased font capabilities over those built into the HP X display server — unlike the X display server, the font server understands scalable fonts as well as bitmapped fonts.

In an environment without a font server, the X server is able to load bitmapped fonts from directories in its font path:

Figure 6-1 An Environment Without a Font Server

[An Environment Without a Font Server]

In an environment with a font server, the X server can also load fonts from a font server:

Figure 6-2 An Environment With a Font Server

[An Environment With a Font Server]

The font server itself obtains fonts from directories or from other font servers. Unlike the X server, the font server can read scalable fonts as well as bitmapped fonts:

Figure 6-3 Font Server Reads Scalable and Bitmapped Fonts

[Font Server Reads Scalable and Bitmapped Fonts]

The connection between the X server and a font server is over a TCP network connection: the font server can be running on the same machine as is the X server, or on a remote machine that is acting as a font source for multiple X servers.

A font server is shipped with Hewlett-Packard's X11R5 distribution. If the system has not been configured to start the font server automatically (refer to “Starting the Font Server at Boot Time”), then the font server can be started automatically with the command:

   /usr/bin/X11/fs -daemon

This starts a font server in its default configuration at its default TCP port of 7000. Any X server started on the same system after the font server is started will automatically gain access to the fonts provided by that font server, including the licensed scalable Intellifont and Type 1 fonts in the /usr/lib/X11/fonts/ifo.st and /usr/lib/X11/fonts/type1.st directories.

Managing the Font Server's Configuration

By default, a font server accepts connections from font clients (such as X servers) at TCP address 7000, and configures itself according to information in the file /etc/X11/fs/config. Both of these defaults can be overridden with command-line options. See the fs(1) man page for more information.

Like the X server, a font server has a font path, a list of sources from which it can get fonts. There are three major differences between the font server's font path and the X server's font path:

  • The font server font path is specified in the configuration file, and cannot be changed by a protocol request from a font client. For example, an X server can add or remove font servers to or from its font path, but it cannot tell a font server to change its own font path.

  • The font server font path can be changed by modifying the configuration file and sending a signal SIGUSR1 to the font server.

  • The font server font path can include directories containing scalable fonts, such as /usr/lib/X11/fonts/ifo.st and /usr/lib/X11/fonts/type1.st.

Like an X server, a font server can have font servers in its path. That is, font servers can be "chained." Font server chaining can be used to implement powerful and flexible networks of font sources. For example, figure 6-4 shows a company-wide font server with department-specific font servers.

Figure 6-4 Chaining Font Servers

[Chaining Font Servers]

All users in Department A and Department B add their respective department's font server to their font path. The font administrator on each machine serving fonts then decides how to configure that font server for use by that department. In this case, he adds the company font server to the font path.

You can modify this path, as well as other configuration parameters, by editing the configuration file. See the fs(1) man page for information about all of the options in the configuration file.

Starting the Font Server at Boot Time

The behavior of the font server at system boot time is determined by system configuration files. Be default, the font server does not automatically start at boot time. You can change this behavior with the mk_fnt_srvr command.

If boot-time startup of the font server is enabled, the resulting font server will run at the default font server TCP address of 7000, and use the default configuration file /usr/lib/X11/fs/config.

Refer to the mk_fnt_srvr(1M) man page for more details.

The standard X interface provides a detailed description of the font by means of the X logical font description (XLFD) name. The XLFD name is a string of characters that describes properties of the font you want.

In X11R5, the XLFD standard supports both bitmapped and scalable fonts. In addition, HP has extended the standard to provide more capabilities with scalable fonts — that is, the ability to generate more variations on scalable fonts. These extensions are described in the following sections.

The form of the XLFD is 15 fields separated by dashes. These fields are explained later in this section.

"FontNameRegistry-Foundry-FamilyName-WeightName-Slant -SetwidthName-AddStyleName-PixelSize-PointSize-ResolutionX -ResolutionY-Spacing-AverageWidth-CharSetRegistry -CharSetCoding"

For example,

   -adobe-courier-bold-o-normal--10-100-75-75-m-60-hp-roman8

specifies a courier, bold, oblique bitmapped font created by Adobe. The font is 10 pixels tall, 100 tenths of a point tall on a 75dpi×75dpi display. Characters are monospaced, and are an average of 60 tenths of a pixel wide. Fonts codes are based on the HP Roman8 encoding.

What is actually in the XLFD name differs depending on where in the font-request process the string is being used:

reference XLFD

This is the XLFD name shown by fonts.dir and the xlsfonts client.

Scalable typefaces have the PixelSize and PointSize fields set to zero.

request XLFD

This is the XLFD name you use to request a font. It is also the XLFD name you use in a fonts.alias file.

Any field in the list can be replaced by the "*" wild card. Any character in the list can be replaced by the "?" wild card.

resolved XLFD

This is the XLFD name that the server returns when it has filled your font request. All the fields are filled in with the correct values for that font. However, they may not be the same values as in the request XLFD.

XLFD Syntax

This section explains the meaning of the fields in the XLFD name. Examples of the use of these fields are in a later section.

The XLFD name is long, so you can assign a shorter nickname, or alias, for the font, which you then use in place of the long string. Aliases are discussed in “The fonts.alias File” later in this chapter.

You may use either upper-case or lower-case letters when you specify a characteristic. Reference XLFD names are all lower-case.

The text "[extensions]" means that there are optional extensions to the standard XLFD fields that are used to generate additional font variations. Notice that the underscore (_) character is used in some extensions to avoid confusion with the dash (-).

NOTE: These HP extensions may be superceded in later releases the X Windows System, as the industry-standard XLFD is expanded to include the functions that are now available only through these extensions.

FontNameRegistry

The authority that registered the font. Usually left blank. If there is a value in the field, it is of the form +version, where version is the version of some future XLFD specification.

Foundry

The name of the digital type foundry that digitized the font data.

FamilyName

The trademarked commercial name of the font. If the FamilyName contains spaces, do one of the following for a request XLFD name:

  • Enclose the entire XLFD name in double quotes ("). For example, this fonts.alias file line.

       italic "-agfa-cg century schoolbook italic-normal-i-*-*--240---p-150-*-roman8" 
    

  • Use wild cards for part of the field.

       italic -agfa-*schoolbook*italic-normal-i-*- *--240---p-150-*-roman8
    

WeightName[extensions]

The relative weight of the font, such as bold.

For scalable typefaces, the user may specify that the font be darker (bolder) or lighter than the normal for that font. The syntax for this optional extension is:

horiz_valuevert_value] ]

horiz_value,vert_value

The increase (+) or decrease (_) in boldness. A value of 4000 for a normal font simulated the bold version of that font.

If only one delta and value are specified, they apply to both directions. Emboldening and lightening are currently supported only for Intellifont scalable typefaces.

Figure 6-5 The Same Font at Increasing Weights

[The Same Font at Increasing Weights]

Slant[extensions]

A code indicating the direction of the slant for the font.

r

Roman (no slant)

i

Italic (slant left)

o

Oblique (slant left)

ri

Reverse italic (slant right)

ro

Reverse oblique (slant right)

For scalable typefaces, the user can request additional slanting from the normal. The syntax for this optional extension is:

±value

±value

The angle in 1/64 degree ranging from 0° to 75° (0-4800). (0.5° = 32, 1° = 64, etc) Values outside of that range will be truncated to ±75°. Use + for counterclockwise angles; use_ for clockwise angles.

Figure 6-6 The Same Font with Different Slants

[The Same Font with Different Slants]

SetwidthName

The width-per-unit of the font, such as compressed or expanded.

AddStyleName[extensions]

A description of anything else needed to uniquely identify the font, such as serif or cursive.

For scalable typefaces, users can specify that the font be mirrored or rotated. The syntax for the optional extension is:

[+Mx +My] [ ±angle]

+Mx, +My

Mx mirrors the font horizontally, and My mirrors the font vertically.

angle

± the amount of rotation from normal in 1/64th degree increments. Use + for counterclockwise angles; use _ for clockwise angles.

Figure 6-7 Font Mirrored Horizontally and Vertically

[Font Mirrored Horizontally and Vertically]

Don't confuse "slant" with "rotation". A character that has been slanted has its base in the normal position and the top pushed to one side. A character that has been rotated has been moved around some central pivot point.

PixelSize [Extensions}

An integer describing the height of an EM square in pixels.

For scalable typefaces, you can increase or decrease the horizontal size to make a font wider or narrower than normal for that font. The syntax for this optional extension is

[+pixelwidth]

pixelwidth

The horizontal size in pixels. If this field is not specified, it is assumed to be the same as PixelSize.

For example, 20+10 requests a font 20 pixels high and 10 pixels wide (or, more accurately, a 20-pixel font whose width is half its normal width).

The PixelSize and PointSize fields are related through the ResolutionY field in the XLFD name (see below). You should specify a font by using either PixelSize or PointSize, but not both. An error occurs if you specify both and they conflict.

PointSize[extensions]

An integer giving the EM square size in decipoints. For example 140 is 14 points.

For scalable typefaces, you can expand the horizontal size (set size) to make a font wider or narrower than normal for that font. The syntax for this optional extension is:

[+setsize]

+setsize

The horizontal size in decipoints. If this field is not specified, it is assumed to be the same as PointSize.

For example, "140+240" requests a font 14 points high, and 24 points wide (or, more accurately, a 14-point font whose width is that of a 24-point font).

If neither PixelSize or PointSize are specified, the assumption is 12-point. If both are specified and they conflict, an error is returned. Use either PixelSize or PointSize, but not both.

Figure 6-8 The Same Font in Different Sizes

[The Same Font in Different Sizes]

ResolutionX, ResolutionY

The horizontal (X) and vertical (Y) resolution of the device that the font was designed for, measured in pixels-per-inch. If the resolution is not specified in a request XLFD name, the X server defaults to the resolution of the display for which the font is requested.

Spacing

A code indicating the spacing between units in the font.

M

Monospaced (fixed pitch)

P

Proportional spaced (variable pitch)

C

Character cell. The glyphs of the font can be thought of as "boxes" of the same width and height that are stacked side by side or top to bottom.

AverageWidth

An integer string giving the average, unweighted width of all the glyphs in the font, measured in 1/10th device-dependent pixels.

CharSetRegistry

The registration authority that registered the specified CharSetEncoding. The XLFD conventions expect organizations that control characters to register with the X Consortium and be given a unique name to use in this field.

CharSetEncoding[extensions]

The character set from which the characters in the font are drawn.

For scalable typefaces, this field can be used to specify subsets of any of the character sets. This is a performance hint that the X or font server uses to determine which characters need to be realized. The syntax for this optional extension is:

=value,value...

value

A character or range of characters to be included in the font, specified as decimal or hex number[s]. A range is two numbers separated by a colon (:). For example,

   =65,0x45,80:85

specifies the characters "A," "E," and "P" through "U."

If an application requests a character not in the subset, then:

  • If the font's usual default character (typically space) is in the subset, that character will be substituted.

  • Otherwise, the result is font-dependent.

Using the XLFD Font Name

You use the XLFD name or alias whenever you need to specify a font. Some locations are:

  • Application default or resource files, for example:

       hpterm*Font:   fontname
    

  • Command line to start clients or applications, for example:

       xclock -digital -fn fontname
    

  • The fonts.dir file. Refer to “The fonts.dir File”.

  • The fonts.alias file. Refer to “The fonts.alias File”.