Rework how unicode fonts are set and loaded
This commit is contained in:
parent
2525822791
commit
a4fb4070ea
|
@ -68,7 +68,8 @@ See `doom|init-fonts'."
|
|||
(interactive)
|
||||
(when doom-font
|
||||
(set-frame-font doom-font t))
|
||||
(doom|init-fonts))
|
||||
(doom|init-fonts)
|
||||
(mapc #'doom|init-emoji-fonts (frame-list)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/reload-theme ()
|
||||
|
|
|
@ -38,11 +38,15 @@ Expects either a `font-spec', font object, a XFT font string or XLFD string. See
|
|||
It is recommended you don't set specify a font-size, as to inherit `doom-font's
|
||||
size.")
|
||||
|
||||
(defvar doom-unicode-font nil
|
||||
"Fallback font for unicode glyphs. Is ignored if :ui unicode is active.
|
||||
(defvar doom-unicode-font
|
||||
(if IS-MAC
|
||||
(font-spec :family "Apple Color Emoji")
|
||||
(font-spec :family "Symbola"))
|
||||
"Fallback font for unicode glyphs.
|
||||
|
||||
Expects either a `font-spec', font object, a XFT font string or XLFD string. See
|
||||
`doom-font' for examples.
|
||||
It defaults to Apple Color Emoji on MacOS and Symbola on Linux. Expects either a
|
||||
`font-spec', font object, a XFT font string or XLFD string. See `doom-font' for
|
||||
examples.
|
||||
|
||||
It is recommended you don't set specify a font-size, as to inherit `doom-font's
|
||||
size.")
|
||||
|
@ -464,10 +468,7 @@ Fonts are specified by `doom-font', `doom-variable-pitch-font',
|
|||
(when doom-serif-font
|
||||
(set-face-attribute 'fixed-pitch-serif nil :font doom-serif-font))
|
||||
(when doom-variable-pitch-font
|
||||
(set-face-attribute 'variable-pitch nil :font doom-variable-pitch-font))
|
||||
;; Fallback to `doom-unicode-font' for Unicode characters
|
||||
(when (fontp doom-unicode-font)
|
||||
(set-fontset-font t nil doom-unicode-font nil 'append)))
|
||||
(set-face-attribute 'variable-pitch nil :font doom-variable-pitch-font)))
|
||||
((debug error)
|
||||
(if (string-prefix-p "Font not available: " (error-message-string e))
|
||||
(lwarn 'doom-ui :warning
|
||||
|
@ -475,6 +476,13 @@ Fonts are specified by `doom-font', `doom-variable-pitch-font',
|
|||
(font-get (caddr e) :family))
|
||||
(signal 'doom-error e)))))
|
||||
|
||||
(defun doom|init-emoji-fonts (frame)
|
||||
"Set up unicode fonts (if `doom-unicode-font' is set).
|
||||
|
||||
By default, this uses Apple Color Emoji on MacOS and Symbola on Linux."
|
||||
(when doom-unicode-font
|
||||
(set-fontset-font t '(#x1F600 . #x1F64F) doom-unicode-font frame 'prepend)))
|
||||
|
||||
(defun doom|init-theme (&optional frame)
|
||||
"Load the theme specified by `doom-theme' in FRAME."
|
||||
(when (and doom-theme (not (memq doom-theme custom-enabled-themes)))
|
||||
|
@ -510,6 +518,8 @@ Fonts are specified by `doom-font', `doom-variable-pitch-font',
|
|||
(add-hook 'doom-init-ui-hook #'doom|init-theme))
|
||||
;; Apply `doom-font' et co
|
||||
(add-hook 'doom-after-init-modules-hook #'doom|init-fonts)
|
||||
;; Ensure unicode fonts are set on each frame
|
||||
(add-hook 'after-make-frame-functions #'doom|init-emoji-fonts)
|
||||
;; Setup `doom-load-theme-hook' and ensure `doom-theme' is always set to the
|
||||
;; currently loaded theme
|
||||
(advice-add #'load-theme :after #'doom*run-load-theme-hooks)
|
||||
|
|
|
@ -163,7 +163,7 @@ Doom was setup, which may cause problems.")
|
|||
(setq selection-coding-system 'utf-8)) ; with sugar on top
|
||||
|
||||
(setq-default
|
||||
ad-redefinition-action 'accept ; silence advised function warnings
|
||||
ad-redefinition-action 'accept ; silence redefined function warnings
|
||||
apropos-do-all t ; make `apropos' more useful
|
||||
auto-mode-case-fold nil
|
||||
autoload-compute-prefixes nil
|
||||
|
@ -171,7 +171,7 @@ Doom was setup, which may cause problems.")
|
|||
jka-compr-verbose doom-debug-mode ; silence compression messages
|
||||
ffap-machine-p-known 'reject ; don't ping things that look like domain names
|
||||
find-file-visit-truename t ; resolve symlinks when opening files
|
||||
idle-update-delay 2 ; update ui less often
|
||||
idle-update-delay 2 ; update ui slightly less often
|
||||
;; be quiet at startup; don't load or display anything unnecessary
|
||||
inhibit-startup-message t
|
||||
inhibit-startup-echo-area-message user-login-name
|
||||
|
|
Loading…
Reference in New Issue
Block a user