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.
Press Shift and the first mouse button. You can change the font size in the following way: This website has more detail.
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")))))
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.
(set-face-attribute 'default nil :height 100)
The value is in 1/10pt, so 100 will give you 10pt, etc.
For emacs23, have a look at this: http://www.emacswiki.org/emacs/XftGnuEmacs
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