Skip to content

Instantly share code, notes, and snippets.

@emres
Created May 9, 2019 09:50
Show Gist options
  • Save emres/a36642f497f10c134f1e704b56d81e67 to your computer and use it in GitHub Desktop.
Save emres/a36642f497f10c134f1e704b56d81e67 to your computer and use it in GitHub Desktop.
Compare mono spaced fonts in MS Windows by printing the same string of text in all of them
;; see also:
;; https://gist.github.com/emres/917ffc60f4fe209a6a1bad6b3abd4fa1
(defun font-is-mono-p (font-name)
(string-match "-mono-" font-name))
(defun compare-monospace-fonts ()
"Display a list of all monospace font faces. Tested on MS Windows 10."
(interactive)
(pop-to-buffer "*Monospace Fonts*")
(erase-buffer)
(dolist (font-name (x-list-fonts "*"))
(if (and (font-is-mono-p font-name)
(ignore-errors (font-spec :name font-name)))
(progn
(newline)
(insert
(propertize (concat "1 l; 0 O o [ < = > ] " font-name ")\n")
'font-lock-face `((:family ,(format "%s" (font-get (font-spec :name font-name) :family)))
(:font (font-spec :name font-name)))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment