Solaris Common Desktop Environment: Programmer's Guide

Standard Application Fonts

Default Font Names

The set of standard application default font names is defined by the XLFD field name values described in Table 2-2 .

Table 2-2 Field Name Values for Standard Application Font Names

Field 

Value 

Description 

FOUNDRY

dt

CDE name 

FAMILY_NAME

application

CDE standard application font name 

WEIGHT_NAME

medium or bold

Weight of the font 

SLANT

r

i

Roman 

Italic 

SET_WIDTH

normal

Normal set width 

ADD_STYLE

sans

serif

Sans serif font 

Serif font 

PIXEL_SIZE

*

Platform dependent 

POINT_SIZE

pointsize

Point size of the desired font 

RESOLUTION_X

*

Platform dependent 

RESOLUTION_Y

*

Platform dependent 

AVERAGE_WIDTH

p

m

Proportional 

Monospace 

NUMERIC FIELD

*

Platform dependent 

CHAR_SET_REGISTRY

iso8859-1

Defining standards authority 

ENCODING

1

Character set number 

The standard names are available using the regular X Windows XLFD font- naming scheme. When properly specified with appropriate wildcards for the platform-dependent fields, a CDE font name is guaranteed to open a valid, corresponding platform-dependent font. The XLFD name returned from a call to the Xlib XListFont function, however, is not guaranteed to be the same on all CDE platforms.

Using these values, the XLFD pattern

-dt-application-*

matches the full set of CDE standard application font names on a given platform. The pattern

-dt-application-bold-*-*-*-*-*-*-*-p-*-*-*-

matches the bold, proportionally spaced CDE fonts, both serif and sans serif. And the pattern

-dt-application-*-*-*-*-*-*-*-*-m-*-*-*-

matches the monospaced fonts (whether serif or sans serif, or both).

The full set of CDE Standard Application Font Names can be represented as follows:

-dt-application-bold-i-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-bold-r-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-medium-i-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-medium-r-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-bold-i-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-bold-r-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-medium-i-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-medium-r-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-bold-i-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-bold-r-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-medium-i-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-*-*-*-*-p-*-dtsymbol-1

Point Sizes for Standard Application Fonts

The complete set of point sizes available for each of the standard application font names is determined by the set of fonts shipped with a vendor's CDE platform, whether bitmapped only or both bitmapped and scalable outline. The minimum set of sizes required and available on all CDE platforms corresponds to the standard sizes of bitmapped fonts that make up the default mapping for X11R5: 8, 10, 12, 14, 18, and 24.

For example, the entire set of six sizes of the plain monospaced font can be represented by the patterns:

-dt-application-medium-r-normal-*-80-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-100-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-120-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-140-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-180-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-240-*-*-*-m-*-iso8859-1

These patterns match the corresponding standard font name on any CDE platform, even though the numeric fields other than POINTSIZE may be different on various platforms, and the matched fonts may be either serif or sans serif, depending on how the vendor implemented the set of standard names.

Standard Application Font Names in app-defaults files

You can code a single app-defaults file to specify font resources for your application and use it across all CDE platforms. Because the parts of the standard names that are defined are the same across different vendors' platforms, you can specify these values in the resource specification in the app-defaults file. However, you must use wildcards for the other fields (PIXEL_SIZE, RESOLUTION_X, RESOLUTION_Y, and AVERAGE_WIDTH) because they may vary across platforms. For example, to specify some of the default resource needs for an application named appOne, you might use:

appOne*headFont:
-dt-application-bold-r-normal-sans-*-140-*-*-p-*-iso8859-1 

appOne*linkFont:
-dt-application-bold-i-normal-sans-*-100-*-*-p-*-iso8859-1

As another example, suppose that appTwo running on a vendor's platform defines two font resources for headings and hypertext links. appTwo uses a 14 point bold, serif font (Lucidabright bold) and a 12-point bold, italic sans serif font (Lucida bold-italic). You would then change the font definition from:

apptwo *headingFont:
-b&h-lucidabright-bold-r-normal--20-140-100-100-p-127-iso8859-1 

apptwo *linkFont:   
-b&h-lucida-bold-i-normal-sans-17-120-100-100-p-96-iso8859-1

to:

apptwo *headingFont: 
-dt-application-bold-r-normal-serif-*-140-*-*-p-*-iso8859-1

apptwo *linkFont:   
-dt-application-bold-i-normal-sans-*-120-*-*-p-*-iso8859-1

in your app-defaults file. Even though you may not know the names of the fonts on other CDE platforms, these platform-independent patterns specified with the CDE standard application font names match appropriate fonts on each platform.

You encode them exactly as shown, complete with the * wildcards, in your resource definitions. By applying the wildcards to the numeric fields other than point size, you ensure that the resources match CDE fonts on all platforms, even if the exact pixel size or average width of the fonts is slightly different.

See the DtStdAppFontNames(5) man page for more information.