简体   繁体   English

在windows下设置emacs字体

[英]Setting emacs font under windows

I'm having trouble to change the font for my emacs configuration. 我无法更改emacs配置的字体。 I've tried using set-default-font, and managed to tab to my desired font, however, some elements are still rendered as the old font (ie python's class names and function names) 我已经尝试使用set-default-font,并设法选项卡到我想要的字体,但是,一些元素仍然呈现为旧字体(即python的类名和函数名)

set-default-font is really old, and has been deprecated in Emacs 23 in favor of its new name set-frame-font (which isn't much better). set-default-font确实很旧,并且在Emacs 23中已经弃用了它的新名称set-frame-font(这不是更好)。 The current Emacs manual suggests several ways to set the default font , but I'll assume you've found those already, seeing as you've tried set-default-font... 当前的Emacs手册提出了几种设置默认字体的方法 ,但是我假设你已经找到了这些,看到你已经尝试过set-default-font ...

The elisp code I use is actually different from all the methods suggested there: 我使用的elisp代码实际上与那里建议的所有方法不同:

;; [in .emacs]
;; Use 10-pt Consolas as default font
(set-face-attribute 'default nil
                    :family "Consolas" :height 100)

set-face-attribute seems to stick better than set-default-font; set-face-attribute似乎比set-default-font更好; at least it seems to use Consolas consistently even in things like Python class and function names. 至少它似乎一直使用Consolas甚至在Python类和函数名称之类的东西。

Mx customize-face default will let you customize the default font. Mx customize-face default将允许您自定义默认字体。

If some things are still rendered in a font you don't like, then position your cursor to be over the offending text and type Mx customize-face ; 如果某些内容仍以您不喜欢的字体呈现,则将光标定位在违规文本上并键入Mx customize-face ; the face that your cursor is over will be the default one to customize. 光标所在的面将是要自定义的默认面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM