Son of the Wai-Pan
Son of the Wai-Pan

Reputation: 13191

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

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). How do I tell Emacs to select a specific face to display Chinese characters? All characters that are ASCII are displayed in Inconsolata.

I looked at EmacsWiki:FontSets and added this to my .emacs file:

(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.

Upvotes: 1

Views: 420

Answers (1)

JSON
JSON

Reputation: 4606

Try "fontset-default" rather than "fontset-standard", as fontset-default will be the fallback for all fontsets that do not specify something more specific.

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.

Upvotes: 1

Related Questions