NAME

Font - generic font managment

SYNOPSIS

Font def name ?options?
Font get name ?options?
Font set name ?options?
Font info name
Font names
Font exists name
Font copy src dst

DESCRIPTION

This procedure places an additional layer between the programmer and the logical font descriptions used in the X-Window system. The idea is to define logical font names (eg MenuFont, LabelFont) that allow a consistent use of a font througout an application together with the possibility of easy changes.

The first step is to create a logical font (you may start with the predefined names though - see the font_Init routine) with Font def. From now on you can use the logical font name wherever you would normally use an X font name (eg in all -font options. Changing one or more attributes of a font is done with either Font set for permanent changes or Font get for temporary changes to a font.

Font copy copies one font to another name so that you can change the appearance of the new font without affecting the old defintion.

Font names returns all logical names that are currently defined and Font info fontname returns the attributes of a given font.

Font exists checks if a logical font name is defined. Note that this does not currently check if the name refers to a legal or existing X font.

ATTRIBUTES

The attributes that may be set are named after their X counterparts. Here is a list:
-foundry
options may be adobe, misc etc.
-family
options are helvetica, fixed etc
-weight
controls boldness of font. Options are light, normal and bold
-slant
can have the following values: italic or normal
-width
defines the character width, one of condensed, normal or wide
-style
describes the character style. Not used in most font descriptions
-pixel
gives the size in pixel
-size
this is the size in points - note that these are real points, not decipoints as in X - 12 will be converted to 120 automatically
-xres, -yres
see the X manual
-spacing
describes fixed or proportional fonts.
-avgwidth
see the X manual
-charset
a character set descriptions, eg iso8859
-encoding
a character set encoding, eg 1 for iso8859

EXAMPLES

A new font definition looks like this:

         Font def LabelFont \
	    {-foundry adobe -family helvetica -charset iso8859 \
	     -encoding 1 -spacing proportional -pixel 0 } \
	    {-slant normal -width normal -weight normal  -size 14}

To use the newly created label font say

         button .b -text "huhu?" -font [Font get LabelFont]

To give the button a bold appearance you can define a new logical font or (if this is just a onetime change) do this

         button .b config -font [Font get LabelFont -weight bold]

Of course you can do more complicated things:

         button .b -font [Font get LabelFont -weight bold \
                  -slant italic -size 24]

AUTHOR
(softWorks logo) Richard Schwaninger

Personal Engineering Software

Richard Schwaninger

Theodor-Koernerstr. 173
A-8010 Graz
Austria
Tel: +43 316 68-65-90
Email: risc@findwds01.tu-graz.ac.at