View Single Post
  #3   (View Single Post)  
Old 3rd January 2012
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

Finally had a chance to play with this a bit and collect some basic information about changing the fonts used by xterm, such as using larger ones. This will be useful if you want xterm to come up a certain way every time it's run, without using key combinations (you may have no Numeric Keypad) or tedious command line arguments.

There are two approaches to this, depending on whether or not your xterm binary was compiled with FreeType support. To check for this support you can do (substitute the path to your xterm)

% ldd /usr/X11R7/bin/xterm | grep freetype

If this shows anything, you can use either the FreeType or regular method; otherwise you have to use the regular method.

FreeType method

A number of prerequisites need to be in place, including:

(a) xterm supports FreeType (see above),

(b) the renderFont resource is true; it is by default, but to be sure you can add this to ~/.Xresources

Code:
                                                                                                          
XTerm.VT100.renderFont: true
(c) the resource faceName is set. By default it is unset so you must take action here, for example

Code:
                                                                                                          
XTerm.VT100.faceName: terminus
The above sets the normal FreeType font to the "terminus" font. Change to your liking.

(d) on the VT Fonts menu (Ctrl-Button3) be sure the "TrueType Fonts" entry is selected.

In addition to the font, the desired size can be specified. The default for the normal font is 14pt but can be changed with the faceSize option. Also, there are six alternative font sizes. These will be the ones referred to in the VT Font menu as "Unreadable", ..., "Huge". They can all be set in this way:

Code:
                                                                                                          
! Face size for normal:                                                                                         
XTerm.VT100.faceSize:  14                                                                                       
! Face sizes for alternates:                                                                                    
! Unreadable:                                                                                                   
XTerm.VT100.faceSize1:  12 
! Tiny:                                                                                                         
XTerm.VT100.faceSize2:  14 
! Small:                                                                                                        
XTerm.VT100.faceSize3:  20
! Medium:                                                                                                       
XTerm.VT100.faceSize4:  24
! Large:                                                                                                        
XTerm.VT100.faceSize5:  28
! Huge:                                                                                                         
XTerm.VT100.faceSize6:  32
Do yourself a favour and ensure the alternates have increasing sizes for 1,...,6. Anything else may result in confusion.

Regular method

This will be used if xterm doesn't support FreeType or if faceName is unset.

First, to change the default font, put something like this in your ~/.Xresources

Code:
                                                                                                          
! Default:                                                                                                      
XTerm.VT100.font: -*-terminus-*-*-*-14-*-*-*-*-*-*-*
Obviously, pick whatever font and size you prefer here. This font will be the one referred to as "Default" in the VT Font menu. By tinkering with at least the Default font, you can have all xterms come up how you prefer.

In addition, there are six alternate fonts, that can be specified like this:

Code:
                                                                                                          
XTerm.VT100.font1: -*-terminus-*-*-*-12-*-*-*-*-*-*-*
XTerm.VT100.font2: -*-terminus-*-*-*-14-*-*-*-*-*-*-*                          
XTerm.VT100.font3: -*-terminus-*-*-*-20-*-*-*-*-*-*-*                          
XTerm.VT100.font4: -*-terminus-*-*-*-24-*-*-*-*-*-*-*
XTerm.VT100.font5: -*-terminus-*-*-*-28-*-*-*-*-*-*-*                          
XTerm.VT100.font6: -*-terminus-*-*-*-32-*-*-*-*-*-*-*
These fonts will be cycled through according to their sizes when you select Font Menu items such as "Unreadable", ..., "Huge". Again, define them in order of size to avoid confusion.

There's quite a bit more about fonts in xterm(1) which I haven't tried to understand but the above is enough to get started. I hope it is mostly correct but I haven't tested every detail. Additions and corrections are welcome.

Last edited by IdOp; 3rd January 2012 at 12:37 AM.
Reply With Quote