How to set the font size in Emacs?

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

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

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

    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)
    
    0 讨论(0)
  • 2020-11-28 17:50

    From Emacswiki, GNU Emacs 23 has a built-in key combination:

    C-xC-+ and C-xC-- to increase or decrease the buffer text size

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

    I've got the following in my .emacs:

    (defun fontify-frame (frame)
      (set-frame-parameter frame 'font "Monospace-11"))
    
    ;; Fontify current frame
    (fontify-frame nil)
    ;; Fontify any future frames
    (push 'fontify-frame after-make-frame-functions) 
    

    You can subsitute any font of your choosing for "Monospace-11". The set of available options is highly system-dependent. Using M-x set-default-font and looking at the tab-completions will give you some ideas. On my system, with Emacs 23 and anti-aliasing enabled, can choose system fonts by name, e.g., Monospace, Sans Serif, etc.

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

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

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

    This is another simple solution. Works in 24 as well

    (set-default-font "Monaco 14")
    

    Short cuts:

    `C-+` increases font size
    `C--` Decreases font size
    
    0 讨论(0)
  • 2020-11-28 17:57
    (set-face-attribute 'default nil :height 100)
    

    The value is in 1/10pt, so 100 will give you 10pt, etc.

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