From d0605b049853320c94b1558f2e723f81978a1ad1 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 9 May 2025 00:02:45 +0100 Subject: Reset-font-size on theme load rather than setting it in theme --- Emacs/.config/emacs/config.org | 23 ++++++++++++++++++++++ .../emacs/elisp/personal-solarized-theme.el | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 4f36ac0..34b593b 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -248,6 +248,29 @@ never used before, 3 seems to be a reasonable default. ("ravenmaiden" 6) (_ 3)))) #+end_src +** Reset font size +Font size is best left unfixed: depending on the display size and the +machine, I will usually need to adjust it so it looks just right. +This function sets the font size using both those variables. It is +also added to `enable-theme-functions` such that loading a theme will +forcefully adjust the font size. + +#+begin_src emacs-lisp +(defun +oreo/font-reset (&optional theme) + (let ((font-size (thread-first + (pcase (system-name) + ("rhmaiden" 140) + (_ 120)) + (* + (pcase (display-pixel-width) + ((pred (>= 1920)) 0.90) + ((pred (>= 2560)) 1.24))) + floor))) + (set-face-attribute 'default nil :height font-size) + (set-face-attribute 'mode-line nil :height font-size))) + +(add-to-list 'enable-theme-functions #'+oreo/font-reset) +#+end_src * Essential packages External and internal packages absolutely necessary for the rest of this configuration. diff --git a/Emacs/.config/emacs/elisp/personal-solarized-theme.el b/Emacs/.config/emacs/elisp/personal-solarized-theme.el index 780af03..d0b4cd9 100644 --- a/Emacs/.config/emacs/elisp/personal-solarized-theme.el +++ b/Emacs/.config/emacs/elisp/personal-solarized-theme.el @@ -81,7 +81,7 @@ '(match ((t (:background "RoyalBlue3")))) '(minibuffer-prompt ((t (:foreground "cyan")))) `(mode-line ((t (:box (:line-width 1 :color "white") :foreground "LightSkyBlue" - :background "black" :inherit (default) :height 120)))) + :background "black" :inherit (default))))) '(mode-line-buffer-id ((t (:weight bold)))) '(mode-line-emphasis ((t (:weight bold)))) '(mode-line-inactive ((t (:box (:line-width 1 :color "grey10") :weight light -- cgit v1.2.3-13-gbd6f