Consultor Eletrônico



Kbase 13478: Example for modifying FONT definitions in Motif defaults
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Example for modifying FONT definitions in Motif defaults


What follows below is a step-by-step example of how to add fonts to
PROGRESS Version 7 for X Windows/Motif.

When changing any application feature on X Windows, the proper
approach is through X resources. This example uses the .Xdefaults
file typically found in a user's $HOME directory. (X resources can
be changing using other files as well. For a brief description of
these files, see kbase 12888, "How PROGRESS Version 7 for OSF/Motif
will load X resources".)

The .Xdefaults file is generally the best place to store X resources
because (a) it is a user-specific file and therefore readily
customized, and (b) it provides a single repository for all the X
resources the user wants to change for any X application.

Here is how to use the $HOME/.Xdefaults file to add fonts to the
PROGRESS session.


(1) You might already have a .Xdefaults file in your $HOME directory.
If you don't, create one using your favorite UNIX editor.


(2) Next you need to determine which particular fonts are available
on your system. Typically these number in the hundreds, even
thousands.

NOTE: If your application is to be ported to several sites, be
sure to use only those fonts which you can be sure will be
available everywhere. If you plan to use unusual fonts then you
should also plan to provide your customers a copy of those fonts.

The X Windows environment offers two useful tools for looking at
fonts and acquiring their proper names. They are "xfontsel" and
"xlsfonts".


(a) xfontsel

Run "xfontsel" with the following simple command: xfontsel &

If your X Windows server is running and your $DISPLAY variable is
set properly, "xfontsel" will create a window on your screen that
allows you to examine the various fonts by changing the font name
interactively. Once you've found a font you like, you can choose
the "Select" button to place the font name string into the mouse
buffer. This allows you to then insert the name into a file (such
as .Xdefaults) with just a click of a mouse button.


(b) xlsfonts

Run "xlsfonts" in the foreground and pipe it into a "more"
command: xlsfonts | more

The "xlsfonts" command gives only the name strings for fonts and
does not display the fonts like "xfontsel" does. If you don't
pipe the command into a "more", the output will scroll by too
quickly to be of any use.


(3) Once you find a font that you wish to include in PROGRESS, you'll
need to add its name to the .Xdefaults file. Doing this properly
requires using the correct resource name and the correct font
name.

(a) Resource name

The name for the font resources used by PROGRESS takes the format
fontN, where N is an integer between 0 and 255. Therefore, the
full resource name for PROGRESS on Version 7 for Motif would
match the following format:

_promtf*font0:
_promtf*font1:
_promtf*font2:
_promtf*font3:
:
:
_promtf*font255:


This can also be writting in "shorthand" as:

*font0:
*font1:
*font2:
*font3:
:
:
*font255:


Two VERY IMPORTANT points to remember: for proper operation of
the ADE tools, font0 through font7 should be a FIXED font, not
a proportionally-spaced font; and, when setting the font resources
in the .Xdefaults file you should not skip over any number in the
series, otherwise PROGRESS ignores any setting after the skipped
number.


(b) Font name

Font names in X Windows are lengthy strings. For example:

-*-courier-bold-r-*-*-17-*-*-*-*-*-*-*

When using one of these font names in the .Xdefaults file, it is
important to spell the entire name correctly. Like any other X
Windows application, PROGRESS does *not* generate error messages
or warnings when it encounters a resource setting that it cannot
interpret. The X Windows standard is to ignore any unrecognizable
resource name or setting.

This is why the "Select" feature of "xfontsel" is so handy. It
takes away the requirement that you type the name in yourself.


(4) Another font resource used by PROGRESS is called "fontList":

_promtf*fontList:

> or <

*fontList:


This font, like font0 through font7, MUST be a fixed font. It is
used by the UIB, and setting it to be a proportional font will
cause the UIB to be drawn with unpredictable results.


(5) Case matters! Be careful to use proper upper-case and lower-case
lettering as shown in each resource example. X Windows also
ignores resource settings if the case of the letters is incorrect.

(6) Once you've completed your .Xdefaults file, you must load it to
your X Windows server. Loading of .Xdefaults is accomplished in
one of two ways: automatically, when the server boots; or by using
"xrdb".


(a) Automatic resource reading

Resources are read automatically when the X server boots. See
kbase 12888 for more information on automatic loading, including
the warning that on many remote servers this automatic process
does not work properly.


(b) xrdb

The "xrdb" command is the best way to guarantee that your X
resources are loading to your server. Progress recommends that
you include the "xrdb" command in your regular login script, so
that it will provide proper functionality in any situation where
automatic loading fails.

The syntax for the "xrdb" command is:

xrdb -load <X_default_file_name>


With the .Xdefaults file we're creating in our $HOME directory,
the command is:

xrdb -load $HOME/.Xdefaults


This command should be executed after ANY change you make to a
PROGRESS resource in your .Xdefaults file. Otherwise, the new
resource setting won't be known to the X server, and therefore not
to PROGRESS either.


