如何在 Linux 中安装字体以便 xterm 可以使用它?

ral*_*ldi 5 linux font x11

我今天遇到了一个问题,要求使用好的 Linux xterm 字体,一个答案建议使用一个叫做 Terminus 的字体。我一直在寻找新的终端字体一段时间了,所以我下载了它(顺便说一句,我正在运行 Ubuntu Intrepid)并阅读自述文件:

1.1. Quick installation.
The commands:
  $ ./configure [--prefix=PREFIX]
  $ make
  # make install
compile and install the Linux console and X11 Window System fonts, and
  # make fontdir
updates fonts.dir for X11 (if you don't know what fonts.dir is, execute the
command).

1.2. Legend.    
The file names are structured as follows: ter-u<SIZE><STYLE>.bdf    
where <SIZE> is 12, 14, 16, 20, 24, 28 or 32, and <STYLE> is n for normal
(all sizes), b for bold (all sizes except 6x12) and v for EGA/VGA bold (8x14
and 8x16 only, makes use of the eight character matrix column).
Run Code Online (Sandbox Code Playgroud)

所以我跑了:

$ ./configure
$ make
$ sudo make install
$ sudo make fontdir
Run Code Online (Sandbox Code Playgroud)

...为了确定起见,我重新启动了 X11,但找不到新字体:

$ xterm -font ter-u14n
xterm:  unable to open font "ter-u14n", trying "fixed"....
Run Code Online (Sandbox Code Playgroud)

叹。回到自述文件。后来在这个文件中,我看到:

4. X11 Window System.
4.1. Installation.

$ ./configure [--prefix=PREFIX | --x11dir=DIRECTORY]
$ make pcf
# make install-pcf
Run Code Online (Sandbox Code Playgroud)

好吧,我知道“xterm -font 8x16”有效,所以我运行“locate 8x16”并看到这个字体似乎存在于/usr/share/fonts/X11/misc中,所以这似乎是一个很好的--x11dir用。所以我跑了:

$ ./configure --x11dir=/usr/share/fonts/X11/misc
$ make pcf
$ make install-pcf
$ sudo make fontdir
Run Code Online (Sandbox Code Playgroud)

...我再次重新启动 X11,甚至我的整个计算机只是为了更好的衡量,我什至验证现在有一堆文件,如 /usr/share/fonts/X11/misc/ter-u14n.pcf.gz在我的系统上,但仍然:

$ xterm -font ter-u14n
xterm:  unable to open font "ter-u14n", trying "fixed"....
Run Code Online (Sandbox Code Playgroud)

为了让这个字体与 xterm 一起工作,我必须执行什么神奇的咒语?

Rik*_*der 1

/usr/share/fonts/X11/misc 下的encodings.dir、fonts.alias 和fonts.dir 文件中是否列出了字体?

自从我需要在 Linux 主机上添加字体以来已经有一段时间了,但是有一些名为 mkfontdir、update-fonts-alias、update-fonts-dir 和 update-fonts-scale 的帮助程序实用程序应该默认安装。它们负责更新元信息,告诉 X 服务器系统上安装的字体。请参阅它们的手册页。

在基于 Debian 的系统上(Ubuntu 具有 Debian 传统),当添加字体 .deb 包时,帮助程序通常会自动调用 mkfontdirs。使用 make 安装字体可能无法按照系统预期的方式进行设置。