diff options
author | Case Duckworth | 2021-04-09 12:48:54 -0500 |
---|---|---|
committer | Case Duckworth | 2021-04-09 12:48:54 -0500 |
commit | bac79657a5dac12776a5e0f2c2af8ae51dc618cd (patch) | |
tree | 707683fd93cfd163f2eecf8fd638fe7cefde835d /early-init.el | |
parent | Add `acdw/find-emacs-dotfiles' (diff) | |
download | emacs-bac79657a5dac12776a5e0f2c2af8ae51dc618cd.tar.gz emacs-bac79657a5dac12776a5e0f2c2af8ae51dc618cd.zip |
Change font loading logic to hopefully be more robust
Based heavily (basically copied) from https://github.com/olivertaylor/olivertaylor.github.io/blob/master/notes/20210324_emacs-optical-font-adjustment.org
Diffstat (limited to 'early-init.el')
-rw-r--r-- | early-init.el | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/early-init.el b/early-init.el index 53059cd..8515fa9 100644 --- a/early-init.el +++ b/early-init.el | |||
@@ -72,19 +72,18 @@ | |||
72 | 72 | ||
73 | (add-function :after after-focus-change-function | 73 | (add-function :after after-focus-change-function |
74 | (defun hook--setup-fonts () | 74 | (defun hook--setup-fonts () |
75 | (dolist (face '(default fixed-pitch)) | 75 | (require 'acdw-fonts) |
76 | ;; `default' and `fixed-pitch' should be the same. | 76 | (setq acdw-fonts/monospace (pcase acdw/system |
77 | (set-face-attribute face nil | 77 | (:home "DejaVu Sans Mono") |
78 | :font (pcase acdw/system | 78 | (:work "Consolas") |
79 | (:home "DejaVu Sans Mono-10") | 79 | (:other "monospace")) |
80 | (:work "Consolas-10") | 80 | acdw-fonts/monospace-size 10 |
81 | (:other "monospace-10")))) | 81 | acdw-fonts/variable (pcase acdw/system |
82 | ;; `variable-pitch' is, of course, different. | ||
83 | (set-face-attribute 'variable-pitch nil | ||
84 | :font (pcase acdw/system | ||
85 | (:home "DejaVu Sans") | 82 | (:home "DejaVu Sans") |
86 | (:work "Calibri-11") | 83 | (:work "Calibri") |
87 | (:other "sans-serif"))) | 84 | (:other "sans-serif")) |
85 | acdw-fonts/variable-size 11) | ||
86 | (acdw-fonts/set) | ||
88 | (remove-function after-focus-change-function | 87 | (remove-function after-focus-change-function |
89 | 'hook--setup-fonts))) | 88 | 'hook--setup-fonts))) |
90 | 89 | ||