X Logical Font Description
Two different font systems are used by X11: the older or core X Logical Font Description, XLFD, and the newer X FreeType, Xft, systems. XLFD was originally designed for bitmap fonts and support for scalable fonts (Type1, TrueType and OpenType) was added later. XLFD does not support anti‑aliasing and sub‑pixel rasterization; fonts will appear jagged. Xft uses the FreeType and Fontconfig libraries and is more suitable when the smooth appearance of fonts is desired.
Font names are complex when using XLFD:
The name contains fourteen elements, with each element field preceded by a hyphen,
-. Not all elements are required to be present in a font name and a field may be empty. Names can be simplified for the user by the wildcards
?. On the command line, surround the font name with quotes to prevent the shell from interpreting the wildcards and to avoid backslashing whitespace.
$ xterm -fn "-*-fixed-medium-r-s*--12-87-*-*-*-*-iso10???-1" $ xterm -fn "-*-dejavu sans mono-medium-r-normal--*-80-*-*-*-*-iso10646-1"
Names can be simplified even more by using aliases:
$ xterm -fn 12x24
Two nearly indispensible utilities for working with XLFD names are xfontsel,, and xlsfonts, . Xfontsel uses dropdown menus for selecting parts of a font name and previews the font selected. Xlsfonts can list fonts by name, with selectable degrees of detail, and can show how wildcards and aliases will be interpreted by the XLFD system. If a fontname is not working, check for a match with xlsfonts.
$ xlsfonts -fn "*-fixed-medium-r-n*--13-120-75-*-iso1*-1" $ xlsfonts -ll -fn fixed
Font name elements
The following table provides a description of the font name fields. The elements are listed in the same order as they appear in a font name. The names used by xfontsel are listed below the longer uppercase names.
| The supplier of the font.
Specify this field when two different fonts share the same FAMILY_NAME, for example,
|The typeface name, defined by the foundry. Usually, fonts with the same family name are visually similar.|
| The degree of blackness of the glyphs, defined by the foundry. Common values are |
| Common values are |
Usually this needs to be specified.
| Values are set by the designer, examples are |
A value should be set, not wildcarded, when there are two or more possible values.
| Often an empty field, but values may be supplied by the foundry.
In xfontsel, an empty field is chosen by selecting
| The body size of a font for a particular POINT_SIZE and RESOLUTION_Y. Changes the height of a font independent of the point size for which the font was designed.
| The body heighth for which the font was designed. Values are expressed as tenths of a point (one point is nominally one seventy-secondth of an inch).
Use this value to select the typeface size for scalable fonts and use a wildcard for the PIXEL_SIZE field. The selections are artificially limited in xfontsel; change it on the command-line or in the resource file.
Bitmap fonts do not scale well and attempts will often result in unmatched font names. It's better to use bitmap fonts at the sizes provided by the designers.
| The horizontal resolution as an integer-string for which the font was designed. The values are expressed as pixels or dpi.
For scalable fonts this may safely be set to zero or
| The vertical dpi for which the font was designed.
Similar to RESOLUTION_X, scalable fonts can have this value set to zero or
| Arithmetic mean of the widths of all glyphs. Zero is used for proportional fonts.
It is safe to wildcard this value with *.
| Always paired with the next field, this names the registration authority for the character encoding used. Examples are |
It's always safe to choose an available registry that is compatible with the user's locale settings.
|An identifier for the character set encoding.|
The Font Search Path
Please see Fonts for a guide to installing font files and modifying the font path. For a font to be available to the X server, the directory containing the font file must be on the user's font path. You can check your current font path with:
$ xset q
When a font is requested, the X server searches the font directories in the order given in the font path. Each font directory will contain a file named fonts.dir that serves as an index connecting a font's XLFD name to the file containing the font. The search ends with the first match found.
The first line in a fonts.dir file is the number of fonts listed in the file. The following lines then list the fonts in that directory: filename first, followed by a single space, and finally the font name. An example fonts.dir showing the first four lines:
1894 UTBI__10-ISO8859-1.pcf.gz -adobe-utopia-bold-i-normal--14-100-100-100-p-78-iso8859-1 UTBI__10-ISO8859-10.pcf.gz -adobe-utopia-bold-i-normal--14-100-100-100-p-78-iso8859-10 UTBI__10-ISO8859-13.pcf.gz -adobe-utopia-bold-i-normal--14-100-100-100-p-78-iso8859-13