tags:

views:

13810

answers:

8

I was wondering how does one set the font size in emacs. I want to save this in the .emacs file but I don't know how to set the font.

+11  A: 

Press Shift and the first mouse button. You can change the font size in the following way: This website has more detail.

George Stocker
I wish I could upvote more than once. This is perfect.
Alex B
How can this be made permanent?
Andrew Larned
+5  A: 

M-x customize-face RET default will allow you to set the face default face, on which all other faces base on. There you can set the font-size.

Here is what is in my .emacs. actually, color-theme will set the basics, then my custom face setting will override some stuff. the custom-set-faces is written by emacs's customize-face mechanism:

;; my colour theme is whateveryouwant :)
(require 'color-theme)
(color-theme-initialize)
(color-theme-whateveryouwant)

(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 (:stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
 '(font-lock-comment-face ((t (:foreground "darkorange4"))))
 '(font-lock-function-name-face ((t (:foreground "navy"))))
 '(font-lock-keyword-face ((t (:foreground "red4"))))
 '(font-lock-type-face ((t (:foreground "black"))))
 '(linum ((t (:inherit shadow :background "gray95"))))
 '(mode-line ((t (nil nil nil nil :background "grey90" (:line-width -1 :color nil :style released-button) "black" :box nil :width condensed :foundry "unknown" :family "DejaVu Sans Mono")))))
Johannes Schaub - litb
+3  A: 

I've got the following in my .emacs:

(defun fontify-frame (frame)
  (set-frame-parameter frame 'font "Monospace-11"))

;; Fontify current frame
(fontify-frame nil)
;; Fontify any future frames
(push 'fontify-frame after-make-frame-functions)

You can subsitute any font of your choosing for "Monospace-11". The set of available options is highly system-dependent. Using M-x set-default-font and looking at the tab-completions will give you some ideas. On my system, with Emacs 23 and anti-aliasing enabled, can choose system fonts by name, e.g., Monospace, Sans Serif, etc.

Chris Conway
yeah, emacs23 rocks. here is my emacs: http://stackoverflow.com/questions/93326/which-ide-is-best-for-c#278035
Johannes Schaub - litb
A: 

It depends which platform you're on, but regardless Emacswiki has all the answers.

Alastair
It is often misleading. There is no mention, for example, of huai's solution, which is the simplest.
konr
There is now. :-)
garyo
+29  A: 
(set-face-attribute 'default nil :height 100)

The value is in 1/10pt, so 100 will give you 10pt, etc.

huaiyuan
thank you for this
James
+2  A: 

For emacs23, have a look at this: http://www.emacswiki.org/emacs/XftGnuEmacs

crocpulsar
A: 

In NTEmacs 23.1, the Options menu has a "Set default font..." option.

Phil
+6  A: 

From Emacswiki, GNU Emacs 23 has a built-in key combination:

`C-x C-+’ and ‘C-x C--’ to increase or decrease the buffer text size

Brandon Leiran
thanks for the pointer to this emacswiki page
Noah Sussman