Emacs中的“中”字和“言”字显示奇怪

如图,无论如何改字体,“中”字永远这样显示:

“言”字永远这样显示: 是个小问题但是好诡异啊,尤其是这个“言”字的形状。。。

这也太奇怪了吧(

好奇,上面 describe-char 是什么样子?

上面“言”字describe-char的输出:

             position: 4 of 8 (38%), column: 0
            character: 言 (displayed as 言) (codepoint 35328, #o105000, #x8a00)
              charset: unicode (Unicode (ISO10646))
code point in charset: 0x8A00
               script: han
               syntax: w 	which means: word
             category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, h:Korean, j:Japanese, |:line breakable
             to input: type "C-x 8 RET 8a00"
          buffer code: #xE8 #xA8 #x80
            file code: #xE8 #xA8 #x80 (encoded by coding system utf-8)
              display: by this font (glyph code)
    ftcrhb:-unknown-file-icons-normal-normal-normal-*-45-*-*-*-*-0-iso10646-1 (#x68)

Character code properties: customize what to show
  name: CJK IDEOGRAPH-8A00
  general-category: Lo (Letter, Other)
  decomposition: (35328) ('言')

There are text properties here:
  ws-butler-chg        chg

“中”字describe-char的输出:

             position: 413 of 8315 (5%), column: 27
            character: 中 (displayed as 中) (codepoint 20013, #o47055, #x4e2d)
              charset: unicode (Unicode (ISO10646))
code point in charset: 0x4E2D
               script: han
               syntax: w 	which means: word
             category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, h:Korean, j:Japanese, |:line breakable
             to input: type "C-x 8 RET 4e2d"
          buffer code: #xE4 #xB8 #xAD
            file code: #xE4 #xB8 #xAD (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    ftcrhb:-UFAS-Symbola-normal-normal-semicondensed-*-45-*-*-*-*-0-iso10646-1 (#x1990)

Character code properties: customize what to show
  name: CJK IDEOGRAPH-4E2D
  general-category: Lo (Letter, Other)
  decomposition: (20013) ('中')

There are 2 overlays here:
 From 301 to 442
  face                 hl-line
  priority             -50
  window               #<window 9 on todo.org>
 From 9 to 1861
  before-string        [Show]
  fringe-helper        t
  git-gutter           t
  insert-in-front-hooks (fringe-helper-modification-func)
  modification-hooks   (fringe-helper-modification-func)


There are text properties here:
  face                 org-roam-link
  font-lock-multiline  t
  fontified            t
  help-echo            [Show]
  htmlize-link         [Show]
  keymap               [Show]
  line-prefix          [Show]
  mouse-face           highlight
  org-category         "todo"
  valign-init          t
  wrap-prefix          [Show]

这明显是没用更纱而是用了其他的字体。你这是doom吗?doom里字体你怎么设置的?

是doom,字体配置是这样的:

(setq doom-font (font-spec :family "mononoki" :size 45 :weight 'light)
                 doom-variable-pitch-font (font-spec :family "Noto Sans CJK SC Light" :size 40))

我也奇怪为什么非标题区域显示的是宋体而不是黑体。。。

不过tab 标题用到了我指定的patch字体:

EDIT: 以上是一派胡言。标题用的是variable pitch字体

你应该装了一个CJK字体,只是下载了日语版的字体了

你这个明显没有设置上字体啊:你只指定了基础字体doom-font是mononoki,而这个字体里没有中文,所以Emacs会自动想办法找一个在这些字符上有定义的字体。然后就给你找了个不知道是什么鬼。这个fallback的顺序会有很多因素,最高概率是你~/.config/fontconfig/config.conf没有设好。你指定的doom-variable-pitch-font会初始化variable-pitch这个face,但是看你没有用variable-pitch这个face。建议你按照modules/ui/doom设置一下doom-unicode-font和其他字体,或者钻研一下fontconfig应该怎么写。

1赞

我知道mononoki字体里没有中文字符,只是觉得doom-variable-pitch-font里有,应该没问题的 :laughing:

我去看看如何设好fontconfig和doom的字体,感谢解答!

我是自己配置的emacs,然后font set里字体用的Hei(mac字体),除了个别中文字,都是我用的字体,比如“中”这个字就不是,我也一直很头痛。。看describe-char几个字的charset、category什么都一样,但他就是不用那些字体

             position: 1 of 6 (0%), column: 0
            character: 中 (displayed as 中) (codepoint 20013, #o47055, #x4e2d)
              charset: chinese-gbk (GBK Chinese simplified.)
code point in charset: 0xD6D0
               script: han
               syntax: w 	which means: word
             category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, h:Korean, j:Japanese, |:line breakable
             to input: type "C-x 8 RET 4e2d"
          buffer code: #xE4 #xB8 #xAD
            file code: #xE4 #xB8 #xAD (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    mac-ct:-*-Symbola-normal-normal-semicondensed-*-11-*-*-*-p-0-iso10646-1 (#x153D)

Character code properties: customize what to show
  name: CJK IDEOGRAPH-4E2D
  general-category: Lo (Letter, Other)
  decomposition: (20013) ('中')

There is an overlay here:
 From 1 to 7
  face                 hl-line
  priority             -50
  window               #<window 3 on test>

[back]
             position: 2 of 6 (17%), column: 2
            character: 我 (displayed as 我) (codepoint 25105, #o61021, #x6211)
              charset: chinese-gbk (GBK Chinese simplified.)
code point in charset: 0xCED2
               script: han
               syntax: w 	which means: word
             category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, h:Korean, j:Japanese, |:line breakable
             to input: type "C-x 8 RET 6211"
          buffer code: #xE6 #x88 #x91
            file code: #xE6 #x88 #x91 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    mac-ct:-*-Hei-normal-normal-normal-*-13-*-*-*-p-0-iso10646-1 (#xEE8)

Character code properties: customize what to show
  name: CJK IDEOGRAPH-6211
  general-category: Lo (Letter, Other)
  decomposition: (25105) ('我')

There is an overlay here:
 From 1 to 7
  face                 hl-line
  priority             -50
  window               #<window 3 on test>

[back]

rg 一下配置看看,提到 symbola 的是哪儿?

(progn
  (set-face-attribute 'default nil :family "Hack" :height (* 10 vonfry-fontsize))
  (set-fontset-font nil 'unicode (font-spec :name "Symbola" :height (* 10 vonfry-fontsize)) nil 'append)
  (dolist (charset '(greek symbol))
    (set-fontset-font nil charset (font-spec :name "Symbola" :height (* 10 vonfry-fontsize)) nil 'prepend))
  (dolist (font '("Hei" "Source Han Sans CN"))
    (dolist (charset '(kana han symbol cjk-misc bopomofo))
      (set-fontset-font (frame-parameter nil 'font)
                        charset
                        (font-spec :family font :size (+ 2 vonfry-fontsize))
                        nil 'append))))

我配置是自己写的,全部的字体设置都在这里了。。symbola有影响的只有greek和symbol

不会是unicode里面的吧。。但是这个字describe里是chinese-gbk的。。 我去把unicode也加到中文字体的,或者删掉symbola的相关定义也是一样的。。 刚刚拿emacs -Q试了一下,居然没问题了。然后发现,我刚刚调了一下是改在其它文件里了,没有改到emacs读取的config里(因为用了home-manager

我也遇到了这样的问题,用sandbox查看没问题,最后发现在init.el里取消掉unicode的注释就可以正常显示了