I have two displays and different frames on each. Each display has very different DPI so I need different fonts sizes for them.

How can I set different fonts sizes for different frames (font size changes not applied globally)?

  • Emacs faces measure the size of the font in "points" rather than pixels, so presumably it should already take DPI into account. IOW, please M-x report-emacs-bug. – Stefan Oct 18 '16 at 13:24

You could also change font like so :- (set-frame-font "PragmataPro 13"), where the 2nd argument is the size you want to use.

EDIT: if you are running emacsclient by connecting to an emacs daemon process, the above answer will not work. Instead put this in your init.el: (setq default-frame-alist '((font . "PragmataPro-13")))

  • 1
    Yes. Or (modify-frame-parameters nil (list (cons 'font YOUR-CHOSEN-FONT))). – Drew Oct 18 '16 at 14:19

I figured out the second parameter of set-face-attribute correspond to what frame you want the face-attribute to change so:

;; on my retina display (2880x1800)
(set-face-attribute 'default (selected-frame) :font "Source Code Pro" :height 140 :weight 'medium)

;; on my 4k external display (3840 x 2160)
(set-face-attribute 'default (selected-frame) :font "Source Code Pro" :height 210 :weight 'medium)

In this case I'm only changing the font :height. Anyway, I'm setting this as valid answer because it is the one I will be using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.