feat: add doom-emoji-font
This parallels doom-symbol-font for emoji. In the process, refactor symbol and emoji font setup to take advantage of these parallels.
This commit is contained in:
parent
4499ce7b0a
commit
37affa5cff
2 changed files with 19 additions and 8 deletions
|
@ -46,6 +46,14 @@ font to that size. It's rarely a good idea to do so!")
|
|||
|
||||
(define-obsolete-variable-alias 'doom-unicode-font 'doom-symbol-font "3.0.0")
|
||||
|
||||
(defvar doom-emoji-font nil
|
||||
"Fallback font for emoji.
|
||||
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
||||
`doom-font' for examples.
|
||||
|
||||
WARNING: if you specify a size for this font it will hard-lock any usage of this
|
||||
font to that size. It's rarely a good idea to do so!")
|
||||
|
||||
(defvar doom-emoji-fallback-font-families
|
||||
'("Apple Color Emoji"
|
||||
"Segoe UI Emoji"
|
||||
|
@ -525,15 +533,16 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
(custom-push-theme 'theme-face face 'user 'set new-specs)
|
||||
(put face 'face-modified nil))))
|
||||
(when (fboundp 'set-fontset-font)
|
||||
(let ((fn (doom-rpartial #'member (font-family-list))))
|
||||
(when-let (font (cl-find-if fn doom-symbol-fallback-font-families))
|
||||
(let* ((fn (doom-rpartial #'member (font-family-list)))
|
||||
(symbol-font (or doom-symbol-font
|
||||
(cl-find-if fn doom-symbol-fallback-font-families)))
|
||||
(emoji-font (or doom-emoji-font
|
||||
(cl-find-if fn doom-emoji-fallback-font-families))))
|
||||
(when symbol-font
|
||||
(dolist (script '(symbol mathematical))
|
||||
(set-fontset-font t script font)))
|
||||
(when-let (font (cl-find-if fn doom-emoji-fallback-font-families))
|
||||
(set-fontset-font t 'emoji font)))
|
||||
(when doom-symbol-font
|
||||
(dolist (script '(symbol mathematical))
|
||||
(set-fontset-font t script doom-symbol-font)))
|
||||
(set-fontset-font t script symbol-font)))
|
||||
(when emoji-font
|
||||
(set-fontset-font t 'emoji emoji-font)))
|
||||
;; Nerd Fonts use these Private Use Areas
|
||||
(dolist (range '((#xe000 . #xf8ff) (#xf0000 . #xfffff)))
|
||||
(set-fontset-font t range "Symbols Nerd Font Mono")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue