Emacs: Chinese Font Setup

By Xah Lee. Date: . Last updated: .

Set Font for Chinese

;; set font for chinese
(set-fontset-font
 t
 'han
 (cond
  ((string-equal 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")))
  ((string-equal 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")))
  ((string-equal 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

Font

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial