22

我对如何获得要在 .Xresources 文件中使用的有效字体名称很感兴趣。我已经安装ttf-ms-fonts并想将我的终端切换到快递字体。但是这样设置是行不通的

urxvt*font:     cour
urxvt*boldFont: courbd

如何指定有效名称?

4

2 回答 2

21

首先,您必须决定是否要使用核心协议或 Xft 进行字体渲染。正如您在另一个答案中看到的,xfontsel是为核心协议获取正确字体名称的正确工具。但它不太可能是你想要的 truetype 字体(你想要抗锯齿吗?那么 Xft 是你的选择)。

如果 urxvt 是用 Xft 支持构建的(检查urxvt --help 2>&1 | grep options以确保),您可能希望为其提供前缀为的字体名称xft:

URxvt.font: xft:Courier New

其他影响字体匹配和渲染的选项可以在 xft 字体名称中指定:

URxvt.font: xft:Courier New:pixelsize=18:antialias=false

(搜索man rxvt更多xft:详情)

可以使用 查询所有可用的字体名称fc-list。例如fc-list|grep courbd.ttf,显示字体名称为 Courier New,样式为粗体(附加:style=Bold以选择它)。

用于fc-match "Courier New"从 Xft 的角度检查哪种字体与给定名称最匹配。

Other applications may have their own conventions for X11 and Xft font names. E.g. the same xft: prefix is used by emacs; xterm uses faceName and renderFont resources to determine whether to use Xft and which font to request; xedit supports core protocol only. The mere fact that the application is configurable from X resources isn't enough to tell how the font names are interpreted.

于 2013-01-06T20:54:27.287 回答
5

我认为您可以使用该程序

xfontsel

获取字体的完整名称。字体名称如下所示:

-*-courier-bold-*-*-*-*-*-*-*-*-*-*-*

最良好的祝愿, 马蒂亚斯

于 2013-01-06T20:37:59.227 回答