How to fine-tune TTF rendering in xterm

anti-aliasingfontconfigfontskonsolexterm

I've been trying for the past couple of days to get xterm to display the same font that I have gotten used to in konsole for the last few years – it works for me quite well even with relatively small face size. xterm seems to render the font in a way that's much more difficult for me to read.

Here's a couple of screenshots for comparison.

xterm:
xterm rendering

konsole:
konsole rendering

The font in question is DejaVu Sans Mono 8. Both are antialiased, obviously. I even applied the color scheme from konsole to xterm, thinking that might be the reason for the difference, but it was not. Also, in konsole I have the “Draw intense colors in bold font” checkbox enabled, but the difference is clear in both the bold and regular font.

The difference appears to be in how aggressively each application antialiases the font. In xterm the text is much more blurry and also considerably more difficult to read, at least to me. It is probably most obvious with the character m, which in the non-bold version has the first “leg” spread across two pixels in xterm, whereas in konsole, it is nice and sharp.

I am getting the same results on both Gentoo and Ubuntu, and with both the conservative setup in /etc/fonts/conf.d on my Gentoo laptop, as well as the all-in setup on Ubuntu.

Bonus points if you can figure out why the hell does xterm fail to display some of the non-Latin characters, although I don't mind that as much. It just doesn't make any sense to me. It might be a clue, though…

Here's the relevant part of my .Xresources:

XTerm*faceName: DejaVu Sans Mono
XTerm*faceSize: 8
XTerm*background: #000000
XTerm*foreground: #B2B2B2
XTerm*color0:  #000000
XTerm*color1:  #B21818
XTerm*color2:  #18B218
XTerm*color3:  #B26818
XTerm*color4:  #1818B2
XTerm*color5:  #B218B2
XTerm*color6:  #18B2B2
XTerm*color7:  #B2B2B2
XTerm*color8:  #686868
XTerm*color9:  #FF5454
XTerm*color10: #54FF54
XTerm*color11: #FFFF54
XTerm*color12: #5454FF
XTerm*color13: #FF54FF
XTerm*color14: #54FFFF
XTerm*color15: #FFFFFF
XTerm*boldColors: true

Update: To clarify, getting xterm to use TTF is trivial; what I'm looking for is a way to fine-tune the way TTF are rendered in xterm to match the settings used by konsole (and pretty much any other X11 app, for that matter). For some reason, xterm seems to ignore everything besides the face name and face size of the TTF font I try to set, either in Xresources, or in my fontconfig settings (which are correctly picked up by the rest of the system).

Best Answer

In xterm(1) you can change the font type by holding down the CTRL key and right-clicking in the window. I say sort of because you don't get a lot of choices. Clicking the "TrueType" option will give you results closer to what you are looking for. You can gain more control by editing the Xresources file as I am sure you know - See: https://wiki.archlinux.org/index.php/Xterm for examples on how to modify this to suit your needs.

xterm(1) does not display most non Latin characters by default. you can use the -u8 option or use the uxterm(1) wrapper

Try this command, you can adjust the size to suite your need or leave it out and CTRL-rightclick to change the font size

xterm -u8 -fn 7x13 -fa "DejaVu Sans Mono:size=8:antialias=true"