Unset :weight, :slant, :width on font faces

Setting a face's `:font` attribute implicitly sets a host of other faces
attributes (:family, :foundry, :width, :weight, :height, and :slant),
which is problematic in places where these faces are used in tandem with
other faces, like how EWW renders bold elements with both
variable-pitch+bold faces, with the expectation that their attributes
would cascade properly, but not so if variable-pitch sets :weight or
:slant.
This commit is contained in:
Henrik Lissner 2021-06-04 01:35:59 -04:00
parent 9da4ac05ad
commit 19203a91a3

View file

@ -584,12 +584,13 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(when doom-unicode-font (when doom-unicode-font
(set-fontset-font t 'unicode doom-unicode-font)))) (set-fontset-font t 'unicode doom-unicode-font))))
(apply #'custom-set-faces (apply #'custom-set-faces
(append (when doom-font (let ((attrs '(:weight unspecified :slant unspecified :width unspecified)))
`((fixed-pitch ((t (:font ,doom-font)))))) (append (when doom-font
(when doom-serif-font `((fixed-pitch ((t (:font ,doom-font ,@attrs))))))
`((fixed-pitch-serif ((t (:font ,doom-serif-font)))))) (when doom-serif-font
(when doom-variable-pitch-font `((fixed-pitch-serif ((t (:font ,doom-serif-font ,@attrs))))))
`((variable-pitch ((t (:font ,doom-variable-pitch-font)))))))) (when doom-variable-pitch-font
`((variable-pitch ((t (:font ,doom-variable-pitch-font ,@attrs)))))))))
;; Never save these settings to `custom-file' ;; Never save these settings to `custom-file'
(dolist (sym '(fixed-pitch fixed-pitch-serif variable-pitch)) (dolist (sym '(fixed-pitch fixed-pitch-serif variable-pitch))
(put sym 'saved-face nil)) (put sym 'saved-face nil))