Extracted from Pike v7.8 release 866 at 2016-11-06.
pike.ida.liu.se
[Top]
GDK
GDK.Font

Class GDK.Font

Description

The GdkFont data type represents a font for drawing on the screen. These functions provide support for loading fonts, and also for determining the dimensions of characters and strings when drawn with a particular font.

Fonts in X are specified by a X Logical Font Description. The following description is considerably simplified. For definitive information about XLFD's see the X reference documentation. A X Logical Font Description (XLFD) consists of a sequence of fields separated (and surrounded by) '-' characters. For example, Adobe Helvetica Bold 12 pt, has the full description: "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1"

The fields in the XLFD are:
Foundrythe company or organization where the font originated.
Familythe font family (a group of related font designs).
WeightA name for the font's typographic weight For example, 'bold' or 'medium').
SlantThe slant of the font. Common values are 'R' for Roman, 'I' for italoc, and 'O' for oblique.
Set WidthA name for the width of the font. For example, 'normal' or 'condensed'.
Add StyleAdditional information to distinguish a font from other fonts of the same family.
Pixel SizeThe body size of the font in pixels.
Point SizeThe body size of the font in 10ths of a point. (A point is 1/72.27 inch)
Resolution XThe horizontal resolution that the font was designed for.
Resolution YThe vertical resolution that the font was designed for .
SpacingThe type of spacing for the font - can be 'p' for proportional, 'm' for monospaced or 'c' for charcell.
Average WidthThe average width of a glyph in the font. For monospaced and charcell fonts, all glyphs in the font have this width
Charset Registry The registration authority that owns the encoding for the font. Together with the Charset Encoding field, this defines the character set for the font.
Charset EncodingAn identifier for the particular character set encoding.

When specifying a font via a X logical Font Description, '*' can be used as a wildcard to match any portion of the XLFD. For instance, the above example could also be specified as "-*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1"

It is generally a good idea to use wildcards for any portion of the XLFD that your program does not care about specifically, since that will improve the chances of finding a matching font.