From 0c1f670cad6a5db85ddcf223a05835e44c221848 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 30 Mar 2021 17:23:36 -0500 Subject: Fix font setting I wrap it in a function hooked to `after-focus-change-function', from which it removes itself. ~Fancy~ stuff. --- init.el | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 9fd7840..8c60cda 100644 --- a/init.el +++ b/init.el @@ -234,18 +234,25 @@ scroll-preserve-screen-position 1) ;; Fonts -(set-face-attribute 'default nil - :font (pcase acdw/system - (:home "DejaVu Sans Mono-10") - (:work "Consolas-10") - (:other "monospace-10"))) -(set-face-attribute 'fixed-pitch nil - :inherit 'default) -(set-face-attribute 'variable-pitch nil - :font (pcase acdw/system - (:home "DejaVu Sans") - (:work "Calibri-11") - (:other "sans-serif"))) +;; Load them /after/ the first frame comes into focus +(add-function :after after-focus-change-function + (defun hook--setup-fonts () + (dolist (face '(default fixed-pitch)) + ;; `default' and `fixed-pitch' should be the same. + (set-face-attribute face nil + :font (pcase acdw/system + (:home "DejaVu Sans Mono-10") + (:work "Consolas-10") + (:other "monospace-10")))) + ;; `variable-pitch' is, of course, different. + (set-face-attribute 'variable-pitch nil + :font (pcase acdw/system + (:home "DejaVu Sans") + (:work "Calibri-11") + (:other "sans-serif"))) + (remove-function after-focus-change-function + 'hook--setup-fonts))) + ;; MS Windows (setc w32-allow-system-shell t -- cgit 1.4.1-21-gabe81