我还想在.emacs文件中保存字体大小。


当前回答

下面是一个代码片段,可以让你直接使用交互函数指定全局字体大小:

(defun set-font-size ()
    "Set the font size."
  (interactive)
  (set-face-attribute
   'default nil :height
   (string-to-number
    (read-string "Font size: " (number-to-string (face-attribute 'default :height nil))))))

其他回答

在NTEmacs 23.1中,选项菜单有一个“设置默认字体…”选项。

这完全取决于你所说的改变字体大小。 EmacsWiki部分提供了最好和最完整的信息。它区分了各种情况(文本缩放,框架字体,缓冲区/框架等):改变字体大小。

这里有一个交互调整字体高度的选项,一次一点:

;; 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)))))

当您想要调整所有缓冲区中的文本大小时,这是可取的。我不喜欢使用文本比例增加和文本比例减少的解决方案,因为排水沟中的行号之后会被切断。

这是另一个简单的解决方案。《24小时》也适用

(set-default-font "Monaco 14")

捷径:

`C-+` increases font size
`C--` Decreases font size

下面是一个代码片段,可以让你直接使用交互函数指定全局字体大小:

(defun set-font-size ()
    "Set the font size."
  (interactive)
  (set-face-attribute
   'default nil :height
   (string-to-number
    (read-string "Font size: " (number-to-string (face-attribute 'default :height nil))))))