I have multiple monitors that are 2k and my main one that is 4k. The font size is set for the 2k ones and for the 4k I wrote this function that I invoke manually with
(defun numkem/set-font-main-screen ()
(set-frame-font "-PfEd-Fantasque Sans Mono-normal-normal-normal-*-27-*-*-*-m-0-iso10646-1"))
When writing a commit message with magit or opening a new frame (through
emacsclient -c) the font size of the frame gets reset.
What did you expect to happen?
The font size should stay the same.
Steps to reproduce
1 - Use the function above within a frame.
2 - Write a commit message or open a new frame with
Loading data dump...
C-h f set-frame-font for documentation. Particularly for the
(set-frame-font FONT &optional KEEP-SIZE FRAMES INHIBIT-CUSTOMIZE)
If FRAMES is nil, apply the font to the selected frame only.
If FRAMES is non-nil, it should be a list of frames to act upon,
or t meaning all existing graphical frames.
Also, if FRAMES is non-nil, alter the user’s Customization settings
as though the font-related attributes of the default face had been
"set in this session", so that the font is applied to future frames.
That said, using
set-frame-font at all (especially with an xlfd font string) is usually not the best option. I recommend setting
doom-font with a floating point
;;; in $DOOMDIR/config.el
(setq doom-font (font-spec :family "Fantasque Sans Mono" :size 27.0))
Then your font setting will scale better between low/hi-dpi displays better. Emacs interprets integers as a pixel size and floats as a point size.
Here are two other alternatives:
doom-big-font-mode (on SPCtb) to “zoom” in text temporarily – great for streaming, for example. See C-hvdoom-big-font to tweak it.
doom/reset-font-size). I hope these are self-explanatory.
Thank you for the reply, using a flot with
doom-font helped quite a bit but now I have the reverse problem of having the smaller screen being too big while the 4k is just right.
Unfortunately it seems like
doom/increase-font-size affects all frames, it it was only for the current frame it would be very helpful and might fix my problem.
Would there be a way to set the font size based on the screen name? I’ve seen
frame-monitors-attributes and adding
set-frame-font to the
window-size-change-functions hook but I got inconsistent results.
What are others doing when using monitors with different sizes?
If you use wayland, you can have different scaling per output. This would scale everything to be a „better“ size on the large screen, not just the Emacs fonts.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.