Next: , Up: Fonts and text translation

5.1 Font names

Fonts in Emacs 22 and earlier are named using the X Logical Font Description (XLFD) format. Emacs on Windows ignores many of the fields, and populates them with * when listing fonts. Former maintainer Andrew Innes wrote this explanation of what each field in the font string means and how Emacs treated them back in 19.34. Since then, multilingual support and a redisplay overhaul to support variable width fonts have changed things slightly; more character sets are recognized (and the old pseudo character sets are deprecated), and the resolution fields are used to calculate the difference between point and pixel sizes, but normally you should leave these at the system default. The foundry field is also populated with an indication of whether the font is outline (.TTF, .ATM) or raster (.FON) based when fonts are listed, which may let you differentiate between two fonts with the same name and different technologies.

From Emacs 23, the preferred font name format will be moving to the simpler and more flexible fontconfig format. XLFD names will continue to be supported for backward compatibility.

     XLFD: -*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1
     Fontconfig: Courier New-13

To find the XFLD name for a font, you can execute the following in the *scratch* buffer by pressing C-j at the end of the line:

     (w32-select-font nil t)

To see a complete list of fonts, execute the following in the *scratch* buffer by pressing C-x C-e at the end of the line:

     (insert (prin1-to-string (x-list-fonts "*")))

The command line options and frame-parameters for changing the default font in Emacs are documented in the manual. Fonts can also be used when defining faces, though family and size are generally specified individually there. In addition, Emacs on Windows reads the registry to find X Resources. This is also documented in the manual.