【问题标题】:Emacs : "set default font" and init.elEmacs:“设置默认字体”和 init.el
【发布时间】:2016-05-23 11:45:27
【问题描述】:

我想设置我的起始默认字体。 我在选项中选择一种字体-> 设置默认字体。然后我用 Options --> Save Options 保存它。

这写在我的 ~/.emacs.d/init.el 文件的末尾:

 (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 :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant italic :weight bold :height 241 :width normal :foundry "microsoft" :family "Trebuchet MS" "Courier New" :foundry "monotype" :slant normal :weight bold :height 240 :width normal "Courier New"))))

再次启动 emacs 时,不会加载所选字体。正如*Messages* 或 --debug-init 所报告的,init.d 文件没有问题。 似乎“设置默认字体”查找字体和 init.d 查找字体的机制不同...

我做错了什么?
在 Ubuntu 14.04LTS、Emacs 24 上运行

【问题讨论】:

  • 我觉得"Courier New" 的出现很奇怪。如果您删除这两个事件,它会起作用吗?
  • 另外,请确保 (custom-set-faces...) 在您的 init 文件中仅出现一次,根据您上面引用中的注释。
  • 顺便说一句——我假设init.d实际上是指.emacs.d/init.el
  • 哎呀!绝对!

标签: emacs fonts


【解决方案1】:

您可以在 init.el 文件中进行如下设置:

(set-default-font "Inconsolata 12")

或摩纳哥字体

(set-default-font "Monaco 12")

【讨论】:

  • 我得到:“调试器进入--Lisp 错误:(void-function set-default-font)”
【解决方案2】:

这对我有用(Emacs 27.1)

;; Set default font
(set-face-attribute 'default nil
                    :family "Courier New"
                    :height 120
                    :weight 'normal
                    :width 'normal)

【讨论】:

    猜你喜欢
    • 2010-10-06
    • 2011-06-16
    • 1970-01-01
    • 2017-12-10
    • 2010-11-18
    • 2012-01-18
    • 1970-01-01
    • 1970-01-01
    • 2014-12-06
    相关资源
    最近更新 更多