【发布时间】:2015-09-23 16:35:27
【问题描述】:
我正在尝试将 [Inconsolata-dz][1] 设置为 Emacs 的默认字体。常规 Inconsolata 工作正常,但 dz 版本不能正常工作。我使用的大多数函数都会抛出这个错误(遵循所有关于如何设置 Emacs 字体的在线说明):
set-face-attribute: Invalid font name: "-*-Inconsolata-dz-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"
我终于通过在我的init.el 中执行此操作:
(setq initial-frame-alist '((font . "Inconsolata-dz-13")))
(setq default-frame-alist '((font . "Inconsolata-dz-13")))
我在init.el 中也有这个,它是由customize-faces 生成的,但它似乎将字体更改为 Helvetica(除非被上面的代码覆盖):
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
(quote
("e16a771a13a202ee6e276d06098bc77f008b73bbac4d526f160faa2d76c1dd0e"
"d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879"
"8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4"
default))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :inverse-video nil
:box nil :strike-through nil :overline nil
:underline nil :slant normal
:weight normal :height 140 :width normal
:foundry "nil" :family "Inconsolata-dz")))))
现在上面第一个代码的问题是执行Ctrl+N,以创建一个新窗口将引发相同的 Invalid font name 错误。
我在我的 Mac 上以相同的方式安装了 Inconsolata 和 Inconsolata-dz。只是在 OS X 上安装字体的常规默认方式。
有谁知道我做错了什么以及如何正确使用 Inconsolata-dz?
【问题讨论】:
-
要查看可用的字体,请在
*Scratch*缓冲区中评估以下内容:(insert (prin1-to-string (x-list-fonts "*")))如果不存在,则不可用。一般情况下,发帖者应该选择一个论坛或另一个,但不能交叉发帖:emacs.stackexchange.com/questions/16818/… -
@lawlist 我在那里看到它,但它是一个很长的名字。当我将它粘贴到 set-face-attribute (
(set-face-attribute 'default nil :family "-*-Inconsolata-g-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1")) 中时,我得到“无效的面部铸造”。任何想法为什么?这个名字到底应该是什么? Inconsolata 有效,但 Inconsolata-g 和 Inconsolata-dz 不起作用,即使它们都可用并且安装方式相同。我怀疑是名称中的破折号?