summary refs log tree commit diff stats
path: root/machines/bob.el
blob: a408e5c4edcbd4ccb72ead6f7d33c1b64475d807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; bob.el --- Customizations for "bob" -*- lexical-binding: t; -*-

;;; Commentary:

;;; Code:

(require 'acdw)
(require 'machine)

(defcustom +bob-face-plist
  '( :dejavu ("DejaVu Sans Mono" "DejaVu Sans")
     :iosevka ("Iosevka Comfy Wide" "Iosevka Comfy Duo")
     :plex ("IBM Plex Mono" "IBM Plex Serif")
     :go/djv ("Go Mono" "DejaVu Sans")
     :tt (("TT2020Base" 120) "TT2020 Base Style E") ; no italic
     :courier ("Courier Prime Code" "Courier Prime")
     :gaegu (("Gaegu" 140) "Gaegu")     ; no italic
     :comic (("Comic Code" 100) "Comic Code")
     :comic/fantasque (("Comic Code" 100) "Fantasque Sans Mono")
     :terminus (("Terminus (TTF)" 120) "Terminus (TTF)")
     :cmu (("CMU Typewriter Text" 160) "CMU Concrete")
     :apl (("APL386 Unicode" 120) "Comic Code")
     )
  "A plist of possible font combinations.")

(defcustom +bob-face-pair :comic ;; (+bob-set-faces)
  "The index of `+bob-face-pairs' to use.")

(defun +bob-set-faces (&rest _)
  (let* ((face-pair (plist-get +bob-face-plist +bob-face-pair))
         (base-face (if (stringp (car face-pair))
                        (car face-pair)
                      (caar face-pair)))
         (var-face (if (stringp (cadr face-pair))
                       (cadr face-pair)
                     (caadr face-pair)))
         (base-size (or (ignore-errors (cadar face-pair))
                        100))
         (var-size (or (ignore-errors (cadadr face-pair))
                       1.0))
         (italic-face nil)
         ;; (bold-face nil)
         (mono-face nil))
    (+set-faces
     `((default
         :family ,base-face
         :height ,base-size
         :weight regular)
       (bold :family ,(or (bound-and-true-p bold-face) base-face)
             :weight extra-bold)
       (italic :family ,(or (bound-and-true-p italic-face) base-face)
               :weight normal
               :slant italic)
       (fixed-pitch :family ,(or (bound-and-true-p mono-face) base-face)
                    :height 1.0)
       (variable-pitch
        :family ,(or var-face base-face)
        :height ,var-size
        ;; :weight medium
        )
       ;; (org-italic
       ;;  :family ,(or var-face base-face)
       ;;  :slant italic)
       ))))

;; Other ideas: [[https://twitter.com/NPRougier/status/1488570192561160195][from Nic Rougier]]
(add-hook 'machine-after-load-theme-hook #'+bob-set-faces)

;; bob.el ends here (+bob-set-faces)