chore(font): improve font setting logic with list of preferred fonts

This commit is contained in:
2022-02-07 10:43:04 +00:00
parent b428d262ff
commit 96d7d3cb63

View File

@@ -21,10 +21,17 @@
;; When running in GUI mode.
(when window-system
;; Set default font
(let* ((primary "Menlo Nerd Font Mono")
(fallback "Menlo")
(family (if (member primary (font-family-list)) primary fallback)))
;; Set default font based on priority list
(let* ((families '("Menlo Nerd Font Mono"
"Menlo for Powerline"
"Menlo"
"Monaco Nerd Font Mono"
"Monaco for Powerline"
"Monaco"))
(family (catch 'found
(dolist (f families)
(if (member f (font-family-list))
(throw 'found f))))))
(set-face-attribute 'default nil :family family :height 120))
;; Fix the default default-directory value.