Common Desktop Environment: Advanced User's and System Administrator's Guide

15 Administering Application Resources, Fonts, and Colors


Contents of Chapter:
Setting Application Resources
To Set System-Wide Resources
To Set Personal Resources
How the Desktop Loads Resources
Defining UNIX Bindings
To Specify EMACS-Style Translations
To Modify the EMACS-Style Translations
UNIX Bindings Provided by the UNIXbindings File
Administering Fonts
Setting Desktop Font Resources
To List Available Fonts
To Specify Fonts on the Command Line
X Logical Font Description (XLFD)
Administering Colors
Color Palettes
Color Sets
Controlling Color with Style Manager
Number of Colors Used by Style Manager
Setting Shadow Thicknesses for Application Windows
You can choose a wide range of colors and fonts for your display either by using Style Manager or by customizing additional font and color resources. This chapter discusses how to customize fonts and color resources.

This chapter also describes how to specify style translations for DtEdito r widget applications such as the desktop text editor ( dtpad ) and Mailer (dtmail ), and alternates for DtEditor widget application menu accelerators that conflict with these translations.


Setting Application Resources

Resources are used by applications to set certain aspects of appearance and behavior. For example, Style Manager (dtstyle ) provides resources that enable you to specify where the system looks for files containing information about color palettes:

dtstyle*paletteDirectories: /usr/dt/palettes/C \ HomeDirectory/.dt/palettes

App-default files for the desktop applications are located in the
/usr/dt/app-defaults/language directory.

To Set System-Wide Resources

Add the resources to the file /etc/dt/config/ language / sys.resources . (You may have to create the file.)

For example, if in /etc/dt/config/C/sys.resources you specify:

AnApplication*resource: value

then the resource AnApplication*resource will be set in each user's RESOURCE_MANAGER property at the next login.

To Set Personal Resources

  1. Add the resources to the file HomeDirectory/.Xdefaults.

  2. Double-click Reload Resources in the Desktop_Tools application group.

How the Desktop Loads Resources

Resources are loaded at session start-up by Session Manager. For information on how Session Manager loads the resources into the RESOURCE_MANAGER, see "Loading the Session Resources" .


Defining UNIX Bindings

By default UNIX bindings are not enabled.

To Specify EMACS-Style Translations

The following procedure specifies:

  1. Add the following line to the HomeDirectory/.Xdefaults file:

    #include "/usr/dt/app-defaults/language/UNIXbindings"

    where language is the value of the LANG environment variable.

  2. Restart your session.

To Modify the EMACS-Style Translations

  1. Insert the contents of the file
    /usr/dt/app-defaults/language/UNIXbindings into
    HomeDirectory/.Xdefaults.

  2. Edit the bindings in the .Xdefaults file.

  3. Restart your session when you have finished.

UNIX Bindings Provided by the UNIXbindings File

The /usr/dt/app-defaults/language/UNIXbindings file provides the following bindings:


Note: The Delete key deletes the previous character when the UNIX bindings are enabled, and Shift-Delete deletes the next character.


Administering Fonts

Using the Style Manager Font dialog box, you can select the font size you want for all applications. You can also specify fonts on the command line or use resources to:

A font is a type style in which text characters are printed or displayed. The desktop includes a variety of fonts in different styles and sizes.

A bitmap font is made from a matrix of dots. (By default, Style Manager configures bitmap fonts only.) The font is completely contained in one file. Many files are needed to have a complete range of sizes, slants, and weights.

Fonts are specified as values of resources and as parameters to commands. The X Logical Font Description (XLFD) name is the method by which a desired font is requested. The system finds the font that best matches the description it was given.

Setting Desktop Font Resources

The Style Manager Font dialog box enables you to set fonts (up to seven sizes) for things such as text entry and labels.

Resources Set by the Font Dialog Box

When a font is selected, the following resources are written to the RESOURCE_MANAGER property:

Resources Used by the Font Dialog Box

The fonts used for each selection in the Font dialog box are specified in the /usr/dt/app-defaults/Dtstyle resource file. Up to seven sizes can be specified.

NumFonts
Number of font sizes in the Font dialog box

SystemFont[1-7]
Up to seven resources assigning a specific font to a Font dialog box selection for SystemFont

UserFont[1-7]
Up to seven resources assigning a specific font to a Font dialog box selection for UserFont


Note: The default fonts for these resources have been chosen for readability on various displays. If you want a specific font for an application, set the font with an application font resource rather than changing these desktop fonts.

For more information about application fonts, seethe DtStdAppFontNames (5) and DtStdInterfaceFontNames (5) man pages.

