An X server maintains a set of fonts used in the text operations requested by client programs. An X font is an array of character bit maps (or glyphs) indexed by integer codes. In fact, font glyphs can also represent cursor shapes or other images and are not limited to character images. X supports both linear and matrix encoding of font indexes. With linear encoding, a font index is interpreted as a single 16-bit integer index into a one-dimensional array of glyphs. With matrix encoding, a font index is interpreted as a pair of 8-bit integer indexes into a two-dimensional array of glyphs. The type of index encoding used is font-dependent.
In order to access or use a font, a client program must first open it using the open-font function, sending a font name string as an identifier. open-font creates a CLX font object used to refer to the font in subsequent functions. Afterward, calling open-font with the same font name returns the same font object. When a font is no longer in use, a client program can call close-font to destroy the font object.
A font has several attributes which describe its geometry and its glyphs. CLX provides functions to return the attributes of a font, as well functions for accessing the attributes of individual font glyphs. Glyph attributes are referred to as character attributes, since characters are the most common type of font glyphs. A font also has a property list of values recorded by the X server. However, the set of possible font properties and their values are not standardized and are implementation-dependent. Typically, CLX maintains a cache of font and character attributes, in order to minimize server requests. However, the font cache mechanism is implementation-dependent and cannot be controlled by the client. In some cases, CLX may create a pseudo-font object solely for the purpose of accessing font attributes. A pseudo-font is represented by a special type of font object that cannot be used in a gcontext. If necessary, CLX can automatically convert a pseudo-font into a true font, if the name of the pseudo-font is known.
The set of available fonts is server-dependent; that is, font names are not guaranteed to be portable from one server to the next. However, the public X implementation from MIT includes a set of fonts that are typically available with most X servers.
The following paragraphs describe CLX functions to: