After a lot of mucking around Xterm, poring through reams of webpages I have thrown in the towel and realized that this isn't something I can figure out on my own.
TrueType vs Bitmap
Is the option xterm*font
used to specify only bitmap fonts and is *faceName
used only for TrueType fonts?
I'm using the commands xlsfonts
and fc-list
to find out the Bitmap and TrueType fonts that are installed. Is this correct?
I want to set the XTerm font to Ubuntu Mono. This is the output of fc-list | grep -i ubuntu
Ubuntu Mono for Powerline:style=RegularForPowerline
Ubuntu Mono for Powerline:style=Bold Italic
Ubuntu Mono for Powerline:style=BoldForPowerline
Ubuntu Mono for Powerline:style=ItalicForPowerline
and I added XTerm*faceName: Ubuntu Mono for Powerline:style=RegularForPowerline
to my ~/.Xresources
and ran xrdb -merge ~/.Xresources
xrdb -query all
shows that *faceName
is set to Ubuntu Mono for Powerline:style=RegularForPowerline
However, this doesn't work. What am I missing/screwing up here?
EDIT: I finally figured out what's wrong just a couple of days ago after scrounging through multiple sources. Combining everyone's responses here:
Ubuntu Mono is a TrueType font and TrueType fonts require xterm to be compiled with FreeType library support. To check whether xterm has this, use the ldd /path/to/xterm/binary
command and see if it says freetype in there. An alternate way is to see if xterm has the -fa
option.
If your xterm has FreeType lib support, choose a
Bitmap fonts, by running xfontsel -p
and use the exact string it prints upon exit.
TrueType fonts, using fc-list :scalable=true:spacing=mono: family
and use the exact string it outputs.
Once you have the font name using one of the above steps, set it via XTerm*faceName: <name of the font>
If you install a new font, and it doesn't show up when you run one of the above commands, rebuild your font cache using fc-cache -frv
and try again.
Hope this helps; please let me know in case I've missed anything.
P.S. I used Ubuntu Mono patched font downloaded from here I'm using XTerm*faceName: "Ubuntu Mono derivative Powerline"
Point by point:
font
resource is a standard resource setting for the X Toolkit, which deals only with XLFD (bitmap), while faceName
was added long after, in applications such as xterm
to provide a way to specify TrueType fonts (actually whatever fontconfig supports, which can include bitmap fonts).xlsfonts
and fc-list
programs are used for the two (XLFD and fontconfig) respectively..ttf
files from github to my ~/.fonts
directory (the zip-file link is the simplest way to download).~/.fonts
directory rather than copying the .ttf
files into the top-level directory. fontconfig can deal with subdirectories; it may be sensitive to the actual filenames. For instance, if I had copied the files to the top-level ~/.fonts
directory, fc-list
would show the full pathname of the font-files (probably not correct).fc-list
shows me Regular
where you have RegularForPowerline
.Here is the output of fc-list
, looking for "Power":
Ubuntu Mono for VimPowerline:style=Bold
Ubuntu Mono for VimPowerline:style=Bold Italic
Ubuntu Mono for Powerline:style=Bold Italic
Ubuntu Mono for Powerline:style=Regular
Ubuntu Mono for VimPowerline:style=Italic
Ubuntu Mono for Powerline:style=Bold
Ubuntu Mono for VimPowerline:style=Regular
Ubuntu Mono for Powerline:style=Italic
By the way, you could test the fonts directly using the command-line -fa
option (quoting the face-name, of course). I did that, and the result looks plausible (comparing regular and bold).