From 5e6430e9e6e642fc12913cc6b10e599317a2bb7a Mon Sep 17 00:00:00 2001 From: Liam Hupfer Date: Wed, 20 Sep 2023 17:46:48 -0500 Subject: [PATCH] fix: assign Nerd Fonts directly to Unicode PUAs Nerd Fonts assign icons to code points in these Unicode Private Use Areas. `doom-unicode-font` is now available again as a user-defined fallback of last resort for non-PUA Unicode code points. Ref: https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points/f12c615e4d2a411d5e9b3cc57533cf4866e6e3f2#overview --- lisp/doom-ui.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/doom-ui.el b/lisp/doom-ui.el index 8245a0fbe..e343d9bd3 100644 --- a/lisp/doom-ui.el +++ b/lisp/doom-ui.el @@ -36,7 +36,7 @@ Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See An omitted font size means to inherit `doom-font''s size.") -(defvar doom-unicode-font (font-spec :family "Symbols Nerd Font Mono") +(defvar doom-unicode-font nil "Fallback font for Unicode glyphs. Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See `doom-font' for examples. @@ -531,7 +531,10 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (when-let (font (cl-find-if fn doom-emoji-fallback-font-families)) (set-fontset-font t 'unicode font)) (when doom-unicode-font - (set-fontset-font t 'unicode doom-unicode-font)))) + (set-fontset-font t 'unicode doom-unicode-font))) + ;; Nerd Fonts use these Private Use Areas + (dolist (range '((#xe000 . #xf8ff) (#xf0000 . #xfffff))) + (set-fontset-font t range "Symbols Nerd Font Mono"))) ;; Users should inject their own font logic in `after-setting-font-hook' (run-hooks 'after-setting-font-hook))