Search code examples
fontscygwinx11xterm

Identify xterm fonts being used and corresponding Cygwin package?


Over the decades, I've taken to painstakingly trying different fonts from different families to get a nice progression of sizes for xterm. The six that I found to be good in 2015 are prefixed by ~/.Xresources: below. Since Windows 7 became unsupported and ye olde laptop was too worn out to migrate to Windows 10, I bought a new laptop and freshly installed Cygwin's X-windows. The formerly good fonts now generate errors, prefixed by Error: below.

~/.Xresources: xterm*font:        -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
Error: None

~/.Xresources: xterm*font1:       -*-lucidatypewriter-medium-r-*-*-11-*-*-*-*-*-*-*
Error: xterm: cannot load font "-B&H-LucidaTypewriter-medium-R-*-*-11-80-100-100-M-140-ISO10646-1"

~/.Xresources: xterm*font2:     -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
Error: xterm: cannot load font "-Misc-Fixed-medium-R-*-*-13-120-75-75-C-140-ISO10646-1"

~/.Xresources: xterm*font3:     -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1
Error: xterm: cannot load font "-Misc-Fixed-medium-R-*-*-13-120-75-75-C-160-ISO10646-1"

~/.Xresources: xterm*font4:       -*-lucidatypewriter-medium-r-*-*-14-*-*-*-*-*-*-*
Error: xterm: cannot load font "-B&H-LucidaTypewriter-medium-R-*-*-14-140-75-75-M-180-ISO10646-1"

~/.Xresources: xterm*font5:    -b&h-lucidatypewriter-bold-r-normal-sans-14-*-*-*-m-*-*-*
Error: None

~/.Xresources: xterm*font6:     -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1
Error: xterm: cannot load font "-Misc-Fixed-medium-R-*-*-20-200-75-75-C-200-ISO10646-1"

Other lines in ~/.Xresources
----------------------------
xterm*toolBar:  false
xterm*background:       rgb:00/00/66
xterm*foreground:       White

Despite the errors generated when some of the above fonts are selected, the xterm still switches fonts, and I find the fonts to be good. I'm guessing that it's choosing some font with a very close specification.

If so, how can I find the full specification for the font that ends up being used? I want to use them in ~/.Xresources.

If not, then what is happenning when I get the error message and the font still appears to switch?

Finally, once I've identified the fonts that are being switched to, is there an efficient way to find the Cygwin package that contains them?

Note the the following merely echos the information in my ~/.Xresources rather than displaying the fonts that are actually being used (assuming that they differ from what's in ~/.Xresources, due to the errors):

appres XTerm xterm | grep -w xterm | grep font | sort
xrdb -query | grep -w xterm | grep font | sort

Troubleshooting with xterm -report-fonts

Thomas Dickey suggested xterm -report-fonts, which reports loaded fonts to stdout:

Loaded VTFonts(default)
   fNorm: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
   fBold: -Misc-Fixed-bold-R-*-*-13-120-75-75-C-60-ISO8859-1
   fWide: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1
   fWBold: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1
Loaded VTFonts(default)
   fNorm: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
   fBold: -Misc-Fixed-bold-R-*-*-13-120-75-75-C-60-ISO8859-1
   fWide: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1
   fWBold: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1

Loaded VTFonts(default)
   fNorm: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
   fBold: -Misc-Fixed-bold-R-*-*-13-120-75-75-C-60-ISO8859-1
   fWide: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1
   fWBold: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1
Loaded VTFonts(font1)
   fNorm: -*-lucidatypewriter-medium-r-*-*-11-*-*-*-*-*-*-*
   fBold: -*-lucidatypewriter-medium-r-*-*-11-*-*-*-*-*-*-*
   fWide: -*-lucidatypewriter-medium-r-*-*-11-*-*-*-*-*-*-*
   fWBold: -*-lucidatypewriter-medium-r-*-*-11-*-*-*-*-*-*-*
Loaded VTFonts(font2)
   fNorm: -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
   fBold: -Misc-Fixed-bold-R-*-*-13-120-75-75-C-70-ISO8859-1
   fWide: -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
   fWBold: -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1
Loaded VTFonts(font3)
   fNorm: -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1
   fBold: -Misc-Fixed-bold-R-*-*-13-120-75-75-C-80-ISO8859-1
   fWide: -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1
   fWBold: -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1
Loaded VTFonts(font4)
   fNorm: -*-lucidatypewriter-medium-r-*-*-14-*-*-*-*-*-*-*
   fBold: -B&H-LucidaTypewriter-bold-R-*-*-14-140-75-75-M-90-ISO8859-1
   fWide: -*-lucidatypewriter-medium-r-*-*-14-*-*-*-*-*-*-*
   fWBold: -*-lucidatypewriter-medium-r-*-*-14-*-*-*-*-*-*-*
Loaded VTFonts(font5)
   fNorm: -b&h-lucidatypewriter-bold-r-normal-sans-14-*-*-*-m-*-*-*
   fBold: -B&H-LucidaTypewriter-bold-R-*-*-14-140-75-75-M-90-ISO8859-1
   fWide: -b&h-lucidatypewriter-bold-r-normal-sans-14-*-*-*-m-*-*-*
   fWBold: -b&h-lucidatypewriter-bold-r-normal-sans-14-*-*-*-m-*-*-*
Loaded VTFonts(font6)
   fNorm: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1
   fBold: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1
   fWide: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1
   fWBold: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1

Loaded VTFonts(default)
   fNorm: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
   fBold: -Misc-Fixed-bold-R-*-*-13-120-75-75-C-60-ISO8859-1
   fWide: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1
   fWBold: -Misc-Fixed-medium-R-*-*-13-120-75-75-C-120-ISO10646-1

I added blank lines to separate redundant reports of VTFonts(default) from the centrally positioned main body of the output. I also removed all the detailed parameters associatd with each X logical font description (XLFD).

What seems to be happening is that each time I select an xterm font VTFonts(fonti) where fonti depends on the font chosen (either default or font1 through font6), xterm reports 4 font variations for the font. The font variations are named fNorm, fBold, fWide, and fWBold.

  • For all xterm fonts, variation fNorm always matches the XLFD in ~/.Xresources.

  • Variations fWide and fWBold match fNorm for all xterm fonts except default

  • Variation fWBold differs from fNorm for all xterm fonts except font1 and font6

  • Selecting xterm fonti generates an error about inabilty to load an apparently related font, where i is one of 1, 2, 3, 4, 6. These are the errors reported in the original question. The related font's XLFD matches none of the font variants (fNorm, fBold, fWide, fWBold)

From these observations, it seems that the originally posted XLFD errors might be unrelated to the ~/.Xresources fonts. The XLFDs don't match any of the font variants reported by xterm either. Without knowing enough about what goes on under the hood, it is possible in my mind that xterm might try to load some of XLFDs in the error messages, and being unable to, settles on the XLFDs reported using xterm -report-fonts.

I just find it odd that I'm encountering this behaviour. Over the decades, I've never had error messages about XLFDs that I did not specify. Perhaps X11 has evolved to look for XLFDs related to the ones I specified.


Solution

  • xterm's -report-fonts option shows details on the font used.

    There's a script find-xterm-fonts (which knows about Debian- and RPM-packages) that can show the package names used for the fonts (see example). Cygwin sort of neglects the command-line packaging tools which would make scripting this feature simple. You could modify the script to make it work with cygcheck, e.g., using the -f option:

       -f, --find-package   find the package to which FILE belongs
    

    The script attempts to report the package containing font-files which have been found. Bitmap fonts are on the machine which runs the X server, so if you are running/displaying locally, the script can access all of the needed information.