Emacs: Changing the font size on the fly
Posted on September 15th, 2006 by Sacha Chua
I have a tiny laptop: 8.9" diagonally. With a 1024x768 pixels screen resolution, things can get *pretty* small. The following functions use the gnome-terminal-style shortcuts (Ctrl-plus, Ctrl-minus) to change the font size without the mouse:
(defun sacha/increase-font-size ()
(interactive)
(set-face-attribute 'default
nil
:height
(ceiling (* 1.10
(face-attribute 'default :height)))))
(defun sacha/decrease-font-size ()
(interactive)
(set-face-attribute 'default
nil
:height
(floor (* 0.9
(face-attribute 'default :height)))))
(global-set-key (kbd "C-+") 'sacha/increase-font-size)
(global-set-key (kbd "C--") 'sacha/decrease-font-size)
On Technorati: emacs, pimpmyemacs
Save to - del.icio.us - Digg it - reddit - StumbleUpon
No comments yet.