commit e0f6992572a3ca5b692e629c10b415293a244f15 parent cb13de29f978e60275630fa0b1e055a695ea28ac Author: Vincent Demeester <vincent@sbr.pm> Date: Fri, 17 Nov 2023 16:23:56 +0100 tools/emacs: configure fonts using fontaine Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/config/config-appearance.el | | | 54 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 54 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/config/config-appearance.el b/tools/emacs/config/config-appearance.el @@ -32,6 +32,60 @@ (set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append) (set-fontset-font t 'symbol "Symbola" nil 'append))) +(use-package fontaine + :if window-system + :bind (("C-c f s" . fontaine-set-preset) + ("C-c f S" . fontaine-set-face-font)) + :init + (setq fontaine-presets + '((small + :default-family "UbuntuMono Nerd Font" + :default-height 110 + :variable-pitch-family "Ubuntu Nerd Font") + (regular) ; like this it uses all the fallback values and is named `regular' + (medium + :default-weight semilight + :default-height 130 + :bold-weight extrabold) + (large + :inherit medium + :default-height 140) + (presentation + :inherit medium + :default-weight light + :default-height 180) + (t + ;; I keep all properties for didactic purposes, but most can be + ;; omitted. See the fontaine manual for the technicalities: + ;; <https://protesilaos.com/emacs/fontaine>. + :default-family "UbuntuMono Nerd Font" + :default-weight regular + :default-height 130 + :fixed-pitch-family nil ; falls back to :default-family + :fixed-pitch-weight nil ; falls back to :default-weight + :fixed-pitch-height 1.0 + :fixed-pitch-serif-family nil ; falls back to :default-family + :fixed-pitch-serif-weight nil ; falls back to :default-weight + :fixed-pitch-serif-height 1.0 + :variable-pitch-family "Ubuntu Nerd Font" + :variable-pitch-weight nil + :variable-pitch-height 1.0 + :bold-family nil ; use whatever the underlying face has + :bold-weight bold + :italic-family nil + :italic-slant italic + :line-spacing nil))) + + ;; Set last preset or fall back to desired style from `fontaine-presets'. + (fontaine-set-preset (or (fontaine-restore-latest-preset) 'regular)) + + ;; The other side of `fontaine-restore-latest-preset'. + (add-hook 'kill-emacs-hook #'fontaine-store-latest-preset) + + ;; Persist font configurations while switching themes. The + ;; `enable-theme-functions' is from Emacs 29. + (add-hook 'enable-theme-functions #'fontaine-apply-current-preset)) + (use-package emacs :config (setq-default use-file-dialog nil