Monday 6 August 2012

Using True Type Fonts in XTerm

I’ve not had to use TrueType fonts before as my desktop display resolution never warranted it. Now with eyesight failing and much better monitors, I decided to give them a go. Fonts are globally managed by settings in /etc/X11/app-defaults. However, TrueType fonts can be locally set using ~/.Xresources.
To browse the list of fonts use
fc-list :fontformat=TrueType -f "%{family}\n" | sort -u | less
Test a font by specifyng in the xterm command -fa option
xterm -fa 'Luxi Mono' -fs 10
Where fa refers to the fonts face name, and fs, the font size.

Once happy with your font, apply to your application in ~/.Xresources
For example to apply for XTerm
! my customisations
XTerm*faceName: DejaVu Sans Mono
XTerm*faceSize: 11
The final step is to set these resource changes using xrdb
xrdb -merge .Xresources
So, next time you invoke a plain xterm command you will be greeted with your new font.