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:

Family

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

Size

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.

Weight

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

Slant

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

Underline

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

Overstrike

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:

*-helvetica-bold-r-*-*-*-240-*-*-*-*-*-*

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 ...

Get Mastering Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.