gpt4 book ai didi

emacs - 如何在 emacs 中管理字体?

转载 作者:行者123 更新时间:2023-12-01 22:33:29 29 4
gpt4 key购买 nike

是否有用于管理 emacs 中的字体设置的任何标准技术、程序包等?

我想在某处定义一次默认的固定和可变宽度字体,并使用这些默认值在模式中设置面部字体。例如,将 org-mode 的默认字体设置为可变宽度默认值,并将其代码面设置为固定固定宽度默认值。

最佳答案

这是我所拥有的系统的改编版。我已经默认使用固定间距,但这些调用将允许您使用模式 Hook 定义用于模式的字体。

我将方法称为“toggle-pitch”,以便在必要时在固定和可变间距字体之间即时切换。

(set-face-font 'default "Source Code Pro Semibold-9")
(set-face-font 'variable-pitch "Segoe UI Semibold-9")
(copy-face 'default 'fixed-pitch)

;;============================================================
;; toggle between variable pitch and fixed pitch font for
;; the current buffer
(defun fixed-pitch-mode ()
(buffer-face-mode -1))

(defun variable-pitch-mode ()
(buffer-face-mode t))

(defun toggle-pitch (&optional arg)
"Switch between the `fixed-pitch' face and the `variable-pitch' face"
(interactive)
(buffer-face-toggle 'variable-pitch))

;; enable buffer-face mode to provide buffer-local fonts
(buffer-face-mode)

;; Set the fonts to format correctly
;(add-hook 'text-mode-hook 'fixed-pitch-mode)
;(add-hook 'dired-mode-hook 'fixed-pitch-mode)
;(add-hook 'calendar-mode-hook 'fixed-pitch-mode)
;(add-hook 'org-agenda-mode-hook 'fixed-pitch-mode)
;(add-hook 'shell-mode-hook 'fixed-pitch-mode)
;(add-hook 'eshell-mode-hook 'fixed-pitch-mode)
;(add-hook 'bs-mode-hook 'fixed-pitch-mode)
;(add-hook 'w3m-mode-hook 'variable-pitch-mode)
;(add-hook 'org-mode-hook 'variable-pitch-mode)
(add-hook 'eww-mode-hook 'variable-pitch-mode)

关于emacs - 如何在 emacs 中管理字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28428382/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com