推荐几款连字字体,在代码编辑器中启用连字字体(Visual Studio Code)
启用转为编程设计的连字字体,可以给你的变成带来不一样的体验。
本文内容
- 连字字体
- 连字字体推荐
- 在编辑器中启用
- 在 Visual Studio Code 中启用
- 在 Visual Studio 或其他 Windows 系统自带软件中启用
连字字体
下面是 Fira Code 连字字体在 Visual Studio Code 中的显示效果:
就是下面这一段代码:
x =>
{
if (x >= 2 || x == 0)
{
Console.WriteLine(" >=> 欢迎访问吕毅的博客 ~~> blog.walterlv.com");
}
}
连字字体推荐
微软随着 Windows Terminal 发布了一款连字字体 Cascadia Code:
- microsoft/cascadia-code: This is a fun, new monospaced font that includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.
同时,你也可以在这里找到一些其他好看的用于编程的连字字体:
- 8 Best monospace programming fonts with ligatures as of 2019 - Slant
相关的开源项目链接:
- tonsky/FiraCode: Monospaced font with programming ligatures
- i-tu/Hasklig: Hasklig - a code font with monospaced ligatures
- be5invis/Iosevka: Slender typeface for code, from code.
- Victor Mono
以 Fira Code 为例安装的话,去它的 GitHub 的 release 页面:
- Releases · tonsky/FiraCode
下载最新的发布文件 FiraCode_1.207.zip。
下载解压后,你会看到五个不同的文件夹,这是四种不同的字体类型:
- otf (Open Type)
- ttf (True Type)
- variable_ttf (Variable True Type)
- woff (Web Open Font Format)
- woff2 (Web Open Font Format)
对于 Open Type 和 True Type 的选择,一般有对应的 Open Type 类型字体的时候就优先选择 Open Type 类型的,因为 True Type 格式是比较早期的,限制比较多,比如字符的数量受到限制,而 Open Type 是基于 Unicode 字符集来设计的新的跨平台的字体格式。
Variable True Type 是可以无极变换的 True Type 字体。
而 Web Open Font Format 主要为网络传输优化,其特点是字体均经过压缩,其大小会比较小。
我们点击进入 otf
文件夹,然后全选所有的字体文件,右键,安装,等待安装完成即可。
在编辑器中启用
在 Visual Studio Code 中启用
在 Visual Studio Code 中启用连字字体需要用到两个选项:
"editor.fontFamily": "Fira Code Light, Consolas, Microsoft YaHei",
"editor.fontLigatures": true,
然后点击新打开的标签右上角的 {}
图标以打开 json 形式编辑的设置:
然后修改把上面两个设置增加或替换进去即可。下面是我的设置的部分截图:
在 Visual Studio 或其他 Windows 系统自带软件中启用
只需要将字体设置成 Fira Code 即可。
参考资料
- Type is Beautiful » 参数化设计与字体战争:从 OpenType 1.8 说起
我的博客会首发于 https://blog.walterlv.com/,而 CSDN 会从其中精选发布,但是一旦发布了就很少更新。
如果在博客看到有任何不懂的内容,欢迎交流。我搭建了 dotnet 职业技术学院 欢迎大家加入。
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。欢迎转载、使用、重新发布,但务必保留文章署名吕毅(包含链接:https://walterlv.blog.csdn.net/),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请与我联系。