Last Updated: February 25, 2016
·
2.601K
· coderdude

Change font-size in emacs dynamically based on screen resolution

Put this into your emacs config.

(defun fontify-frame (frame)
  (interactive)
  (if window-system
      (progn
        (if (> (x-display-pixel-width) 2000)
            (set-frame-parameter frame 'font "Inconsolata 19") ;; Cinema Display
         (set-frame-parameter frame 'font "Inconsolata 16")))))

;; Fontify current frame
(fontify-frame nil)

;; Fontify any future frames
(push 'fontify-frame after-make-frame-functions)

I originally published this at http://arnab-deka.com/posts/2012/09/emacs-change-fonts-dynamically-based-on-screen-resolution/.