有办法只改变org-mode的字体吗

想单独设置org-mode的字体,这样写文档看文档的时候舒服些。但是又不像修改别的mode的字体。 各位大大求告知拉。

设置emacs默认的字体,主要是为代码服务(等宽):

(set-face-attribute 'default nil :font "PragmataPro Mono 18")
;; (set-face-attribute 'default nil :font "Victor Mono 18")
;; (set-face-attribute 'default nil :font "Dank Mono 18")
;; (set-face-attribute 'default nil :font "Operator Mono Lig 18")
;; (set-face-attribute 'default nil :font "Envy Code R 18")
;; (set-face-attribute 'default nil :font "Sarasa Mono SC Nerd 18")
;; (set-face-attribute 'default nil :font "MonoLisa 18")
;; (set-face-attribute 'default nil :font "Gintronic 18")

独立设置中文用的字体(方正兰亭黑体——字好看,名字帅):

(set-fontset-font t 'han "FZLanTingHeiS-R-GB")
(setq face-font-rescale-alist '(("FZLanTingHeiS-R-GB" . 1.0)))

为org-mode、latex等设置字体(适合学术写作的字体,跟new time roman类似):

(add-hook 'text-mode-hook
      (lambda ()
	(setq buffer-face-mode-face '(:family "Georgia Pro"))
	(buffer-face-mode)))

这些都是我精选的字体,可以到网上购买来试试(在国内的字库网站,例如字客网或酷字网,花几十块都能全买到)。

(custom-set-faces
 '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 3.0))))
 '(org-block-begin-line ((t (:extend t :background "#f7e0c3" :foreground "gray"
                             :weight semi-bold :height 151 :family "CMU Typewriter Text"))))
 '(org-code ((t (:foreground "#957f5f" :family "mononoki"))))
 '(org-document-title ((t (:foreground "midnight blue" :weight bold :height 2.0))))
 '(org-hide ((t (:foreground "#E5E9F0" :height 0.1))))

 '(org-list-dt ((t (:foreground "#7382a0"))))
 ;;'(org-verbatim ((t (:foreground "#81895d" :family "Latin Modern Mono"))))
 '(org-indent ((t (:inherit (org-hide fixed-pitch)))))
 '(org-block ((t (:inherit fixed-pitch))))
 '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))
 ;; TODO set the color following this
 ;;'(org-block ((t (:extend t :background "#f7e0c3" :foreground "#5b5143" :family "Latin Modern Mono"))))
 ;;'(org-code ((t (:inherit (shadow fixed-pitch)))))
 '(variable-pitch ((t (:family "DejaVu Serif" :height 150))))
 '(fixed-pitch ((t (:family "mononoki" :height 160))))
 ;;'(org-level-8 ((t (,@headline ,@variable-tuple))))
 ;;'(org-level-7 ((t (,@headline ,@variable-tuple))))
 ;;'(org-level-6 ((t (,@headline ,@variable-tuple))))
 '(org-level-5 ((t (:inherit outline-5 :height 1.05 :family "DejaVu Serif Condensed"))))
 '(org-level-4 ((t (:inherit outline-4 :height 1.1 :family "CMU Typewriter Text"))))
 '(org-level-3 ((t (:inherit outline-3 :height 1.25 :family "DejaVu Serif Condensed"))))
 '(org-level-2 ((t (:inherit outline-2 :foreground "#EEC591" :height 1.5 :family
                    "DejaVu Serif Condensed"))))
 '(org-level-1 ((t (:inherit outline-1 :foreground "#076678" :weight extra-bold
                    :height 1.75 :family "Alegreya"))))

 '(org-document-title ((t (,@headline ,@variable-tuple :height 2.0 :underline nil)))))

效果是这样的:

4 个赞

PragmataPro 是几十块钱能买到的吗? 看看这里 https://github.com/Helw150/dot-files/tree/master/fonts

1 个赞

这类网站一般都是资源共享、没有版权的,pragmatapro 一个字体就19欧了。

我刚开始在方正字库官网买过英文大厂的字体,如果注册为设计师还能免费下载。我以为这些字库也是合作有版权的,竟然是盗版网站……还花了一百多买了不少字体 :cold_sweat: