6

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

  1. Is the option xterm*font used to specify only bitmap fonts and is *faceName used only for TrueType fonts?

  2. I'm using the commands xlsfonts and fc-list to find out the Bitmap and TrueType fonts that are installed. Is this correct?

  3. 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?

kshenoy
  • 259
  • 1
    The xterm man page recommends fc-list :scalable=true:spacing=mono: family which prints the font face name without the style=... annotation, and that's what you should give to xterm. The spacing=mono requirement helps you avoid inappropriate fonts (a terminal screen is a grid of characters, and variable width fonts look ridiculous when forced into a grid) –  Apr 23 '15 at 00:58
  • How do I find out what the family name is? I'm guessing it's "Ubuntu Mono" but just to be sure – kshenoy Apr 23 '15 at 01:34
  • I believe if you use the recommended fc-list command you get the family name exactly as you should use it. –  Apr 23 '15 at 02:29
  • Thanks, the exact fc-list command helped – kshenoy May 04 '16 at 03:27
  • 1
    There is a "Your Answer" box on this page, and that is there for you too to put your answer (and accept). If someone is in a hurry looking for a solution (s)he will not read to the bottom of your question to see that there is an answer hidden there. – Anthon May 04 '16 at 05:04

3 Answers3

9

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

  1. Bitmap fonts, by running xfontsel -p and use the exact string it prints upon exit.

  2. 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.

P.S. I used Ubuntu Mono patched font downloaded from here I'm using XTerm*faceName: Ubuntu Mono derivative Powerline

Thanks to Wumpus Q. Wumbley and Thomas Dickey for their detailed responses.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
kshenoy
  • 259
5

It is an old one, but for anyone coming here, the solution is:

XTerm*faceName: Ubuntu Mono:style=Regular

and if you want to see the change immediately then run:

xrdb -merge .Xresources

xterm
MelBurslan
  • 6,966
2

This question was first posted to stack overflow, where I answered it a year ago, noting that the actual package did not provide the style RegularForPowerline (apparently OP was confused with some aspect of the output of fc-list:

fc-list shows me Regular where you have RegularForPowerline.

Thomas Dickey
  • 76,765
  • Hello Thomas, thank you for responding there. I saw your comment about the -fa option and it helped me figure out why I wasn't seeing that option. My XTerm was missing FreeType library support. – kshenoy May 04 '16 at 03:29