Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add default font search

  • Loading branch information...
commit b316d871165b745738c5648f854a19f094ea15d7 1 parent 9b18645
Adam Lindberg authored
Showing with 29 additions and 0 deletions.
  1. +29 −0 emacs.el
View
29 emacs.el
@@ -148,6 +148,35 @@
; '(show-paren-mismatch ((((class color)) (:background "red4"))))
'(yas/field-highlight-face ((t (:background "DimGrey" :underline "white")))))
+;;**************************************************
+;; font Searching
+;;**************************************************
+;; http://superuser.com/questions/265851/setting-default-font-in-emacs
+
+(defun font-existsp (font)
+ "Check that a font exists: http://www.emacswiki.org/emacs/SetFonts#toc8"
+ (and (window-system)
+ (fboundp 'x-list-fonts)
+ (x-list-fonts font)))
+
+(setq kjfletch-font-list
+ '(;; List of fonts to search for in order of priority.
+ ;; Each has it's own line for easy transposing.
+ "Menlo-10"
+ "Consolas-10"
+ "Monospace-10"
+ ))
+
+(let* ((in-loop t)
+ (font (car kjfletch-font-list))
+ (rest (cdr kjfletch-font-list)))
+ (while (and font in-loop)
+ (when (font-existsp font)
+ (set-face-attribute 'default nil :font font)
+ (setq in-loop nil))
+ (setq font (car rest)
+ rest (cdr rest))))
+
;; -----------------------------------------------------------------------------
;; Erlang Mode
Please sign in to comment.
Something went wrong with that request. Please try again.