识别正在使用的 xterm 字体和相应的 Cygwin 包?

Identify xterm fonts being used and corresponding Cygwin package?

几十年来,我一直在煞费苦心地尝试不同系列的不同字体,以便为 xterm 获得良好的大小渐变。我在 2015 年发现的六个好在下面以 ~/.Xresources: 为前缀。由于 Windows 7 变得不受支持,旧的笔记本电脑太旧无法迁移到 Windows 10,我买了一台新笔记本电脑并新安装了 Cygwin 的 X-windows。以前好的字体现在会产生错误,下面有Error:前缀。

~/.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

虽然上面的一些字体在select编辑时出现了错误,xterm还是会切换字体,我觉得字体不错。 我猜它正在选择一些规格非常接近的字体。

如果是这样,我如何才能找到最终使用的字体的完整规范?我想在 ~/.Xresources.

中使用它们

如果不是,那么当我收到错误消息并且字体仍然出现切换时发生了什么?

最后,一旦我确定了要切换到的字体,是否有有效的方法来找到包含它们的 Cygwin 包?

请注意,以下内容只是回应了我的 ~/.Xresources 中的信息,而不是显示实际使用的字体(假设由于错误,它们与 ~/.Xresources 中的不同):

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

使用 xterm -report-fonts

进行故障排除

Thomas Dickey 建议 xterm -report-fonts,它将加载的字体报告给 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

我添加了空行来分隔冗余报告 VTFonts(default) 来自中心定位的主体 输出。我还删除了与 每个X 逻辑字体描述 (XLFD).

似乎发生的事情是每次我 select 一个 xterm 字体 VTFonts(fonti) 其中 fonti 取决于选择的字体 (defaultfont1font6),xterm 报告 4 字体 字体的变化。字体变体被命名为 fNormfBoldfWidefWBold

从这些观察来看,最初发布的 XLFD 似乎 错误可能与 ~/.Xresources 字体无关。 XLFD 也不匹配 xterm 报告的任何字体变体。 在不了解引擎盖下发生的事情的情况下,它是 在我看来,xterm 可能会尝试加载一些 XLFD 错误消息,并且无法解决报告的 XLFD 使用 xterm -report-fonts.

我只是觉得遇到这种行为很奇怪。超过 几十年来,我从未收到过关于 XLFD 的错误消息 指定。也许 X11 已经进化到寻找与 我指定的。

对于 Lucida,我会尝试 xorg-x11-fonts-dpi100 和 xorg-x11-fonts-dpi75

$ cygcheck -p lucida
Found 18 matches for lucida
font-bh-lucidatypewriter-dpi100-7.5-2 - font-bh-lucidatypewriter-dpi100: Obsolet
ed by xorg-x11-fonts-dpi100 (installed binaries and support files)
font-bh-lucidatypewriter-dpi100-7.5-3 - font-bh-lucidatypewriter-dpi100: Obsolet
ed by xorg-x11-fonts-dpi100 (installed binaries and support files)
font-bh-lucidatypewriter-dpi100-7.5-4 - font-bh-lucidatypewriter-dpi100: Obsolet
ed by xorg-x11-fonts-dpi100
font-bh-lucidatypewriter-dpi75-7.5-2 - font-bh-lucidatypewriter-dpi75: Obsoleted
 by xorg-x11-fonts-dpi75 (installed binaries and support files)
font-bh-lucidatypewriter-dpi75-7.5-3 - font-bh-lucidatypewriter-dpi75: Obsoleted
 by xorg-x11-fonts-dpi75 (installed binaries and support files)
font-bh-lucidatypewriter-dpi75-7.5-4 - font-bh-lucidatypewriter-dpi75: Obsoleted
 by xorg-x11-fonts-dpi75
texlive-collection-context-20170520-1 - texlive-collection-context: TeX Live con
text package collection
texlive-collection-context-20180414-1 - texlive-collection-context: TeX Live con
text package collection
texlive-collection-context-20190509-1 - texlive-collection-context: TeX Live con
text package collection
xorg-x11-fonts-dpi100-7.5-2 - xorg-x11-fonts-dpi100: X11 core fonts (installed b
inaries and support files)
xorg-x11-fonts-dpi100-7.5-3 - xorg-x11-fonts-dpi100: X11 core fonts (installed b
inaries and support files)
xorg-x11-fonts-dpi100-7.5-4 - xorg-x11-fonts-dpi100: X11 core fonts
xorg-x11-fonts-dpi75-7.5-2 - xorg-x11-fonts-dpi75: X11 core fonts (installed bin
aries and support files)
xorg-x11-fonts-dpi75-7.5-3 - xorg-x11-fonts-dpi75: X11 core fonts (installed bin
aries and support files)
xorg-x11-fonts-dpi75-7.5-4 - xorg-x11-fonts-dpi75: X11 core fonts
...

对于我的 Lucida 字体,我使用 Windows 字体

 $ fc-list.exe | grep -i lucida
/usr/share/fonts/microsoft/lucon.ttf: Lucida Console:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Navadno,Arrunta
/usr/share/fonts/microsoft/l_10646.ttf: Lucida Sans Unicode:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/microsoft/luconP.ttf: Lucida ConsoleP:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Navadno,Arrunta

固定字体可以试试terminus-fonts或者texlive-collection-fontsextra

$ cygcheck -p fixed| grep font | grep -v src
terminus-fonts-4.40-1 - terminus-fonts: Terminus fixed width font (installed binaries and support files)
...
texlive-collection-fontsextra-20170520-1 - texlive-collection-fontsextra: TeX Live fontsextra package collection
texlive-collection-fontsextra-20180414-1 - texlive-collection-fontsextra: TeX Live fontsextra package collection
texlive-collection-fontsextra-20190509-1 - texlive-collection-fontsextra: TeX Live fontsextra package collection

xterm 的 -report-fonts 选项显示所用字体的详细信息。

有一个脚本 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,例如,使用 -f 选项:

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

该脚本试图报告包含已找到的字体文件的包。位图字体位于运行 X 服务器的机器上,因此如果您在本地 running/displaying,脚本可以访问所有需要的信息。