To List Available Fonts

  1. Type the following:

    xlsfonts [-options] [-fn pattern]

    A list of XLFD names and font alias names available on your system is displayed. Bitmap fonts show values in all fourteen XLFD fields. Scalable typefaces show zeros in the PixelSize , PointSize , ResolutionX , and ResolutionY positions.

  2. To check for specific fonts, use the pattern-matching capability of xlsfonts. Use wildcards to replace the part of the pattern you are not trying to match.

  3. If xlsfonts does not show any font names starting with dt , your font path does not include the desktop fonts. Type the following command to include the desktop fonts into your available fonts:

    xset +fp directory name

    where directory name is the directory containing the desktop fonts. The default location set by session startup is /usr/dt/config/xfonts/language.

For additional information, see:

To Specify Fonts on the Command Line

Use the -xrm command-line option to specify a font resource for a specific client. For example:

application name -xrm "*bitstream-charter-medium-r-normal-8-88-75-75-p-45-iso8859-1"

X Logical Font Description (XLFD)

A font is specified by listing fourteen different characteristics, separated by dashes (-). This is called the X Logical Font Description (XLFD). In some cases, a property in the list can be replaced by a * wildcard, and a character within a property can be replaced by a ? wildcard. Table 15-4 lists font property string specifications.

The form of the property string specification is:

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



Example
The following XLFD name describes a font named charter made by Bitstream that supports the ISO8859-1 standard encoding:

-bitstream-charter-medium-r-normal--8-80-75-75-p-45-iso8859-1

It is medium weight, with no special slanting, and normal width. The font is proportional, with an em-square box of 8 pixels or 8.0 points. The horizontal and vertical resolution are both 75 pixels. The average width of a character is 45 1/10ths pixels or 4.5 pixels.

Parts of this string can be replaced by wildcards. The system uses the first font it finds that matches the parts you have specified.

If all you want is an eight-pixel charter font, you could use:

*-charter-*-*-*-*-8-* 


Administering Colors

This section describes:

Color Palettes

A palette consists a group of color sets. The color sets for the current palette are shown in the Style Manager Color dialog box

A file exists for each palette. The paletteDirectories resource specifies the directories containing palette files. By default, this resource contains:

Color Sets

Each color set in the current palette is represented by a color button in the Style Manager Color dialog box. Each color is identified by a color set ID--a number from 1 to 8.

Figure 15-1 Color set ID values for HIGH_COLOR

Each color set is composed of up to five colors. Each color button displays the background color of the color set. The five colors in each color set represent the following display component resources:

foreground
The foreground of an application window or window frame. It is always black or white. This is generally used for text within windows and titles.

background
The background of the application or the window frame.

topShadowColor
The color of the top and left bevels of application controls (such as push buttons) and window frames.

bottomShadowColor
The color of the bottom and right bevels of application controls and window frames.

selectColor
The color that indicates the active state of certain controls, such as active toggles and buttons.

The number of color sets used by each palette is determined by the colorUse resource, which the user can set using the Style Manager Number of Colors To Use dialog box.

Specifying Color Values

Style Manager uses RGB values when writing color information to its palette files. The syntax for RGB numbers is:

#RedGreenBlue

Red , Green , and Blue are hexadecimal numbers, each 1 to 4 digits long, that indicate the amount of that color used. There must be the same number of digits for each of the colors. Thus, valid color values consist of 3, 6, 9, or 12 hexadecimal digits.

For example, white can be specified in any of the following ways:

#fff
#ffffff
#fffffffff
#fffffffffffff

If you set a color resource directly, you can use either the color name or RGB value. The file /usr/lib/X11/rgb.txt lists all the named colors.

How Color Sets are Mapped to Resources

The desktop maps color sets to various display elements through resources, and makes the following assignments:

Resource
Display element

activeColorSetId
Active window frame color

inactiveColorSetId
Inactive window frame color

textColorSetId
Text entry areas

primaryColorSetId
Application's main background areas

secondaryColorSetId
Application's menu bar, menus, and dialog boxes

These resources take a color set ID as their value. Coloring display elements with color set IDs allows the element to dynamically change to the new color scheme when a new palette is selected with Style Manager.

You can use these resources for individual applications. For example, the following line shows how you would visually group all dtterm windows by using color set 8 for their primary color.

dtterm*primaryColorSetId:   8

Default Color Set Assignments

The color set IDs used for display elements depends on the Number of Colors setting in Style Manager:

Controlling Color with Style Manager

