Emacs: 如何指定 TrueType 字体的位置?

5

我希望在一个集群上使用DejaVu字体,但我没有系统范围内安装字体的权限。我将这些免费的字体放在~/.fonts中,并希望使用DejaVuSansMono.ttf字体。通常我只需要在.emacs文件中放入以下代码:

(custom-set-variables 
 '(default ((t (:inherit nil :stipple nil :background "#ffffb1" :foreground "#141312" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 173 :width normal :foundry "monotype" :family "DejaVu Sans Mono")))))

但是现在emacs找不到字体了!

所以我的问题是,我该如何帮助emacs找到字体?我如何指定字体的路径?


你的窗口系统能找到这个字体吗? - jtahlborn
@jtahlborn:很抱歉 - 但我该如何检查呢? - Adobe
你能否打开系统中的其他窗口应用程序并使用该字体?如果不能,那么该字体可能没有正确安装。 - jtahlborn
我已经在服务器上启动了Firefox - 并且在首选项中,我可以看到Firefox意识到Dejavu字体。但是我不知道它们是我的还是系统全局的。实际上,我认为仅将字体放置在“~ / .fonts”文件夹中并不等同于安装。但我认为可以为emacs提供一种搜索TrueType字体的方法。 - Adobe
1个回答

0

看起来bdf-directory-list会解决它。

(setq bdf-directory-list '("/path/to/fonts"))

我现在无法尝试 - 稍后回来。


在Centos 7上,使用Emacs 28.2对我来说无效。 - Justin Schell
据我所知,这似乎不适用于TTF字体。 - Radon Rosborough

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接