Skip to content

Instantly share code, notes, and snippets.

@sylecn
Created September 14, 2016 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sylecn/fee6caf59bc6d2e84eaddb257a9f8cff to your computer and use it in GitHub Desktop.
Save sylecn/fee6caf59bc6d2e84eaddb257a9f8cff to your computer and use it in GitHub Desktop.
Emacs font config for Chinese users
(require 'cl)
(defun my-set-fontset (fontset alst)
"set fontset according to alst.
The alst contains TARGET FONT-SPEC pairs. TARGET should be from
most specific (latin) to most generic (nil). Otherwise, some
lines will have no effect.
see `set-fontset-font' for what could be used for TARGET and FONT-SPEC"
(loop for (target font-spec) in (reverse alst)
do (set-fontset-font fontset target font-spec)))
(my-set-fontset
"fontset-startup"
'((latin "Bitstream Vera Sans Mono-14")
(han "Noto Sans CJK SC-14")
(cjk-misc "Noto Sans CJK SC-14")
(nil "文泉驿等宽正黑-14")))
;; set fontset-startup as current frame's font.
(set-frame-font "fontset-startup" nil t)
;; set fontset-startup as default frame font.
(add-to-list 'default-frame-alist '(font . "fontset-startup"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment