Now this function is becoming more my own

This commit is contained in:
Benson Chu 2024-07-09 13:07:04 -05:00
parent cf5e1e70f2
commit bf098fbdda

View file

@ -28,7 +28,7 @@
(make-hash-table)) (make-hash-table))
;; Font size adjustment ;; 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. "Inspired by https://emacs.stackexchange.com/a/44930/17066. FRAME is ignored.
If I let Windows handle DPI everything looks blurry." If I let Windows handle DPI everything looks blurry."
(interactive) (interactive)
@ -55,6 +55,20 @@
;; (puthash frame size frame-font-size-cache)) ;; (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) ;; (remove-hook 'window-size-change-functions #'hoagie-adjust-font-size)
(provide 'hoagie-adjust) (provide 'hoagie-adjust)