How to set the font size in Emacs?

2020-01-24 18:33发布

I also want to save the font size in my .emacs file.

17条回答
劫难
2楼-- · 2020-01-24 18:57

Open emacs in X11, goto menu Options, select "set default font ...", change the font size. Select "save options" in the same menu. Done.

查看更多
仙女界的扛把子
3楼-- · 2020-01-24 18:58

Here's an option for resizing the font heights interactively, one point at a time:

;; font sizes
(global-set-key (kbd "s-=")
                (lambda ()
                  (interactive)
                  (let ((old-face-attribute (face-attribute 'default :height)))
                    (set-face-attribute 'default nil :height (+ old-face-attribute 10)))))

(global-set-key (kbd "s--")
                (lambda ()
                  (interactive)
                  (let ((old-face-attribute (face-attribute 'default :height)))
                    (set-face-attribute 'default nil :height (- old-face-attribute 10)))))

This is preferable when you want to resize text in all buffers. I don't like solutions using text-scale-increase and text-scale-decrease as line numbers in the gutter can get cut off afterwards.

查看更多
我想做一个坏孩纸
4楼-- · 2020-01-24 19:00

Press Shift and the first mouse button. You can change the font size in the following way: This website has more detail.

查看更多
祖国的老花朵
5楼-- · 2020-01-24 19:00

zoom.cfg and global-zoom.cfg provide font size change bindings (from EmacsWiki)

  • C-- or C-mousewheel-up: increases font size.
  • C-+ or C-mousewheel-down: decreases font size.
  • C-0 reverts font size to default.
查看更多
Deceive 欺骗
6楼-- · 2020-01-24 19:00

Firefox and other programs allow you to increase and decrease the font size with C-+ and C--. I set up my .emacs so that I have that same ability by adding these lines of code:

(global-set-key [C-kp-add] 'text-scale-increase)

(global-set-key [C-kp-subtract] 'text-scale-decrease)
查看更多
别忘想泡老子
7楼-- · 2020-01-24 19:00

It all depends what you mean by change the font size. This EmacsWiki section provides the best and most complete information. It distinguishes the various cases (text scaling, frame font, buffer/frame, etc.): Changing Font Size.

查看更多
登录 后发表回答