Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Last active September 1, 2022 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonm23/4e3748b9e5600f0ca6eabc96e19898e3 to your computer and use it in GitHub Desktop.
Save jasonm23/4e3748b9e5600f0ca6eabc96e19898e3 to your computer and use it in GitHub Desktop.
Select favorite fonts in Doom Emacs
(defun ocodo/font-favorites ()
"Set default and variable-pitch fonts from favorites."
(interactive)
(let* ((m-favorites '(("PFDin Mono XThin" (:family "PFDinMono-XThin" :weight normal))
("PFDin Mono Thin" (:family "PFDinMono-Thin" :weight normal))
("PFDin Mono Light" (:family "PFDinMono-Light" :weight normal))
("SauceCodePro Nerd ExtraLight" (:family "SauceCodePro Nerd Font" :weight light))
("SauceCodePro Nerd Light" (:family "SauceCodePro Nerd Font" :weight semi-light))
("SauceCodePro Nerd Regular" (:family "SauceCodePro Nerd Font" :weight normal))
("Input Mono Regular" (:family "Input Mono" :weight normal))
("Input Mono Light" (:family "Input Mono" :weight semi-light))
("APL385 Unicode" (:family "APL385 Unicode" :weight normal))
("IBM Plex Mono Thin" (:family "IBM Plex Mono" :weight ultra-light))
("IBM Plex Mono ExtraLight" (:family "IBM Plex Mono" :weight light))
("IBM Plex Mono Light" (:family "IBM Plex Mono" :weight semi-light))
("IBM Plex Mono Regular" (:family "IBM Plex Mono" :weight normal))))
(v-favorites '(("Helvetica Neue Regular" (:family "Helvetica Neue" :weight normal))
("Helvetica Neue Light" (:family "Helvetica Neue" :weight light))
("Helvetica Neue Ultralight" (:family "Helvetica Neue" :weight thin))
("Helvetica Neue Thin" (:family "Helvetica Neue" :weight ultra-light))
("Bodini 72" (:family "Bodini 72" :weight normal))
("American Typewriter Light" (:family "American Typewriter" :weight light))
("American Typewriter Regular" (:family "American Typewriter" :weight normal))
("Futura" (:family "Futura" :weight normal))
("Gill Sans Regular" (:family "Gill Sans" :weight normal))
("Gill Sans Light" (:family "Gill Sans" :weight light))
("Avenir Next Ultralight" (:family "Avenir Next" :weight thin))
("Avenir Next Regular" (:family "Avenir Next" :weight normal))))
(m-selected (assoc (completing-read "Select default font: " (--map (car it) m-favorites)) m-favorites))
(ml-selected (assoc (completing-read "Select modeline font: " (--map (car it) v-favorites)) v-favorites))
(v-selected (assoc (completing-read "Select variable pitch font: " (--map (car it) v-favorites)) v-favorites)))
(setq doom-font
(apply 'font-spec (cadr m-selected))
doom-variable-pitch-font
(apply 'font-spec (cadr v-selected)))
(let* ((spec (cadr ml-selected))
(font (plist-get spec :family))
(weight (plist-get spec :weight)))
(set-face-attribute 'mode-line nil :family font :weight weight)
(set-face-attribute 'mode-line-inactive nil :family font :weight weight))
(doom/reload-font)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment