Solaris X Window System Developer's Guide

Chapter 4 Font Support

This chapter provides information on font support in the Solaris X server. The chapter includes information on the following topics:

Font Support in the Solaris X Server

The Solaris X Window System provides font support in both the X11 server and the Display PostScript (DPS) extension. Font formats from numerous vendors can be used to display text in English or foreign languages, including Asian languages. Symbol fonts can be used to display mathematical equations. The Solaris environment provides 55 Latin fonts for west European text and two symbol fonts. Other fonts can also be added to the system using the Font Administrator GUI or command line tools distributed with Solaris.

X Font Server

The Solaris X server can be a client of the X font server xfs. The X font server renders fonts for the X server. The Solaris X font server supports the same fonts as the standard X font server, plus TrueType fonts from Sun. It does not support Sun's proprietary F3 font format. Support for Type 1 fonts is provided via the Type 1 interpreter donated to the X Consortium.

xfs can be started manually or automatically. For more information on this command, see the xfs(1) man page.

Available Font Formats

Fonts from different vendors come in different formats. Table 4–1 and Table 4–2 list the various font formats, their vendors, and the associated file types supported by the Solaris environment. Table 4–1 lists outline fonts; Table 4–2 lists bitmap fonts.

Table 4–1 Outline Font Formats

Font Format 

Vendor 

File Type 

TrueType 

Various foundries 

.ttf

Type1 (ASCII) 

Adobe and various foundries 

.pfa

Type1 (binary)  

Adobe and various foundries 

.pfb

Type 3 

Adobe and various foundries 

.ps

Speedo 

Bitstream 

.spd

F3 

SunSoft 

.f3b

Table 4–2 Bitmap Font Formats

Font Format 

Vendor 

File Type 

Portable compiled format 

MIT 

.pcf

Bitmap distribution format 

Adobe 

.bdf

Big Endian prebuilt format 

Adobe (for sparc) 

.bepf

Little Endian prebuilt format 

Adobe (for IA and ppc) 

.lepf

The fonts provided by the Solaris X server are located in the /usr/openwin/lib/X11/fonts directory. For more information on the directory structure, see Locating Fonts.

The Solaris environment is configured so that most X11 fonts are also available in DPS (see Table 4–3). DPS supports a slightly different set of fonts than those supported by X11.

Table 4–3 Font File Availability

Font Format 

Available in X11 

Available in DPS 

TrueType 

Yes 

Yes 

Type1 outline fonts-ASCII 

Yes 

Yes 

Type1 outline fonts-binary 

Yes 

Yes 

Type 3 

Yes 

Yes 

Speedo 

Yes 

No 

F3 

Yes 

Yes 

Portable compiled format 

Yes 

Yes 

Bitmap distribution format 

Yes 

No 

Big Endian prebuilt format 

No 

Yes 

Little Endian prebuilt format 

No 

Yes

Optional Font Package

Fonts needed by end-user applications are installed with the End-User Cluster. However, some unusual applications may need fonts in the Developer Cluster. For these applications, the package to add is the SUNWxwoft package. It is not necessary to install the entire Developer Cluster.

Associated Files

The Solaris environment provides files with these extensions. They are not intended to be edited.

Outline and Bitmap Fonts

Solaris supports two types of font representation: outline fonts and bitmap fonts. To display a letter from an outline font, the server scales and rotates only the outline of the character. This repositioned outline is then rendered into pixel form (bitmap) for display on the screen. This rendered bitmap is also stored in the glyph cache for reuse.

Because certain font sizes occur frequently, they are also kept in separate files in pre-rendered bitmap form. This saves the server from having to scale and render them. However, the resulting bitmap fonts can be displayed in only one size and orientation. Some of the fonts have also been hand-tuned to look better and be more readable. As they are encountered, these bitmaps are also placed in the glyph cache. The recommended bitmap format is the portable compiled format (.pcf).

The /usr/openwin/bin directory contains the following tools to convert fonts between the outline and bitmap font representation, as well as between various bitmap formats. See the corresponding man pages for more detailed information.

As illustrated in Table 4–4, many bitmap font file formats are architecture-dependent binary files. They cannot be shared between machines of different architectures (for example, between SPARC and IA).

