18

If I launch xterm with its default bitmap fonts and then select the 'Large' font from the 'VT Fonts' menu (via ctrl+right mouse), I get a very usable bitmap font with apparently good Japanese character support.

I'd like to know what this font is so that I can use it elsewhere. Unfortunately, I've found no information on what default settings XTerm uses (i.e. when none are explicitly specified). Lots of sites show how to use X resources to specify new settings (e.g. particular fonts), but none I've seen say what defaults are used if I do nothing.

I've tried eyeballing the font, and it looks similar to and is the same width as 9x15, but it uses more vertical space. It appears not to be 9x15 with different line spacing, though, as specifying this font directly fails to display some Japanese characters that 'Large' can handle just fine.

Although I'll be happy to know what this specific font is, I really want to know where to find what defaults XTerm uses for its resources more generally. If it makes any difference, I'm running Ubuntu 12.04 LTS, 64-bit.

[I have seen this question on the subject already, which is why I'm specifically asking about defaults rather than trying to get live values from a running XTerm.]

20

The appres utility lists the resources used by an application, both user and default.

appres XTerm xterm

The first argument is the class name (xterm -class Xxx). The second argument, which is optional, is the instance name (xterm -name xxx).

The “Large” font is .VT100.font5 or .VT100.utf8Fonts.font5. See the manual for whether .utf8Fonts is used, it's a bit complex. If you have more than one among *.VT100.font5 and ?.VT100.font5 and XTerm.VT100.font5 and xterm.VT100.font5, the last one in this list applies; see the X documentation for the gory details of resource name precedence.

appres XTerm | grep font5
2
  • When I do appres XTerm on my debian testing machine I only get *customization: -color :-/ – user640916 Feb 26 '19 at 19:55
  • @user640916 maybe like me you mistyped and wrote "Xterm xterm" instead of "XTerm xterm? – Magnus Mar 10 at 15:40
12

You can use lsof to list all files by given process id and grep for fonts.

lsof  -p <process_id_of_xterm> | grep fonts

for example,

lsof -p `ps -a | grep xterm | cut -d' ' -f1` | grep fonts

sample output:

$ lsof -p `ps -a | grep xterm | cut -d' ' -f1` | grep fonts
xterm   17560 testuser  mem    REG  253,1    137272  9154732 /usr/share/fonts/liberation/LiberationSans-Bold.ttf
xterm   17560 testuser  mem    REG  253,1    139628  9154735 /usr/share/fonts/liberation/LiberationSans-Regular.ttf
1
  • Did not work for me, nothing at all output. – Owl Jul 14 at 18:23
8
  • For fonts: xterm -report-fonts.
  • For colours: xterm -report-colors.
3

Try this -- it queries the X server resource database

% xrdb -q| grep -i font

See also

% man xrdb
1

I had the exact same issue as OP. Trying appres gave me no input & editres didn't help for me either (the other stack overflow question).

anyway, I used xlsfonts with trial & error to just find the font from the big list of fonts. It wasn't one of the nice simple font names like 9x15 or anything.

xterm -fn -misc-fixed-bold-r-normal--18-120-100-100-c-90-iso8859-9 

on my system defaulted to the nice large size and printed unicode correctly. to prove a point,

xterm -fn -misc-fixed-bold-r-normal--0-0-75-75-c-0-iso8859-9 

defaulted to a small size that could not even print the unicode (oddly enough right clicking to large made it match the former).

for me, it wasn't very intuitive and it would have been nice to have someone reassure me as I struggled that 2 fonts in the list may look nearly identical but can still be rendered differently by xterm for some odd reason.

2
  • The xterm font selection code is very smart and will often automatically select normal bold, italic and bold italic fonts based on the font name you give. Are you sure you actually got BOLD and your main font! – anthony Jul 23 '20 at 6:06
  • Also many of the bold 'misc' fonts do not have unicode glyphs, though the 'medium' or plain font, does. Instead they output doted boxes. – anthony Jul 23 '20 at 6:07
1

Your can find the default font by running

$ fc-match mono

Here is the explanation (from the Arch-Wiki)

xterm's default font is the bitmap font named by the X Logical Font Description alias fixed, often resolving to

-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-?

This font, also aliased to the name 6x13, has remakably wide coverage for unicode glyphs. The default "TrueType" font is the 14‑point font matched by the name mono. The FreeType font that will be used can be found with this command:

$ fc-match mono
5
  • Welcome to the site, and thank you for your contribution. Please note that link-only answers are discouraged as they can become invalid when the link becomes dead or the page linked to changes. If possible, edit your post to add at least a summary of what the external page recommends to do to solve the OPs problem. – AdminBee Jul 10 '20 at 15:18
  • Thank you. That ok. – Atsou Jason Jul 10 '20 at 15:19
  • Thank you. I only took the liberty to apply a minor edit to your post to make it more readable. – AdminBee Jul 10 '20 at 15:29
  • Glad for that. It teaches me for the next time. Thanks! – Atsou Jason Jul 10 '20 at 15:44
  • All the misc unicode fonts... (ends in "-iso10646-1") have a very good set of glyphs, thanks the the hard work of the font maintainer Markus Kuhn back when unicode was still new. HOWEVER: bold bold fonts generally do not have all the glyphs. these out out put dotted boxes insead! EG try... echo $'●\e[1m●\e[m' to test normal and bold – anthony Jul 23 '20 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.