Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 594
DimaK Avatar asked Mar 25 '11 18:03

DimaK


People also ask

How do I change the font in Emacs?

Use ` S-down-mouse-1 ' or ` M-x menu-set-font ' to see the font and fontset menu. Emacs starts with the startup fontset. Use ` M-x describe-font ' to see the requested font and actual font being used.

What is the Emacs default font?

By default, Emacs displays text on graphical displays using a 10-point monospace font, and the font size can be changed interactively (see Text Scale).


2 Answers

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.

like image 84
Michael Ratanapintha Avatar answered Oct 04 '22 10:10

Michael Ratanapintha


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

like image 21
dfan Avatar answered Oct 04 '22 10:10

dfan