Table 4–4 Bitmap Font Binaries

Font Format 

Binary 

Architecture-Specific 

Bitmap distribution format 

No 

No 

Portable compiled format 

Yes 

No 

Little Endian prebuilt format 

Yes 

Yes (IA and ppc) 

Big Endian prebuilt format 

Yes 

Yes (SPARC) 

The Solaris environment contains compressed .pcf files (files with .pcf.Z extensions). You can uncompress these if you want. If you add fonts to your system, you can either compress the files or not. Use uncompressed files if you want the fonts to display somewhat faster. Leave the files compressed if you want to conserve disk space. For more information, see the compress(1) man page.

Replacing Outline Fonts With Bitmap Fonts

The Solaris environment automatically replaces some outline fonts with bitmap fonts when the size is appropriate. This improves performance, and in some cases improves the aesthetics and readability of the text. There may be several sizes at which replacement occurs for a given outline font.

Replacement Conditions

Currently in DPS, the .pcf bitmap format is substituted for F3 outline fonts, Type1 and TrueType fonts. Substitution occurs when there is no rotation, the requested pixel size is within one half of a pixel of the .pcf font size, and the .pcf font is a resource in a .upr (PostScript resource) file. The .pcf format can be substituted for all scalable versions of the fonts mentioned above.

Using TrueType and F3 Fonts in DPS

TrueType and F3 fonts behave exactly like Type1 fonts, except /FontType returns 42 for TrueType and 7 for F3 fonts. For example, the following PostScript code works the same regardless of the kind of font.

/Helvetica
findfont 50 scalefont setfont 10 10 moveto (ABC)

show

But the following code yields 42 for a TrueType font, 7 for an F3 font, and 1 for a Type1 font.

currentfont
/FontType get ==

The kind of font returned depends on the current DPS internal resource path.

Locating Fonts

By default, the Solaris server looks for fonts in directories under the /usr/openwin/lib/X11/fonts directory. Table 4–5 shows the complete font directory structure. The directory names are preceded by /usr/openwin/lib/X11/fonts.

Table 4–5 Font Directory Structure

Directory 

Subdirectory 

File Suffixes 

Contents 

/TrueType 

 

.ttf 

TrueType fonts 

/TrueType 

/ttmap 

.ttmap 

TrueType character set specifications 

/TTbitmaps 

 

.pcf 

Bitmap fonts 

/100dpi

 

.pcf

Bitmap fonts 

/75dpi

 

.pcf

Bitmap fonts 

/F3

/afm

.f3b

F3 format outline fonts 

 

/map

.map

F3 character set specifications 

/F3bitmaps

 

.pcf

Bitmap fonts 

/Speedo

 

.spd

Bitstream Speedo format outline fonts 

/Type1

 

.pfa, .pfb

Type1 outline fonts 

 

/afm

.afm

Adobe font metrics 

 

/outline

.pfa, .pfb

Type1 outline fonts 

 

/prebuilt

.bepf, .lepf

Bitmaps for SPARC Solaris and IA 

/Xt+  

 

.pcf

Bitmap fonts 

/Type3

 

.ps

PostScript outline fonts 

/encodings

 

.enc

Encodings 

/misc

 

.pcf

Bitmap fonts 

Changing the Default Font Path in X11

In X11, the default font path is:

/usr/openwin/lib/X11/fonts/F3, /usr/openwin/lib/X11/fonts/F3bitmaps, /usr/openwin/lib/X11/fonts/Type1, /usr/openwin/lib/X11/fonts/Speedo, /usr/openwin/lib/X11/fonts/misc, /usr/openwin/lib/X11/fonts/75dpi, /usr/openwin/lib/X11/fonts/100dpi

Note that the directory paths must be absolute.

To change the default font path, use the Font Administrator GUI or command-line tools included with Solaris. For information about Font Administrator, see the Font Administrator User's Guide.

Installing and Managing Fonts

To install, delete, and view fonts for a workstation or NeWSprint printer, or to edit font paths or font attributes, use the Font Administrator GUI or command-line tools included with Solaris. For information about Font Administrator, see the Font Administrator User's Guide.