Change face-setting logic

This commit is contained in:
Case Duckworth 2022-01-31 00:53:30 -06:00
parent 6807db4e4a
commit e8589cec6c
3 changed files with 14 additions and 15 deletions

View File

@ -76,19 +76,6 @@ See `no-littering' for examples.")
;;; Fonts
(+with-ensure-after-init
(unless noninteractive ;; Set default faces
(+with-message "Setting default faces"
(let ((font-name machine-default-font)
(font-size machine-default-height)
(variable-font-name machine-variable-pitch-font)
(variable-font-size machine-variable-pitch-height))
(set-face-attribute 'default nil :family font-name
:height font-size :weight 'book)
(set-face-attribute 'italic nil :family font-name
:height font-size :slant 'italic)
(set-face-attribute 'variable-pitch nil :family variable-font-name
:height variable-font-size))))
;; Emoji fonts
(+with-message "Adding emoji fonts"
(let ((ffl (font-family-list)))

View File

@ -259,5 +259,13 @@ Use like `setq'."
into ret
finally return ret)))
(defun +set-faces (specs)
"Set fonts to SPECS.
Specs is an alist: its cars are faces and its cdrs are the plist
passed to `set-face-attribute'. Note that the FRAME argument is
always nil; this function is mostly intended for use in init."
(dolist (spec specs)
(apply #'set-face-attribute (car spec) nil (cdr spec))))
(provide 'acdw)
;;; acdw.el ends here

View File

@ -4,7 +4,11 @@
;;; Code:
(setq machine-default-font "DejaVu Sans Mono"
machine-default-height 105)
(require 'acdw)
(+set-faces `((default :family "CMU Typewriter Text"
:height 120)
(variable-pitch :family "CMU Typewriter Text Variable Width"
:height 1.1)))
;;; bob.el ends here