Common Desktop Environment: Help System Author's and Programmer's Guide

Understanding Font Schemes

When you write a help volume using the HelpTag markup language, you don't specify the fonts and sizes of the text. When you run the HelpTag software, the elements that you've entered are formatted into run-time help files that include text attributes.

A font scheme maps text attributes to actual font specifications. For example, if a help topic is formatted using a bold, sans serif typeface, the font scheme identifies which Common Desktop Environment standard font or X font is actually used to display the text.

One of the primary uses of font schemes is to provide a choice of font sizes. The HelpTag software formats the body of most topics as 10-point text. However, because the actual display font is determined by the font scheme being used, all 10-point text could be specified to use a 14-point font.

Font Resources

Each font scheme is actually a set of X resources. These resources are read by the application displaying the help. If you want to change the font scheme, you can set font resources in your application's application defaults file.

Each resource within a font scheme has this general form:

*pitch.size.slant.weight.style.lang.char-set: font specification

Where:

pitch

Specifies the horizontal spacing of characters. This field should be either p (proportional) or m (monospace).

size

Specifies the height of the desired font. For help files formatted with HelpTag, this value should be 6, 8, 10, 12, or 14.

slant

Specifies the slant of the desired font. Usually this field is either roman for upright letters or italic for slanted letters

weight

Specifies the weight of the desired font. Usually this field is either medium or bold.

style

Specifies the general style of the desired font. For help files formatted with HelpTag, this value should be either serif or sans_serif.

lang

Specifies that volumes compiled using this language should use these fonts. Usually the entry uses an * (asterisk) so that all volumes using the specified char_set will use these fonts.

char-set

Specifies the character set used to author the help text. This value must match the character set that was specified when HelpTag was run. The default is ISO-8859-1. Some special characters are displayed using a symbol character set.

An * (asterisk) can be used in a field to specify a font that has any value of that particular attribute. For instance, the symbol set (for special characters and special symbols) distinguishes a unique font based only on size and character set.

Its font resources appear like this within a font scheme:

*.6.*.*.*.*.DT-SYMBOL-1:  -adobe-symbol-medium-r-normal-*-*-60-*-*-
p-*-adobe-fontspecific
*.8.*.*.*.*.DT-SYMBOL-1:  -adobe-symbol-medium-r-normal-*-*-80-*-*-
p-*-adobe-fontspecific
 *.10.*.*.*.*.DT-SYMBOL-1: -adobe-symbol-medium-r-normal-*-*-100-*-*-
p-*-adobe-fontspecific
 *.12.*.*.*.*.DT-SYMBOL-1: -adobe-symbol-medium-r-normal-*-*-120-*-*-
p-*-adobe-fontspecific
 *.14.*.*.*.*.DT-SYMBOL-1: -adobe-symbol-medium-r-normal-*-*-140-*-*-
p-*-adobe-fontspecific

The char-set field is the only field that cannot use the * (asterisk).

To display multibyte languages, such as Japanese or Korean, font resources must be specified using a font set. A font set is actually a group of fonts. A resource entry for a font set is similar to a single font, except a , (comma) separates multiple font names and the specification ends with a : (colon). Here is an example of a fully specified font resource for a Japanese font set.

bridge-gothic-medium-r-normal--18-180-75-75-c-80-jisx0201.1976-0,
bridge-gothic-medium-r-normal--18-180-75-75-c-160-jisx0208.1983-0,
bridge-gothic-medium-r-normal--18-180-75-75-c-160-jisx0212.1990-0: 

You can also specify fonts for a multibyte language by providing a minimal XLFD font specification and allowing the system to supply the character set value to produce a font set.

*.12.roman.medium.*.ja_JP.EUC-JP: -*-*-*-*-*-*-*-120-*-*-*-*-*-*:

When specifying a font set, remember to end the specification with a : (colon). This instructs the Help System to load a set of fonts to display the information. Font sets are used to display multibyte languages. For volumes containing single-byte information, use the standard font specification.

Sample Font Schemes

The /usr/dt/dthelp/fontschemes directory contains four font schemes:

fontDef.fns

Default fonts used by the Help System

fontLarge.fns

Example of a larger font

fontMulti.fns

Example of a multi-byte font

fontX11.fns

Example of standard X11 fonts

To Choose a Font Scheme

    Edit the application-defaults file for the application that displays the online help. Replace the current font resources (if any) with the new scheme.

If you are making this change just for yourself, copy the application-defaults file into your home directory before editing it.

Example

To use a larger size font (in the help dialogs) of a personal application named DtStopWatch, perform these steps:

Change to your home directory:

cd

Then copy the DtStopWatch application-defaults file and make it writable:

cp /usr/dt/app-defaults/C/DtStopWatch .
chmod u+w DtStopWatch

Edit the DtStopWatch file to add the largest scheme (fontLarge.fns). Go to the end of the file, and insert the contents of this file:

/usr/dt/dthelp/fontschemes/fontLarge.fns

Save your new DtStopWatch file.

Start the DtStopWatch application, select Help, and verify that help topics are displayed using the new font scheme.