How to set the font size in Emacs?

前端 未结 17 1538
囚心锁ツ
囚心锁ツ 2020-11-28 17:43

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

相关标签:
17条回答
  • 2020-11-28 17:57

    In AquaMacs CMD + and CMD - adjust the font size for the current buffer.

    0 讨论(0)
  • 2020-11-28 17:58

    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.

    0 讨论(0)
  • 2020-11-28 17:58

    I you're happy with console emacs (emacs -nw), modern vterm implementations (like gnome-terminal) tend to have better font support. Plus if you get used to that, you can then use tmux, and so working with your full environment on remote servers becomes possible, even without X.

    0 讨论(0)
  • 2020-11-28 17:59

    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.
    0 讨论(0)
  • 2020-11-28 18:00

    M-x customize-face RET default will allow you to set the face default face, on which all other faces base on. There you can set the font-size.

    Here is what is in my .emacs. actually, color-theme will set the basics, then my custom face setting will override some stuff. the custom-set-faces is written by emacs's customize-face mechanism:

    ;; my colour theme is whateveryouwant :)
    (require 'color-theme)
    (color-theme-initialize)
    (color-theme-whateveryouwant)
    
    (custom-set-faces
      ;; custom-set-faces was added by Custom.
      ;; If you edit it by hand, you could mess it up, so be careful.
      ;; Your init file should contain only one such instance.
      ;; If there is more than one, they won't work right.
     '(default ((t (:stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
     '(font-lock-comment-face ((t (:foreground "darkorange4"))))
     '(font-lock-function-name-face ((t (:foreground "navy"))))
     '(font-lock-keyword-face ((t (:foreground "red4"))))
     '(font-lock-type-face ((t (:foreground "black"))))
     '(linum ((t (:inherit shadow :background "gray95"))))
     '(mode-line ((t (nil nil nil nil :background "grey90" (:line-width -1 :color nil :style released-button) "black" :box nil :width condensed :foundry "unknown" :family "DejaVu Sans Mono")))))
    
    0 讨论(0)
  • 2020-11-28 18:00

    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.

    0 讨论(0)
提交回复
热议问题