Emacs Init: Font for Chinese

By Xah Lee. Date: . Last updated: .

Set Font for Chinese

put this in your Emacs Init File:

;; set font for chinese
(set-fontset-font
 t
 'han
 (cond
  ((eq system-type 'windows-nt)
   (cond
    ((member "Microsoft YaHei" (font-family-list)) "Microsoft YaHei")
    ((member "Microsoft JhengHei" (font-family-list)) "Microsoft JhengHei")
    ((member "SimHei" (font-family-list)) "SimHei")))
  ((eq system-type 'darwin)
   (cond
    ((member "Hei" (font-family-list)) "Hei")
    ((member "Heiti SC" (font-family-list)) "Heiti SC")
    ((member "Heiti TC" (font-family-list)) "Heiti TC")))
  ((eq system-type 'gnu/linux)
   (cond
    ((member "WenQuanYi Micro Hei" (font-family-list)) "WenQuanYi Micro Hei")))))

Note: 2020-05-28, in emacs 26 or before, on Microsoft Windows 10, if you don't set font for Chinese, and if a buffer has Chinese character, then emacs operation such as moving cursor will be super slow, like 1/3 of a second when you press arrow key. See also: Chinese Font

Emacs and Unicode

File Encoding

Unicode Font Setup

Emacs Font Setup