Next: Colors, Previous: Display X, Up: Emacs Invocation
By default, Emacs displays text in a twelve point Courier font (when using X). You can specify a different font on your command line through the option ‘-fn name’ (or ‘--font’, which is an alias for ‘-fn’).
Under X, each font has a long name which consists of fourteen words or numbers, separated by dashes. Some fonts also have shorter nicknames. For instance, ‘9x15’ is such a nickname. This font makes each character nine pixels wide and fifteen pixels high. You can use either kind of name. Case is insignificant in both kinds. You can use wildcard patterns for the font name; then Emacs lets X choose one of the fonts that match the pattern. The wildcard character ‘*’ matches any sequence of characters (including none) and ‘?’ matches any single character. However, matching is implementation-dependent, and can be inaccurate when wildcards match dashes in a long name. For reliable results, supply all 14 dashes and use wildcards only within a field. Here is an example, which happens to specify the font whose nickname is ‘6x13’:
emacs -fn \ "-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1" &
You can also specify the font in your .Xdefaults file:
emacs.font: -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1
Note that if you use a wildcard pattern on the command line, you need to enclose it in single or double quotes, to prevent the shell from accidentally expanding it into a list of file names. On the other hand, you should not quote the name in the .Xdefaults file.
The default font used by Emacs (under X) is:
-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1
A long font name has the following form:
-maker-family-weight-slant-widthtype-style... ...-pixels-height-horiz-vert-spacing-width-registry-encoding
You will probably want to use a fixed-width default font—that is, a font in which all characters have the same width. Any font with ‘m’ or ‘c’ in the spacing field of the long name is a fixed-width font. Here's how to use the xlsfonts program to list all the fixed-width fonts available on your system:
xlsfonts -fn '*x*' | egrep "^[0-9]+x[0-9]+" xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-m*' xlsfonts -fn '*-*-*-*-*-*-*-*-*-*-*-c*'
To see what a particular font looks like, use the xfd command. For example:
xfd -fn 6x13
displays the entire font ‘6x13’.
While running Emacs, you can set the font of the current frame (see Frame Parameters) or for a specific kind of text (see Faces).