From b9702ec376bb53e990f52a7cdf052293710941b5 Mon Sep 17 00:00:00 2001 From: Matthew L. Fidler Date: Fri, 26 Feb 2016 10:56:35 -0600 Subject: Have mode icons detect if font is present - Also add IcoMoon font - Change the Unix encoding font to be: - IcoMoon Penguin or - Font Mfizz's Ubuntu or - Font Awesome Penguin Depending on what fonts are installed --- README.org | 5 ++--- mode-icons.el | 12 +++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index cc3c619..f1e903c 100644 --- a/README.org +++ b/README.org @@ -36,11 +36,10 @@ Some of the modes that have icons instead of names now: - [[http://fontawesome.io/][Font Awesome]] - [[https://octicons.github.com/][GitHub Octicons]] - [[http://fizzed.com/oss/font-mfizz][Font Mfizz]] + - [[https://icomoon.io/#icons-icomoon][IcoMoon]] You need to have installed these on your system in order to use - these fonts, mode-icons will not do this for you. If you don't have - them installed you may get some strange glyphs in your mode-line - instead. + these fonts, mode-icons will not do this for you. * Installation diff --git a/mode-icons.el b/mode-icons.el index 9ac55fd..580685e 100644 --- a/mode-icons.el +++ b/mode-icons.el @@ -58,6 +58,7 @@ ;; - Font Awesome, found at URL `http://fontawesome.io/'. ;; - GitHub Octicons, found at URL `https://octicons.github.com/'. ;; - Font Mfizz, found at URL `http://fizzed.com/oss/font-mfizz'. +;; - IcoMoon, found at URL `https://icomoon.io/#icons-icomoon'. ;; ;; You should have these installed if you want to use these icons, ;; otherwise you may get strange glyphs in your mode-line instead of @@ -128,13 +129,14 @@ This was stole/modified from `c-save-buffer-state'" "Define FONT for `mode-icons'." `(progn (defvar ,(intern (format "mode-icons-font-spec-%s" font)) - (font-spec :name ,(format "%s" font))) + (and (member ,(format "%s" font) (font-family-list)) (font-spec :name ,(format "%s" font)))) (defvar ,(intern (format "mode-icons-font-%s" font)) - (find-font ,(intern (format "mode-icons-font-spec-%s" font)))))) + (and (member ,(format "%s" font) (font-family-list)) (find-font ,(intern (format "mode-icons-font-spec-%s" font))))))) (mode-icons-define-font "github-octicons") (mode-icons-define-font "font-mfizz") (mode-icons-define-font "FontAwesome") +(mode-icons-define-font "IcoMoon-Free") (defcustom mode-icons `(("CSS" "css" xpm) @@ -209,7 +211,10 @@ This was stole/modified from `c-save-buffer-state'" (apple #xf179 FontAwesome) (win #xf17a FontAwesome) ;; FIXME: use lsb_release to determine Linux variant and choose appropriate icon - (unix #xf166 font-mfizz) ;; Use ubuntu, since I think it is the most common. + (unix #xeabd IcoMoon-Free) ;; Clear Tux (Unlike FontAwesome) + ;; This icon is clearer than FontAwesome's Linux Penguin + (unix #xf166 font-mfizz) ;; Use ubuntu, since I think it is the most common. + (unix #xf17c FontAwesome) ;; Fall Back to FontAwesome (undecided #xf128 FontAwesome) ("Text\\'" #xf0f6 FontAwesome) ("\\` ?company\\'" #xf1ad FontAwesome) @@ -240,6 +245,7 @@ without the extension. And the third being the type of icon." (const :tag "Octicons" github-octicons) (const :tag "Fizzed" font-mfizz) (const :tag "Font Awesome" FontAwesome) + (const :tag "Ico Moon Free" IcoMoon-Free) (const :tag "png" png) (const :tag "gif" gif) (const :tag "jpeg" jpeg) -- cgit v1.2.3-54-g00ecf