From b14d826809e1ad5e39ccd4eff51232a475c3b19d Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 10 Dec 2014 08:41:13 -0800 Subject: [PATCH] add dynamic fonts. --- dotfiles/emacs.d/init.el | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dotfiles/emacs.d/init.el b/dotfiles/emacs.d/init.el index 7291d8bd..ac9a71f6 100644 --- a/dotfiles/emacs.d/init.el +++ b/dotfiles/emacs.d/init.el @@ -1374,6 +1374,51 @@ The current directory is assumed to be the project's root otherwise." (read-only-mode)) (add-hook 'compilation-filter-hook 'colorize-compilation-buffer) +(use-package dynamic-fonts + :ensure t + :commands (dynamic-fonts-setup) + :init + (progn + (setq + dynamic-fonts-preferred-monospace-fonts + '("PragmataPro" "Consolas" "Monaco" "Menlo" "DejaVu Sans Mono" + "Droid Sans Mono Pro" "Droid Sans Mono" "Inconsolata" "Source Code Pro" + "Lucida Console" "Envy Code R" "Andale Mono" "Lucida Sans Typewriter" + "Lucida Typewriter" "Panic Sans" "Bitstream Vera Sans Mono" + "Excalibur Monospace" "Courier New" "Courier" "Cousine" "Lekton" + "Ubuntu Mono" "Liberation Mono" "BPmono" "Anonymous Pro" + "ProFontWindows") + dynamic-fonts-preferred-monospace-point-size 11 + dynamic-fonts-preferred-proportional-fonts + '("PT Sans" "Lucida Grande" "Segoe UI" "DejaVu Sans" "Bitstream Vera" + "Tahoma" "Verdana" "Helvetica" "Arial Unicode MS" "Arial") + dynamic-fonts-preferred-proportional-point-size 11) + + (defvar my-monospaced-font "PragmataPro-11.8") + (defvar my-variable-pitch-font "Pt Sans-13") + ;; (defvar my-variable-pitch-font "Input Sans Compressed-11.8") + ;; (defvar my-monospaced-font "Input Mono Compressed-11.8") + + (when (s-starts-with? "fogskum" system-name) + (setq my-monospaced-font "PragmataPro-13" + my-variable-pitch-font "Pt Sans-13")) + + (defun my-set-fonts () + (interactive) + (when window-system + (condition-case nil + (progn + (set-face-attribute 'default nil :font my-monospaced-font) + ;; (set-face-attribute 'default nil :font my-monospaced-font :width 'ultra-condensed :weight 'normal ) + (set-face-attribute 'fixed-pitch nil :font my-monospaced-font) + (set-face-attribute 'variable-pitch nil :font my-variable-pitch-font)) + (error + (progn + (message + "Setting default fonts failed, running dynamic-fonts-setup...") + (dynamic-fonts-setup)))))) + (add-hook 'after-init-hook 'my-set-fonts t))) + ;; ============================================================================= ;; Themes ;; =============================================================================