简体   繁体   English

如何在Emacs中为一组特定的Unicode代码点选择要显示的特定字体?

[英]How do I select a specific font for display for a particular set of Unicode codepoints in Emacs?

I am using: GNU Emacs 24.3.50.1 (i386-apple-darwin11.4.2, NS apple-appkit-1138.51) of 2013-05-27 on Celestra.local 我正在使用: GNU Emacs 24.3.50.1 (i386-apple-darwin11.4.2, NS apple-appkit-1138.51) of 2013-05-27 on Celestra.local

I can get Chinese characters to display, but they use a 'Song' font, the typeface of which is difficult to read (it's analogous to a serif-font). 我可以显示中文字符,但它们使用的是'Song'字体,该字体的字体难以阅读(类似于衬线字体)。 How do I tell Emacs to select a specific face to display Chinese characters? 如何告诉Emacs选择一个特定的面孔来显示汉字? All characters that are ASCII are displayed in Inconsolata. 所有的ASCII字符都显示在Inconsolata中。

I looked at EmacsWiki:FontSets and added this to my .emacs file: 我查看了EmacsWiki:FontSets并将其添加到我的.emacs文件中:

(set-fontset-font "fontset-standard"
                  (cons (decode-char 'ucs #x4E00)
                        (decode-char 'ucs #x9FFF))
                  "-*-SimHei-*-*-*-*-14-*-*-*-*-*-iso10646-1")

but my Chinese characters are stilled displayed in the default fallback font. 但是我的汉字仍然以默认的后备字体显示。

Try "fontset-default" rather than "fontset-standard", as fontset-default will be the fallback for all fontsets that do not specify something more specific. 尝试使用“ fontset-default”而不是“ fontset-standard”,因为fontset-default将是所有未指定更具体内容的字体集的后备。

I would also use script names rather than a character range, but either will work: 我也将使用脚本名称而不是字符范围,但是两者都可以工作:

(set-fontset-font "fontset-default" 'han "SimHei-14")

You may need to add other scripts such as 'cjk-misc for full coverage. 您可能需要添加其他脚本(例如'cjk-misc以进行全面介绍。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM