JavaScript EditorFree JavaScript Editor     Perl Manuals 

Main Page

3.2. Dissecting a Font

In the font viewer, we see that the Entry's font is changed with the -font option using an anonymous array. From this we know a font consists of the following things:

The actual name of the font, e.g., 'Courier', 'Times', and so on.

The size of the font in points. The larger the size, the larger the text displayed on the screen. A point is 1/72 of an inch. Negative values are interpreted as pixels.

Determines if the font is shown boldor not. The value 'normal' means it is not shown bold, and 'bold' makes the font thicker.

Shows straight up and down if 'roman' is used, and slanted if 'italic' is used.

If the value used with -underline is true, the text will be underlined. If false, the text will not be underlined.

If true, a line will be drawn through the center of the text.

If you are used to working with fonts on a Unix system, you are probably familiar with X Logical Font Descriptions (XFLD). This is the dash-delimited format used for fonts under X, for example:


This font description indicates a 24-point bold Helvetica font with Roman slant. The field order is as follows: -foundry-family-weight-slant-sWdth-adstyl-pixelsize-pointsize-resx-resy-spacing-avgWidth-registry-encoding.

When specifying a font in XLFD notation, an asterisk means you don't care what is used for that value, and the system will choose a default for you.

While a full description of X fonts is beyond the scope of this book, there are a few things you should know. First, it is entirely acceptable to specify a font in XLFD notation under either Unix or Windows. The code is:

font => '-*-helvetica-bold-r-*-*-*-240-*-*-*-*-*-*'

When you use this format under Unix, you get exactly what you ask for. Every field is honored. Under Windows, only family, weight, slant, pixelsize, and pointsize are honored. All the other fields are ignored.

If you would like to learn more about fonts under X, a good beginner's guide and bibliography may be found in "The X Window User HOWTO" by Ray Brigleb. This document may be found in many, many places on the Web, but the definitive location is

JavaScript EditorJavaScript Formatter     Perl Manuals