The first step in customizing your xterm is to select font sizes for
text, and colors for the foreground and background, which will help you view the
windows comfortably. (We suspect the default fonts and colors were
selected by some plaid-panted programmer after spending all night
writing code and drinking Coke.) Fortunately the setup is easy.
You first examine the available choices; then you decide which names
you prefer placing in the .Xdefaults file in your home
directory so they become the defaults. A standard set of options for
xterm is:
% xterm -display host:n -geom wxh+x+y -fn font -bg color -fg color -e command
Now let's make these more suitable for you. If you do not have a color screen, go ahead and ignore the color option. (We actually find black and white displays easier to read.)
Figure 4.7 shows some standard X11 monospaced fonts and
their aliases. Changing fonts in your xterm window is not as
simple as in Macintosh applications where you just choose a font from
a menu. (The X11 R4 and R5 xterms do have font
menus, but you need to set up the menu before using it.) The present
standard, X11 R3, has a total of 157 different fonts to
experiment with (counting all of the different type faces and sizes)
and the new X11 R4 has more than 400. While not all vendors
supply every font, some provide additional fonts for a more
distinctive look. The large number of fonts means that a naming
convention was needed which completely specifies the characteristics
of every font. The new X11 R3 naming convention is consistent
with the X documentation's fondness for succinctness:
The xterm command to get an 18-point courier font is:
adobe-courier-bold-r-normal-18-180-75-75-m-110-iso8859-1
Figure: A sample of X11 monospaced fonts.
Click on figure to view larger image.
$ xterm -fn adobe-courier-bold-r-normal-18-180-75-75-m-110-iso8859-1
Is this a bit much? Fortunately, wild cards can be
used to shorten the name and still unambiguously specify the font:
$ xterm -fn '*-courier-bold-r-*-18-*' Short version.
Notice the quotes ' ' are used so the shell does not try to fill in the *'s. You also can use -courier-bold-r-18- to prevent substitution for the *'s if the quotes become too difficult, as they may when you try putting commands into a mwm menu.
Font names become even more confusing when you encounter the local
aliases by which any given font may be known. For example, the
font above may also be called cour.b.18 and courb18. You clearly
need some help before making your choice and, fortunately, the system
comes through for you. The command xlsfonts lists all of
the fonts available on your system in both the X11 R3 naming
convention and any aliases. The list may be long, so you may
want to pipe it to more or direct the output to a file:
$ xlsfonts | more Examine fonts through more. $ xlsfonts > fontfile Store fonts in file.
As usual, the list tells you the names of the fonts but not what the fonts look like. To preview the fonts, you may use the xfontsel command, if it is available.
It is generally best to use xterm fonts in which each
character is of the same width (like on a typewriter) because monospaced fonts preserve the alignment and spacing of the output
from the system. Choose fonts that look good to
you, and then test them with the command:
$ xterm -fn font_name Examine fonts.
The X Window System also gives you the option of selecting colors for
the background, foreground, windows, and fonts. Colors are a little
simpler than fonts. Many color terminals have 256 colors available,
but the limited memory on less expensive satellite terminals,
such as X terminals, limits the options to 16. There may be programs
available on your system to preview the colors:
$ xcolors Show available colors. $ xterm -fn font_name -bg color -fg color