summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2020-11-24 08:32:37 -0600
committerCase Duckworth2020-11-24 08:32:37 -0600
commite7447647deb8761e75c12591ccf62ccd9538a57a (patch)
tree0ccede5e58c6471ed1bf63060a18e23daa468190
parentWhitespace ... bleh (diff)
downloademacs-e7447647deb8761e75c12591ccf62ccd9538a57a.tar.gz
emacs-e7447647deb8761e75c12591ccf62ccd9538a57a.zip
Set fonts in a hook
-rw-r--r--config.org56
1 files changed, 33 insertions, 23 deletions
diff --git a/config.org b/config.org index e8e9037..6c7ad20 100644 --- a/config.org +++ b/config.org
@@ -293,6 +293,8 @@ I also want to switch themes between night and day.
293 293
294* Fonts 294* Fonts
295 295
296See [[https://emacs.stackexchange.com/questions/12351/when-to-call-find-font-if-launching-emacs-in-daemon-mode][this StackExchange question and answer]] for more information on why I have these font settings applied in a hook.
297
296#+begin_src emacs-lisp 298#+begin_src emacs-lisp
297 (require 'cl) 299 (require 'cl)
298 (defun font-candidate (&rest fonts) 300 (defun font-candidate (&rest fonts)
@@ -300,29 +302,37 @@ I also want to switch themes between night and day.
300 when (find-font (font-spec :name font)) 302 when (find-font (font-spec :name font))
301 return font)) 303 return font))
302 304
303 (set-face-attribute 'default nil 305 (defun acdw/setup-fonts ()
304 :font 306 "Setup fonts. This has to happen after the frame is set up for
305 (font-candidate 307 the first time, so add it to `focus-in-hook'. It removes
306 "Libertinus Mono-11" 308 itself."
307 "Linux Libertine Mono O-11" 309 (set-face-attribute 'default nil
308 "Go Mono-11" 310 :font
309 "Consolas-11")) 311 (font-candidate
310 312 "Libertinus Mono-11"
311 (set-face-attribute 'fixed-pitch nil 313 "Linux Libertine Mono O-11"
312 :font 314 "Go Mono-11"
313 (font-candidate 315 "Consolas-11"))
314 "Libertinus Mono-11" 316
315 "Linux Libertine Mono O-11" 317 (set-face-attribute 'fixed-pitch nil
316 "Go Mono-11" 318 :font
317 "Consolas-11")) 319 (font-candidate
318 320 "Libertinus Mono-11"
319 (set-face-attribute 'variable-pitch nil 321 "Linux Libertine Mono O-11"
320 :font 322 "Go Mono-11"
321 (font-candidate 323 "Consolas-11"))
322 "Libertinus Serif-12" 324
323 "Linux Libertine O-12" 325 (set-face-attribute 'variable-pitch nil
324 "Go-12" 326 :font
325 "Georgia-11")) 327 (font-candidate
328 "Libertinus Serif-14"
329 "Linux Libertine O-12"
330 "Go-12"
331 "Georgia-11"))
332
333 (remove-hook 'focus-in-hook #'acdw/setup-fonts))
334
335 (add-hook 'focus-in-hook #'acdw/setup-fonts)
326#+end_src 336#+end_src
327 337
328** Unicode 338** Unicode