(7) Once you've loaded the new resources to the server, you should
restart PROGRESS to make sure they take effect. If you've named
the resources correctly (including upper- and lower-case) and
included the proper font names, the fonts should now be accessible
by PROGRESS. One easy way to ascertain that they're available is
to go into the UIB and use the "Fonts" interface to look at the
various fonts. If you've loaded resources correctly the UIB shows
the fonts themselves in the palette.

To do this, once in the UIB create a FILL-IN. Access the FILL-IN
Property Sheet and choose the "Fonts" button. Page through the
resulting display. Do the various fonts appear, or do many of
the fonts show the default fixed font instead of your selections?
If only the default font appears, then the resource changes have
failed to take effect. You should recheck steps (1) through (6)
above.


Finally, below you will find an example of X resources for fonts on
Motif. Note that the actual fonts named may not exist on your
server (although the ones used are from the set available on any
standard X Windows platform.)


--------------------------- cut here ---------------------------------
!
! ************************************************************
! *************** BEGINNING OF PROGRESS RESOURCES ************
! ************************************************************
!
!
! Resource telling PROGRESS to save Procedure Editor settings
!
_promtf.ProeditSaveSettings: no
!
! Resource for placement of default PROGRESS window
!
*defaultX: 400
*defaultY: 400
!
! Resource for the default font used in the ADE tools
! THIS FONT MUST BE A FIXED FONT!
!
*fontList: -*-courier-bold-r-*-*-17-*-*-*-*-*-*-*
*defaultRows: 32
!
! Resources for colors on the ADE tools
!
_promtf*background: lightskyblue3
_promtf*foreground: black
!
! Resources for the font palette in PROGRESS
!
! You can number as high as 255, but don't skip any numbers!
!
! The names for these fonts were obtained using "xfontsel"
!
! font0 - font7 should be FIXED fonts
!
!
*font0: -*-courier-medium-r-*-*-14-*-*-*-*-*-*-*
*font1: -*-courier-medium-r-*-*-16-*-*-*-*-*-*-*
*font2: -*-courier-medium-r-*-*-18-*-*-*-*-*-*-*
*font3: -*-courier-medium-r-*-*-20-*-*-*-*-*-*-*
*font4: -*-courier-bold-r-*-*-17-*-*-*-*-*-*-*
*font5: -*-courier-bold-r-*-*-14-*-*-*-*-*-*-*
*font6: -*-courier-bold-r-*-*-18-*-*-*-*-*-*-*
*font7: -*-helvetica-bold-r-*-*-*-*-*-*-*-*-*-*
*font8: -*-helvetica-bold-o-*-*-*-*-*-*-*-*-*-*
*font9: -*-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*
*font10: -*-helvetica-bold-o-*-*-14-*-*-*-*-*-*-*
*font11: -*-helvetica-bold-r-*-*-16-*-*-*-*-*-*-*
*font12: -*-helvetica-bold-o-*-*-16-*-*-*-*-*-*-*
*font13: -*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*
*font14: -*-helvetica-bold-o-*-*-18-*-*-*-*-*-*-*
*font15: -*-helvetica-medium-r-*-*-18-*-*-*-*-*-*-*
*font16: -*-helvetica-medium-o-*-*-18-*-*-*-*-*-*-*
*font17: -*-times-medium-r-*-*-*-*-*-*-*-*-*-*
*font18: -*-times-bold-r-*-*-*-*-*-*-*-*-*-*
*font19: -*-times-medium-r-*-*-14-*-*-*-*-*-*-*
*font20: -*-times-bold-r-*-*-14-*-*-*-*-*-*-*
*font21: -*-times-medium-i-*-*-14-*-*-*-*-*-*-*
*font22: -*-times-medium-r-*-*-18-*-*-*-*-*-*-*
*font23: -*-times-bold-r-*-*-18-*-*-*-*-*-*-*
*font24: -*-times-bold-i-*-*-18-*-*-*-*-*-*-*
*font25: -*-times-medium-i-*-*-18-*-*-*-*-*-*-*
*font26: -*-times-medium-r-*-*-20-*-*-*-*-*-*-*
*font27: -*-times-medium-r-*-*-24-*-*-*-*-*-*-*
*font28: -*-times-bold-r-*-*-24-*-*-*-*-*-*-*
*font29: -*-times-bold-i-*-*-24-*-*-*-*-*-*-*
*font30: -*-new century schoolbook-bold-r-*-*-12-*-*-*-*-*-*-*
*font31: -*-new century schoolbook-bold-r-*-*-14-*-*-*-*-*-*-*
*font32: -*-new century schoolbook-bold-r-*-*-16-*-*-*-*-*-*-*
*font33: -*-new century schoolbook-bold-r-*-*-18-*-*-*-*-*-*-*
*font34: -*-new century schoolbook-bold-r-*-*-20-*-*-*-*-*-*-*
*font35: -*-new century schoolbook-bold-r-*-*-24-*-*-*-*-*-*-*

Progress Software Technical Support Note # 13478