Skip to content

Instantly share code, notes, and snippets.

@lovelock
Created February 1, 2023 06:09
Show Gist options
  • Save lovelock/2e58e5fc5d4321856735fd83275cf94b to your computer and use it in GitHub Desktop.
Save lovelock/2e58e5fc5d4321856735fd83275cf94b to your computer and use it in GitHub Desktop.
解决emacs gui模式中文展示难看的问题
(defun +my/better-font()
(interactive)
;; english font
(if (display-graphic-p)
(progn
(set-face-attribute 'default nil :font (format "%s:pixelsize=%d" "Fira Code" 17)) ;; 11 13 17 19 23
;; chinese font
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset
(font-spec :family "Sarasa Mono SC")))) ;; 14 16 20 22 28
))
(defun +my|init-font(frame)
(with-selected-frame frame
(if (display-graphic-p)
(+my/better-font))))
(if (and (fboundp 'daemonp) (daemonp))
(add-hook 'after-make-frame-functions #'+my|init-font)
(+my/better-font))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment