UP | HOME

▼ 本文更新于 [2025-11-28 五 19:51]

emacs-字体选择


方正宋刻本秀楷M的粗细度刚好与Cascadia Code SemiLight配合;
方正聚珍新仿的粗细度与Cascadia Code Light刚好一致
汉仪书仿55S是传统的仿宋字型,但是粗细度比默认的仿宋好很多,有5个字重可调
搭配上Windows的Emacs 31版本新增的Direct Write支持,显示效果挺不错的。

:汉仪书仿的字高并不固定,随着字号的变化会有行高的变化;宋刻本秀楷的字型大小会有跃动,不适合长篇文字,最后换回了方正聚珍新仿。

:目前字体配置如下:

: 改用聚珍新仿与Monaspace Argon作为中英文字体,Cascadia Mono NF SemiLight作为symbol字体。

:英文字体改为LXGW Bright Code light(改等宽)。本来用的Monaspace Argon据说在1.3会放出窄版,到时候试试看。

今天发现Monaspace Argon的窄版移动到「SomeDay」了,但是1:2/2:3/3:5的issue又移动到了「1.4」,很神秘。

(defun my/set-gui ()
  (interactive)
  (if (eq system-type 'darwin)
      (progn
        ;; 与Win不同,Mac需要在函数中指定light字体
        (defun set-font (english chinese english-size chinese-size)
          (set-face-attribute 'default nil :font
                              (font-spec :family english :size english-size :weight 'light))
          (set-face-attribute 'fixed-pitch nil :font
                              (font-spec :family english :size english-size :weight 'light))
          (set-face-attribute 'variable-pitch nil :font
                              (format   "%s:pixelsize=%d"  english english-size))
          (dolist (charset '(kana han cjk-misc bopomofo))
            (set-fontset-font (frame-parameter nil 'font) charset
                              (font-spec :family chinese :size chinese-size))))
        (set-font "LXGW Bright Code GB" "FangSongCode" 22 22)
        (set-fontset-font t 'emoji (font-spec :family "Twitter Color Emoji") nil 'prepend)
        (set-fontset-font t 'symbol (font-spec :family "Cascadia Mono NF SemiLight") nil 'prepend)
        (set-frame-parameter (selected-frame) 'fullscreen 'maximized))
    (progn
      (set-font "LXGW Bright Code GB light" "FangSongCode" 42 42)
      (set-fontset-font t 'emoji (font-spec :family "Segoe UI Emoji") nil 'prepend)
      (set-fontset-font t 'symbol (font-spec :family "Symbols Nerd Font Mono") nil 'prepend)
      (let* ((display-width (display-pixel-width))
             (display-height (display-pixel-height))
             (frame-width (floor (* 0.8 display-width)))
             (frame-height (floor (* 0.73 display-height)))
             (left-offset (floor (* 0.1 display-width)))
             (top-offset (floor (* 0.1 display-height))))
        (set-frame-position (selected-frame) left-offset top-offset)
        (set-frame-size (selected-frame) frame-width frame-height t))))
  (sis-set-english)
  (select-frame-set-input-focus (selected-frame)))

(my/set-gui)
;; server模式下需要启用以下hook
(add-hook 'server-after-make-frame-hook #'my/set-gui)

© Published by Emacs 31.0.50 (Org mode 9.8-pre) | RSS English-Index