fix: tiny fonts in (daemon) GUI frames
Due to a suppressed void-variable error, font initialization is short-circuited across daemon frames when the fonts are reloaded or changed (which is also triggered by changing themes), resulting in malformed (often tiny) fonts in GUI frames. Fix: #7730
This commit is contained in:
parent
5280fb2855
commit
c20c2aa36e
1 changed files with 27 additions and 26 deletions
|
@ -498,7 +498,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(cons 'custom-theme-directory
|
(cons 'custom-theme-directory
|
||||||
(delq 'custom-theme-directory custom-theme-load-path)))
|
(delq 'custom-theme-directory custom-theme-load-path)))
|
||||||
|
|
||||||
(defun doom--make-font-specs (face font)
|
(defun doom--make-font-specs (face font frame)
|
||||||
(let* ((base-specs (cadr (assq 'user (get face 'theme-face))))
|
(let* ((base-specs (cadr (assq 'user (get face 'theme-face))))
|
||||||
(base-specs (or base-specs '((t nil))))
|
(base-specs (or base-specs '((t nil))))
|
||||||
(attrs '(:family :foundry :slant :weight :height :width))
|
(attrs '(:family :foundry :slant :weight :height :width))
|
||||||
|
@ -509,14 +509,15 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(plist (copy-tree (nth 1 spec))))
|
(plist (copy-tree (nth 1 spec))))
|
||||||
;; Alter only DISPLAY conditions matching this frame.
|
;; Alter only DISPLAY conditions matching this frame.
|
||||||
(when (or (memq display '(t default))
|
(when (or (memq display '(t default))
|
||||||
(face-spec-set-match-display display this-frame))
|
(face-spec-set-match-display display frame))
|
||||||
(dolist (attr attrs)
|
(dolist (attr attrs)
|
||||||
(setq plist (plist-put plist attr (face-attribute face attr)))))
|
(setq plist (plist-put plist attr (face-attribute face attr)))))
|
||||||
(push (list display plist) new-specs)))
|
(push (list display plist) new-specs)))
|
||||||
(nreverse new-specs)))
|
(nreverse new-specs)))
|
||||||
|
|
||||||
(defun doom-init-fonts-h (&optional reload)
|
(defun doom-init-fonts-h (&optional _reload)
|
||||||
"Loads `doom-font'."
|
"Loads `doom-font', `doom-serif-font', and `doom-variable-pitch-font'."
|
||||||
|
(let ((this-frame (selected-frame)))
|
||||||
(dolist (map `((default . ,doom-font)
|
(dolist (map `((default . ,doom-font)
|
||||||
(fixed-pitch . ,doom-font)
|
(fixed-pitch . ,doom-font)
|
||||||
(fixed-pitch-serif . ,doom-serif-font)
|
(fixed-pitch-serif . ,doom-serif-font)
|
||||||
|
@ -529,7 +530,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(set-face-attribute face frame
|
(set-face-attribute face frame
|
||||||
:width 'normal :weight 'normal
|
:width 'normal :weight 'normal
|
||||||
:slant 'normal :font font)))
|
:slant 'normal :font font)))
|
||||||
(let ((new-specs (doom--make-font-specs face font)))
|
(let ((new-specs (doom--make-font-specs face font this-frame)))
|
||||||
;; Don't save to `customized-face' so it's omitted from `custom-file'
|
;; Don't save to `customized-face' so it's omitted from `custom-file'
|
||||||
;;(put face 'customized-face new-specs)
|
;;(put face 'customized-face new-specs)
|
||||||
(custom-push-theme 'theme-face face 'user 'set new-specs)
|
(custom-push-theme 'theme-face face 'user 'set new-specs)
|
||||||
|
@ -538,7 +539,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(ignore-errors (doom--reset-inhibited-vars-h))
|
(ignore-errors (doom--reset-inhibited-vars-h))
|
||||||
(if (string-prefix-p "Font not available" (error-message-string e))
|
(if (string-prefix-p "Font not available" (error-message-string e))
|
||||||
(signal 'doom-font-error (list (font-get (cdr map) :family)))
|
(signal 'doom-font-error (list (font-get (cdr map) :family)))
|
||||||
(signal (car e) (cdr e))))))
|
(signal (car e) (cdr e)))))))
|
||||||
(when (fboundp 'set-fontset-font)
|
(when (fboundp 'set-fontset-font)
|
||||||
(let* ((fn (doom-rpartial #'member (font-family-list)))
|
(let* ((fn (doom-rpartial #'member (font-family-list)))
|
||||||
(symbol-font (or doom-symbol-font
|
(symbol-font (or doom-symbol-font
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue