tumashu / cnfonts

emacs中文字体配置工具。可以快速方便的的实现中文字体和英文字体等宽(也就是常说的中英文对齐)。
694 stars 59 forks source link

[BUG]无法找到中文字体 #96

Open albert748 opened 6 years ago

albert748 commented 6 years ago

Version: 20171205.911

这个事情比较奇葩,可能和系统设置有关,cnfonts--fontnames-fallback 中所有中文字体名字都无法找到了

测试了一下:

(defun cfs--font-family-list ()
  (delete-dups
   (mapcar #'(lambda (x)
               (substring-no-properties
                (string-as-multibyte x)))
           (font-family-list))))

返回是这样的:

(cl-prettyprint (cfs--font-family-list)) ("monaco" "bitstream vera sans mono" "bitstream vera sans" "bitstream vera serif" "dejavu math tex gyre" "dejavu sans condensed" "dejavu sans light" "dejavu sans mono" "dejavu sans" "dejavu serif condensed" "dejavu serif" "hanamina" "hanaminb" "inconsolata" "courier" "helvetica" "new century schoolbook" "symbol" "times" "utopia" "lucida" "lucidabright" "lucidatypewriter" "charter" "terminal" "fixed" "TeX Gyre Termes Math" "STIX MathJax Arrows" "Standard Symbols PS" "STIX MathJax Normal" "MathJax_Caligraphic" "Asana Math" "DejaVu Math TeX Gyre" "URW Gothic" "STIX MathJax Variants" "MathJax_Main" "Latin Modern Math" "MathJax_Math" "Nimbus Roman" "TeX Gyre Pagella Math" "Neo Euler" "WenQuanYi Zen Hei Mono" "STIX MathJax Size5" "STIX MathJax Size4" "STIX MathJax Size3" "STIX MathJax Size2" "STIX MathJax Size1" "MathJax_Script" "DejaVu Sans Mono" "MathJax_Typewriter" "Cantarell" "Adobe Helvetica" "STIX MathJax Main" "Nimbus Sans" "STIX MathJax Marks" "Bitstream Vera Sans" "STIX MathJax Latin" "STIX MathJax SansSerif" "Bitstream Vera Sans Mono" "B&H Lucida" "Nimbus Mono PS" "Bitstream Vera Serif" "WenQuanYi Micro Hei Light" "DejaVu Sans" "Adobe Times" "WenQuanYi Zen Hei" "Nimbus Sans Narrow" "URW Bookman" "STIX MathJax Misc" "MathJax_Size4" "MathJax_Size1" "MathJax_Size3" "MathJax_Size2" "DejaVu Serif" "Adobe Utopia" "STIX MathJax Monospace" "Adobe New Century Schoolbook" "Bitstream Charter" "DEC Terminal" "C059" "MathJax_Vector-Bold" "HanaMinA" "HanaMinB" "WenQuanYi Micro Hei" "STIX MathJax Symbols" "STIX MathJax DoubleStruck" "MathJax_Fraktur" "B&H LucidaBright" "Z003" "MathJax_SansSerif" "STIX MathJax Alphabets" "D050000L" "Adobe Courier" "STIX MathJax Operators" "WenQuanYi Zen Hei Sharp" "B&H LucidaTypewriter" "Bitstream Terminal" "Monaco" "Inconsolata" "STIX MathJax Shapes" "WenQuanYi Micro Hei Mono" "P052" "STIX MathJax Script" "WenQuanYi Micro Hei Mono Light" "MathJax_AMS" "WenQuanYi WenQuanYi Bitmap Song" "MathJax_Vector" "STIX MathJax Fraktur")

cnfonts-ui 中没有一个可用的中文字体,cnfonts-increase/decrease-fontsize 执行无效

whatacold commented 6 years ago

我这也有类似问题,我之前在 Fedora 27 上设置好了,正常使用“文泉驿等宽微米黑”,那时的 Emacs 还是 25.3.1 。上星期升级到 Fedora 28 之后(Emacs 26.1 ),该字体现在被标识为 NA 。

我执行上述命令输出的也都是英文名的字体,且 (x-list-fonts "WenQuanYi" nil nil 1) 返回 nil

albert748 commented 6 years ago

测试: 修改 cnfonts.el 中的 cnfonts--fontnames-fallback 为英文字体名(WenQuanYi Micro Hei Mono),然后 byte-recompile-file. 重新打开 cnfonts-ui, 可以正确找到字体。

我很好奇什么时候 emacs 中的 font-family-list 返回值全都变成英文了?

tumashu commented 6 years ago

不建议修改 cnfonts--fontnames-fallback, 修改 profile 就可以了, 每个 profile 都是一个 el文件

whatacold commented 6 years ago

@albert748 你用什么系统和什么版本的 Emacs 呢?最近有升级过吗?

我也挺奇怪为何突然就变了,昨天我翻了一下 Emacs NEWS 26 ,没有提到 font 方面的改动。

albert748 commented 6 years ago

@whatacold Emacs 26.1.50, emacs-26最新的分支代码

wych42 commented 5 years ago

我也碰到类似的问题,我是 Mac 系统语言设置的英文,安装文泉驿字体后,cnfonts 也是找不到的,但是 fc-list 可以找到 :

fc-list | grep WenQuanYi
Unable to revert mtime: /Library/Fonts
Fontconfig warning: ignoring UTF-8: not a valid region tag
/Users/xx/Library/Fonts/wqy-zenhei.ttc: WenQuanYi Zen Hei Mono,文泉驛等寬正黑,文泉驿等宽正黑:style=Medium,中等
/Users/xx/Library/Fonts/wqy-microhei.ttc: WenQuanYi Micro Hei,文泉驛微米黑,文泉驿微米黑:style=Regular
/Users/xx/Library/Fonts/wqy-zenhei.ttc: WenQuanYi Zen Hei,文泉驛正黑,文泉驿正黑:style=Medium,中等
/Users/xx/Library/Fonts/wqy-microhei.ttc: WenQuanYi Micro Hei Mono,文泉驛等寬微米黑,文泉驿等宽微米黑:style=Regular

我就先保存了一个 profile,在 ~/.emacs.d/cnfonts/v4/xx.el 里,手工加上 WenQuanYi Micro Hei Mono 就可以设置了。

在另一台系统语言为中文的 Mac 上,不用手工修改就可以,我猜是跟系统语言有关?