【发布时间】:2016-01-09 12:48:15
【问题描述】:
我想使用SourceCodePro 作为我的默认字体,但它不包括在#x0600 范围内的波斯字符,直到#x06FF。
我试过这样的东西
(set-fontset-font t
'ascii
"Source Code Pro-12")
(set-fontset-font t
(cons (decode-char 'ucs #x0600)
(decode-char 'ucs #x6FF))
"Roya-13")
但它没有奏效。
我也尝试像这样使用fontset-standard 和fontset-default
(set-face-font 'default "fontset-default")
(set-fontset-font "fontset-default"
'emacs (font-spec :name "Source Code Pro"))
(set-fontset-font "fontset-default"
'iso-8859-1 (font-spec :name "Source Code Pro"))
(set-face-attribute 'font-lock-comment-face nil
:family "Inconsolata" :height 140)
(set-fontset-font "fontset-default"
'(#x0600 . #x06FF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#x0750 . #x075F) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#x08A0 . #x08FF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#xFB50 . #xFDFF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#xFD70 . #xFEFF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#x1EE00 . #x1EEFF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
这也没有用。
更新: 感谢@legoscia 的指导,使用 `after-make-frame-functions' 使它对我有用
(defun zzgraph/fix-fontset (&optional frame)
(set-fontset-font "fontset-default" 'arabic "Roya"))
(add-hook 'after-make-frame-functions 'zzgraph/fix-fontset)
【问题讨论】:
-
@legoscia 谢谢!第二个工作正常。所以我们在制作新帧时总是要调用钩子!这很奇怪,它不适用于拉丁文字,因为我在函数之外使用
(add-to-list 'default-frame-alist '(font . "Source Code Pro"))来更改拉丁字符的默认面 -
@legoscia 你能给你的评论一个答案吗?还有你知道为什么需要使用
after-make-frame-functions吗?是否与在守护程序模式下运行 Emacs 有关? -
来吧,自己写一个答案!我使用了两种不同的方法,所以放一个对你有用的方法。回答您自己的问题is encouraged。至于
after-make-frame-functions,我没用过这个守护进程,但还是需要它,所以和那个无关。
标签: emacs fonts persian emacs-faces farsi