I'm editing a text file containing Japanese kanji characters. 単 does not show up in Emacs, how to fix? It shows up as some sort of white space.
Update:
I'm using GNU Emacs 24.3 (9) for Mac.
After examining my .emacs
, I actually copied from someone else's configuration and has
(create-fontset-from-fontset-spec
"-unknown-Source Code Pro-normal-normal-normal-*-16-*-*-*-m-0-fontset-myfontset")
(set-fontset-font "fontset-myfontset" 'han "XinGothic CiticPress")
(set-fontset-font "fontset-myfontset" 'kana "HanaMinPlus")
(add-to-list 'default-frame-alist '(font . "fontset-myfontset"))
but I don't quite understand what it does. Apparently it doesn't work for some Kanji characters.
Update 2
I've confirmed font HanaMinPlus
can display that character correctly by evaluating (set-frame-font "HanMinPlus" nil t)
in my mini-buffer and observing 単
showing up correctly in scratch buffer. But I wonder how to tweak/correct the above code to let it automatically detect and set font. I don't understand how fontset work in Emacs. But
describe-fontset
gives
Fontset: -apple-Menlo-medium-normal-normal-*-16-*-*-*-m-0-fontset-auto1
not myfontset
. And describe-font
gives
name (opened by): -apple-Menlo-medium-normal-normal-*-16-*-*-*-m-0-iso10646-1
full name: Menlo-Regular
size: 16
height: 19
baseline-offset: 0
relative-compose: 0
Update 3
Experiment 1
/Applications/Emacs.app/Contents/MacOS$ ./Emacs --no-init-file
and then open a text file containing
すべての人間は、生まれながらにして自由であり、
かつ、尊厳と権利と について平等である。
人間は、理性と良心とを授けられており、
互いに同胞の精神をもって行動しなければならない。
I see all characters showing up correctly. And describe-font
with default selection shows
name (opened by): -apple-Menlo-medium-normal-normal-*-12-*-*-*-m-0-iso10646-1
full name: Menlo-Regular
size: 12
height: 14
baseline-offset: 0
relative-compose: 0
and describe-fontset
shows
Fontset: -apple-Menlo-medium-normal-normal-*-*-*-*-*-m-0-fontset-startup
Experiment 2
/Applications/Emacs.app/Contents/MacOS$ ./Emacs --no-site-file
and then open the same test file. I see all characters showing up correctly. And describe-font
with default selection shows
name (opened by): -apple-Source_Code_Pro-medium-normal-normal-*-12-*-*-*-m-0-iso10646-1
full name: SourceCodePro-Regular
size: 12
height: 16
baseline-offset: 0
relative-compose: 0
Why it's not font size 16?!
and describe-fontset
shows
Fontset: -apple-Source_Code_Pro-medium-normal-normal-*-12-*-*-*-m-0-fontset-auto1