forked from purcell/emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit-fonts.el
57 lines (44 loc) · 1.8 KB
/
init-fonts.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(require 'cl)
(defmacro preserving-maximization (&rest body)
(let ((maximized-frames (gensym)))
`(let ((,maximized-frames (loop for f in (frame-list)
when (maximized-p f)
collect f)))
(prog1 (progn ,@body)
(dolist (frame ,maximized-frames)
(select-frame frame)
(maximize-frame))))))
(defun increment-default-font-height (delta)
(preserving-maximization
(let ((new-height (+ (face-attribute 'default :height) delta)))
(set-face-attribute 'default nil :height new-height)
(message "default font size is now %d" (/ new-height 10)))))
(defun increase-default-font-height ()
(interactive)
(increment-default-font-height 10))
(defun decrease-default-font-height ()
(interactive)
(increment-default-font-height -10))
(defmacro preserving-default-font-size (&rest body)
(let ((old-size (gensym)))
`(preserving-maximization
(let ((,old-size (face-attribute 'default :height)))
(prog1 (progn ,@body)
(set-face-attribute 'default nil :height ,old-size))))))
(set-face-attribute 'default nil
:family "Calibri" :height 180 :weight 'normal)
(add-hook 'calendar-mode-hook 'fg/set-monospace-font)
(add-hook 'notmuch-hello-mode-hook 'fg/set-monospace-font)
(add-hook 'notmuch-search-hook 'fg/set-monospace-font)
(add-hook 'term-mode-hook 'fg/set-monospace-font)
(defun fg/set-varwidth-font ()
(interactive)
(variable-pitch-mode t)
(set-face-attribute 'variable-pitch nil
:family "Calibri" :height 180 :weight 'normal))
(defun fg/set-monospace-font ()
(interactive)
(variable-pitch-mode t)
(set-face-attribute 'variable-pitch nil
:family "Consolas" :height 170 :weight 'normal))
(provide 'init-fonts)