简体   繁体   中英

Setting emacs font under windows

I'm having trouble to change the font for my emacs configuration. 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 is really old, and has been deprecated in Emacs 23 in favor of its new name set-frame-font (which isn't much better). 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...

The elisp code I use is actually different from all the methods suggested there:

;; [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; at least it seems to use Consolas consistently even in things like Python class and function names.

Mx customize-face default will let you customize the default font.

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 ; the face that your cursor is over will be the default one to customize.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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