Emacs: Improve font-checking.

This commit is contained in:
tastytea 2019-12-13 17:54:59 +01:00
parent 5e34b6c28d
commit aee9fc2391

View File

@ -1,6 +1,6 @@
;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*- ;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*-
;; Time-stamp: <2019-11-09T21:25:20+00:00> ;; Time-stamp: <2019-12-13T16:54:47+00:00>
;;; Commentary: ;;; Commentary:
@ -26,8 +26,16 @@
;; Icon font (required by doom and others). ;; Icon font (required by doom and others).
(use-package all-the-icons (use-package all-the-icons
:init
(defun my/font-installed-p (font-name)
"Check if font with FONT-NAME is available."
(if (find-font (font-spec :name font-name))
t
nil))
:config :config
(unless (file-exists-p "~/.local/share/fonts/all-the-icons.ttf") ;; Install fonts if we have a GUI and the font is not already installed.
(when (and (window-system) (not (my/font-installed-p "all-the-icons")))
(all-the-icons-install-fonts t)) (all-the-icons-install-fonts t))
) )