事情是这样的。

最近微软发布了一款适合编程用的等宽字体,叫做 Cascadia Code 。其将作为 Windows Terminal 的默认字体。其特色是支持一些方便开发者的连字(font ligature)设计。像这样:

字体预览

相信用过 Fira Code的朋友一定很熟悉这种连字。

那么问题是什么呢?

Fira Code 很棒, Cascadia Code 也很不错,但我喜欢的是 Source Code Pro。我搜索之后了解到,Source Code Pro有一个 Fork 的版本做了这样的连字支持,它就是: Hasklig

装完之后去 idea 里面没有发现我的这个字体。尝试了重新安装、重启IDE、切换idea的JRE无果,再次搜寻答案之后终于找到了解决方法:

Wadqse Created December 13, 2018 14:35 Comment actions https://youtrack.jetbrains.com/issue/IDEA-200145

Hi,EveryOne,I think I found the answer in this issue Q&A.

Win10 build 1809 had changed the old font installed way. If the idea (2018.3) did not find the font , we could use these fonts by put them in JB runtime JRE /lib/font. BUT, in this way , the font render will not as well as idea recognize the same font from ‘system font’ (by using boulded jre , font will blur, by using oracle jdk font will too sharp and antialiasing did not do best).

how to repair this: reinstall font by right click font file (.TTF) and chose ‘install for all users’. zhen , we can remove font file from JB runtime JRE /lib/font dir. Restart idea , it can recogize font from ‘system font’ and rendering quality would be satisfied.

将字体以“为所有用户安装”即可解决问题。

安装之后记得勾选“Use font ligature”。之后写点代码试试吧!

Reference: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001112320-Idea-does-not-recognize-the-new-fonts-added-to-windows10-LTSC-2019-version