June 5, 2019

Xgterm fonts and background

When I type "xgterm" on my linux system, I get a nasty small windown with a white background and tiny fonts.

It turns out that this can be "made better" by installing x11 fonts and setting up a .Xdefaults file.

su
dnf install xorg-x11-fonts-misc
This command gives me a fair collection of fonts, but there are many other x11 font packages that could be installed. These fonts are in /usr/share/X11/fonts/misc. A decent 10x20 font is provided. I don't much like the 12x24 flavor.

You could then invoke xgterm as "xgterm -fn 10x20", but this gets annoying in a hurry and doesn't do anything about the background color. The answer is a .Xdefaults file in your home directory that looks something like this:

ovenRed*font:           10x20
ovenRed*geometry:       80x24+85+0
ovenRed*tekGeometry:    -70-0
ovenRed*iconGeometry:   +0+625
ovenRed*title:          Red IRAF XGterm
ovenRed*iconName:       red
ovenRed*foreground:     tomato
ovenRed*background:     black
The above is pulled out of /home/pilot/.Xdefaults and is not the entire file. Looking at this leads us to the question of how the flock of windows the pilot uses get started on the suns. Somewhere there is a line like this:
xgterm -name ovenRed -title Red IRAF XGterm (orig) -e cl
This is done in the file ".openwin-init", the last few lines of which look like:
toolwait /usr/openwin/bin/clock -Wp 0 285 -Ws 120 70 -WP 0 284 -Wi +Wn -12 -analog +date +seconds -alarmtime 0:0
toolwait /usr/openwin/bin/filemgr -Wp 624 385 -Ws 574 546 -WP 10 914 -Wi
toolwait /usr/openwin/bin/perfmeter -Wp 0 144 -Ws 64 128 -WP 0 144 +Wi -t cpu -t disk -M cpu 100 100 100 -M disk 40 40 2147483647 -g -L -V -Wn -s 2 -h 20 -m 2
toolwait mailtool -Wp 75 0 -Ws 585 326 -WP 0 360  -Wi
toolwait xgterm -name ovenRed -title 'Red IRAF XGterm (orig)' -e cl
toolwait xgterm -name ovenGreen -title 'Green IRAF XGterm (orig)' -e cl
toolwait xgterm -name ovenPurple -title 'Purple IRAF XGterm (orig)' -e cl
toolwait xgterm -name ovenBlue -title 'Blue IRAF XGterm (orig)' -e cl
The following note talks about some of this, but doesn't give any good examples. What looks like it will work for me (but doesn't) is:
*Gterm*font:           10x20
*Gterm*foreground:     tomato
*Gterm*background:     black
XImtool.displayPanner:  false
XImtool.cmap1:          rainbow2.lut
The last two ximtool resources are copied from the pilot .Xdefaults while I am at it.

But it doesn't work (yet)

The online resources (such as IRAF.net) are full of misinformation and bad advice.

I still get the nasty tiny xgterm after doing this. Maybe I need to restart my session. This did not fix things. In fact a full reboot did not fix things. The following document hints that the resource names may be weirder than anyone would guess:

I change my .Xdefaults file to look like the following:
Xgterm*gterm*font:           10x20
Xgterm*gterm*foreground:     tomato
Xgterm*gterm*background:     black
Tom*font:           10x20
Tom*foreground:     tomato
Tom*background:     black
XImtool.displayPanner:  false
XImtool.cmap1:          rainbow2.lut
Typing "xrdb -query" displays what the X resource "database" in use looks like. And I can reload it without restarting my session via "xrdb &.Xdefaults". After doing this, "xgterm -name" Tom works, but just typing "xgterm" does not. I remember all of this being endlessly confusing 20 years ago, and clearly it is no better today.

Notice all the wacky capitalization in the resource file. There is no telling if this is important or just "stylin'" in some funky ancient X11 tradition. Actually this capitalization may be important. I just found this comment:

XGterm is the class name for the xgterm application (the UNIX program). This has all the usual xterm resources. Xgterm on the other hand is the application name for the "xgterm" IRAF application

Now it works!

The way to deal with this kind of insanity is by trial and error experimentation (which xrdb reloading makes pretty easy). What finally worked is:
XGterm*font:           10x20
XGterm*foreground:     tomato
XGterm*background:     black

Have any comments? Questions? Drop me a line!

Tom's home page / tom@mmto.org