Skip to content

Commit

Permalink
Fix fonts creating a startup bug if the chosen font is absent
Browse files Browse the repository at this point in the history
Monospaced and variable fonts are now custom variables (default to Fira Code and Iosevka)
  • Loading branch information
mattiasdrp committed Sep 19, 2024
1 parent 9347b58 commit e0c34a1
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
29 changes: 24 additions & 5 deletions custom.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
'(package-selected-packages nil)
'(pokemacs-repeat-timeout 0.5)
'(pokemacs-theme 'doom-solarized-dark)
'(pokemacs-mono-font "Fira Code")
'(pokemacs-variable-font "Iosevka Aile")
'(pokemacs/english-dict "GB")
'(pokemacs/french-dict "FR")
'(safe-local-variable-values
Expand Down Expand Up @@ -84,6 +86,23 @@
'(use-visual-fill t)
'(use-web t)
'(use-window-purpose nil)
'(tuple-mono-font
(cond
((x-list-fonts pokemacs-mono-font) `(:font ,pokemacs-mono-font))
((x-list-fonts "Fira Code") '(:font "Fira Code"))
((x-list-fonts "Inconsolata") '(:font "Inconsolata"))
((x-family-fonts "DejaVu") '(:family "DejaVu"))
(nil (warn "Cannot find a monospaced font."))) t)
'(tuple-variable-font
(cond
((x-list-fonts pokemacs-variable-font) `(:font ,pokemacs-variable-font))
((x-list-fonts "Iosevka Aile") '(:font "Iosevka Aile"))
((x-list-fonts "ETBembo") '(:font "ETBembo"))
((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
((x-list-fonts "Lucida Grande") '(:font "Lucida Grande"))
((x-list-fonts "Verdana") '(:font "Verdana"))
((x-family-fonts "Sans Serif") '(:family "Sans Serif"))
(nil (warn "Cannot find a Sans Serif Font."))) t)
'(warning-suppress-types '((comp)))
'(x-stretch-cursor nil))

Expand All @@ -92,13 +111,13 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:family "Fira Code" :slant normal :weight normal :height 118 :width normal :foundry "CTDB"))))
'(fixed-pitch ((t (:family "Fira Code" :slant normal :weight normal :height 118 :width normal :foundry "CTDB"))))
'(variable-pitch ((t (:font "Iosevka Aile" :weight light :height 1.3))))
'(lsp-lens-face ((t (:family "Fira Code" :foundry "CTDB" :inherit lsp-details-face))))
`(default ((t (,@tuple-mono-font :slant normal :weight normal :height 118 :width normal :foundry "CTDB"))))
`(fixed-pitch ((t (,@tuple-mono-font :slant normal :weight normal :height 118 :width normal :foundry "CTDB"))))
`(variable-pitch ((t (,@tuple-variable-font :weight light :height 1.3))))
`(lsp-lens-face ((t (,@tuple-mono-font :foundry "CTDB" :inherit lsp-details-face))))
'(menu ((t (:inherit mode-line))))
'(mode-line ((t :inherit fixed-pitch)))
'(mode-line-inactive ((nil :family "Fira Code")))
`(mode-line-inactive ((nil ,@tuple-mono-font)))
'(org-document-title ((t (:inherit variable-pitch :height 1.4 :weight bold :foreground "#c678dd"))))
'(org-level-1 ((t (:inherit variable-pitch :height 1.7 :weight bold :foreground "#51afef"))))
'(org-level-2 ((t (:inherit variable-pitch :height 1.4 :weight bold :foreground "#c678dd"))))
Expand Down
12 changes: 12 additions & 0 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ Similar to Vim's separation of command/insert modes"
:group 'pokemacs
:tag "Appearance")

(defcustom pokemacs-mono-font "Fira Code"
"Mono font."
:group 'pokemacs-appearance
:type 'string
:tag " Font")

(defcustom pokemacs-variable-font "Iosevka Aile"
"Font for variable pitch."
:group 'pokemacs-appearance
:type 'string
:tag " Font")

(defcustom pokemacs-theme 'doom-solarized-dark
"Theme to load."
:group 'pokemacs-appearance
Expand Down
12 changes: 12 additions & 0 deletions init.org
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,18 @@ This is a list of custom variables that allow to enable/disable features. If you
:group 'pokemacs
:tag "Appearance")

(defcustom pokemacs-mono-font "Fira Code"
"Mono font."
:group 'pokemacs-appearance
:type 'string
:tag " Font")

(defcustom pokemacs-variable-font "Iosevka Aile"
"Font for variable pitch."
:group 'pokemacs-appearance
:type 'string
:tag " Font")

(defcustom pokemacs-theme 'doom-solarized-dark
"Theme to load."
:group 'pokemacs-appearance
Expand Down

0 comments on commit e0c34a1

Please sign in to comment.