From bf098fbddafb5412a1ccff554ed523ff2f2e406f Mon Sep 17 00:00:00 2001 From: Benson Chu Date: Tue, 9 Jul 2024 13:07:04 -0500 Subject: [PATCH] Now this function is becoming more my own --- lisp/hoagie-adjust.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/hoagie-adjust.el b/lisp/hoagie-adjust.el index 7c41724..bdffbe5 100644 --- a/lisp/hoagie-adjust.el +++ b/lisp/hoagie-adjust.el @@ -28,7 +28,7 @@ (make-hash-table)) ;; Font size adjustment -(defun hoagie-adjust-font-size (&optional frame) +(defun my/dynamically-adjust-font-size (&optional frame) "Inspired by https://emacs.stackexchange.com/a/44930/17066. FRAME is ignored. If I let Windows handle DPI everything looks blurry." (interactive) @@ -55,6 +55,20 @@ ;; (puthash frame size frame-font-size-cache)) )) +(defun my/adjust-font-size (&optional arg) + (interactive "P") + (if (not arg) + (my/dynamically-adjust-font-size) + (let ((font-height (read-number "Font Height (%)? ")) + (f (selected-frame))) + (set-face-attribute 'default f :height font-height) + (set-face-attribute 'mode-line f :height font-height) + (setq-default olivetti-body-width + (if (and (> font-height 120) + (boundp 'olivetti-body-width)) + 80 + 140))))) + ;; (remove-hook 'window-size-change-functions #'hoagie-adjust-font-size) (provide 'hoagie-adjust)