about summary refs log tree commit diff
path: root/emacs-elisp/config/fonts.el
blob: 7e951af6d04ae3bfe72d7e0620addb1d27cbab68 (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
70
71
72
73
74
;; Set Fonts and their size
(defvar customfontsettings
  '((mono . "Iosevka")
    (variabl . "RobotoCondensed")
    (size . 14)))

(set-face-attribute 'variable-pitch nil
                    :font (cdr (assoc 'variabl customfontsettings))
                    :height (* (cdr (assoc 'size customfontsettings)) 10)
                    :weight 'regular)

(set-face-attribute 'fixed-pitch nil
                    :font (cdr (assoc 'mono customfontsettings))
                    :height (* (cdr (assoc 'size customfontsettings)) 10)
                    :weight 'regular)

(set-face-attribute 'default nil
                    :font (cdr (assoc 'mono customfontsettings))
                    :height (* (cdr (assoc 'size customfontsettings)) 10)
                    :weight 'regular)


(add-to-list 'default-frame-alist
             `(font . ,(concat (cdr (assoc 'mono customfontsettings)) "-" (number-to-string (cdr (assoc 'size customfontsettings))))))

(set-face-attribute 'font-lock-comment-face nil
                    :slant 'italic)

(set-face-attribute 'font-lock-keyword-face nil
                    :slant 'italic)

;; Set mode-line font
(set-face-attribute 'mode-line nil :inherit 'variable-pitch)
(set-face-attribute 'mode-line-inactive nil :inherit 'variable-pitch)

;; Set Usable Ligatures
(dolist (char/ligature-re
     `((?-  . ,(rx (or (or "-->" "-<<" "->>" "-|" "-~" "-<" "->") (+ "-"))))
       (?/  . ,(rx (or (or "/==" "/=" "/>" "/**" "/*") (+ "/"))))
       (?*  . ,(rx (or (or "*>" "*/") (+ "*"))))
       (?<  . ,(rx (or (or "<<=" "<<-" "<|||" "<==>" "<!--" "<=>" "<||" "<|>" "<-<"
	 "<==" "<=<" "<-|" "<~>" "<=|" "<~~" "<$>" "<+>" "</>"
	 "<*>" "<->" "<=" "<|" "<:" "<>"  "<$" "<-" "<~" "<+"
	 "</" "<*")
	   (+ "<"))))
       (?:  . ,(rx (or (or ":?>" "::=" ":>" ":<" ":?" ":=") (+ ":"))))
       (?=  . ,(rx (or (or "=>>" "==>" "=/=" "=!=" "=>" "=:=") (+ "="))))
       (?!  . ,(rx (or (or "!==" "!=") (+ "!"))))
       (?>  . ,(rx (or (or ">>-" ">>=" ">=>" ">]" ">:" ">-" ">=") (+ ">"))))
       (?&  . ,(rx (+ "&")))
       (?|  . ,(rx (or (or "|->" "|||>" "||>" "|=>" "||-" "||=" "|-" "|>"
	 "|]" "|}" "|=")
	   (+ "|"))))
       (?.  . ,(rx (or (or ".?" ".=" ".-" "..<") (+ "."))))
       (?+  . ,(rx (or "+>" (+ "+"))))
       (?\[ . ,(rx (or "[<" "[|")))
       (?\{ . ,(rx "{|"))
       (?\? . ,(rx (or (or "?." "?=" "?:") (+ "?"))))
       (?#  . ,(rx (or (or "#_(" "#[" "#{" "#=" "#!" "#:" "#_" "#?" "#(")
	   (+ "#"))))
       (?\; . ,(rx (+ ";")))
       (?_  . ,(rx (or "_|_" "__")))
       (?~  . ,(rx (or "~~>" "~~" "~>" "~-" "~@")))
       (?$  . ,(rx "$>"))
       (?^  . ,(rx "^="))
       (?\] . ,(rx "]#"))))
    (let ((char (car char/ligature-re))
    (ligature-re (cdr char/ligature-re)))
(set-char-table-range composition-function-table char
	  `([,ligature-re 0 font-shape-gstring]))))

;; Font Zooming
(global-set-key (kbd "C-=") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)