You can dynamically change color for desktop applications and other cooperating applications through Style Manager. The foreground and background colors set by Style Manager are available to non-cooperating applications.

Number of Colors Used by Style Manager

The number of colors used by Style Manager depends on the values for the following resources:

colorUse
Configures the number of colors the desktop uses

shadowPixmaps
Directs the desktop to replace the two shadow colors with pixmaps

foregroundColor
Specifies if the foreground color changes dynamically.

dynamicColor
Controls whether applications change color when you switch palettes.

Table 15-5 lists the maximum number of colors allocated by the desktop.



To determine the maximum number of colors:

  1. Multiply the number of color sets in the palette by the number of colors within each color set.

  2. Add 2 (for black and white).

However, with the following configuration you would only have ten colors in your palette: four color sets times two colors in each set (background and selectColor ) plus black and white:

*colorUse: MEDIUM_COLOR
*shadowPixmaps: True
*foregroundColor: White


Note: Multi-color icons use fourteen additional colors.

colorUse Resource

The default value of the colorUse resource is MEDIUM_COLOR. The value of this resource affects the number of color sets used in a palette. Other resources affect the number of colors used to make shadows. The value of the colorUse resource also affects the use of multi-color icons .

Value
Description

B_W
"Black and White" Style Manager setting
Displays with 1 to 3 color planes
Number of color sets: 2
Maximum number of colors: 2
Default number of colors: 2
No multicolor icons

LOW_COLOR
"Most Color for Applications" Style Manager setting
Displays with 4 to 5 color planes
Number of color sets: 2
Maximum number of colors: 12
Default number of colors: 12
No multicolor icons

MEDIUM_COLOR
"More Colors for Application" Style Manager setting
Displays with 6 color planes
Number of color sets: 4
Maximum number of colors: 22
Default number of colors: 22
Multicolor icons

HIGH_COLOR
"More Colors for Desktop" Style Manager setting
Displays with 7 or more color planes
Number of color sets: 8
Maximum number of colors: 42
Default number of colors: 42
Multicolor icons\

default
The desktop chooses the correct value for that display. (To reduce the number of colors used by the desktop for high-color displays, the default colorUse resource is set to MEDIUM_COLOR.)

shadowPixmaps Resource

The shadowPixmaps resource directs the desktop to replace the two shadow colors with pixmaps. These pixmaps mix the background color with black or white to simulate top or bottom shadow values. This reduces the number of needed colors by two, since color cells do not need to be allocated for the shadow colors.

Value
Description

True
The desktop creates a topShadowPixmap and bottomShadowPixmap to use instead of the shadow colors.

False
topShadowColor and bottomShadowColor from the palette are used.

The default value for shadowPixmaps depends on the colorUse resource you have and the hardware support for the display.

foregroundColor Resource

The foregroundColor resource specifies how the foreground is configured in a palette.

Setting
Result

White
Foreground is set to white.

Black
Foreground is set to black.

Dynamic
(Default) Foreground is dynamically set to black or white, depending on the value of background . For instance, white letters on a yellow background are difficult to read, so the system chooses black.

If foregroundColor is set to either Black or White, the number of colors in the color set is reduced by one, and the foreground will not change in response to changes in the background color.

The default value for foregroundColor is Dynamic, except where the value of colorUse is B_W.

dynamicColor Resource

The dynamicColor resource controls whether applications change color dynamically; that is, whether the clients change color when you switch palettes.

Value
Description

True
Clients change color dynamically when a new palette is selected. This is the default value.

False
Clients do not change color dynamically. When a new palette is selected, clients will use the new colors when the session is restarted.

When the value of the dynamicColor resource is True, clients that cannot change colors dynamically (non-Motif applications) allocate different cells in the color map than clients that can change colors dynamically, even if you see the same color.


Note: Since all clients can share the same color cells, setting dynamicColor to False reduces the number of colors your desktop consumes.


Setting Shadow Thicknesses for Application Windows

The desktop defines a default shadow thickness of one pixel for the components in application windows, such as button shadows and focus highlight. Motif 1.2 applications use this resource value; other applications may not obtain this resource value and therefore will appear different on the display.

To set the shadow thickness to one pixel for non-Motif 1.2 applications:

  1. Log in as root.

  2. Create the /etc/dt/config/language/sys.resources file.

  3. Specify the application-specific resource in /etc/dt/config/language/sys.resources as follows:

    application_class_name*XmCascadeButton*shadowThickness: 1

For more information about overriding system default resources and specifying additional resources for all desktop users, see "Loading the Session Resources"



Generated with CERN WebMaker