超棒的字体——Fira Code字体的安装与配置
Zesty_Fox
2020-02-22 19:24:22
前往我的博客,观感更佳:[这里](https://www.cnblogs.com/acceptedzhs/p/12346742.html)
俗话说,工欲善其事,必先利其器。算法固然重要,但真正实践也很重要。
一个字体的好看程度,直接决定了写代码和看代码的心情。比如这样:
代码1:
![](https://gitee.com/accepted_zhs/Image/raw/master/20200222194325.png)
代码2:
![](https://gitee.com/accepted_zhs/Image/raw/master/20200222194430.png)
对比强烈,一目了然。
接下来,让我们看一看这个为程序员而生的字体——**Fira Code**。
## 1. Fira Code长什么样?
先上图感受下:
![](https://gitee.com/accepted_zhs/Image/raw/master/20200222193901.png)
![](https://gitee.com/accepted_zhs/Image/raw/master/20200222182218.png)
看起来还挺美观的吧?
不过,相信一些同学看出来它的特殊之处了。
这就是它的特殊之处——**编程连字特性**。
这样,就可以提高代码的可读性。
在$C++$中,Fira Code有很多符号都做了类似的优化。
比如,$<=$变成了$\le$ ,$!=$变成了$\ne$ 。
如果你仔细观察,会发现$++$、$--$、$<<$也变了。
当然,远不止这些符号。这是官方给出的全图:
![](https://gitee.com/accepted_zhs/Image/raw/master/20200222183401.png)
没错,它还包括PowerLine字符,因此用Vim的同学也可以大胆使用。
## 2. 怎么获取Fira Code
说了这么多,怎么下载Fira Code字体呢?
单击这个地址可以下载 v1.204 版的 Fira Code -> [Download v1.204](https://github.com/tonsky/FiraCode/releases/download/1.204/FiraCode_1.204.zip)
当然,考虑到有些同学没有 木弟 子,这里给一个我打包上传的链接:[点这里](https://www.lanzous.com/i9kzh2d)
解压后双击即可安装字体。
- Retina——适合视网膜屏幕(苹果的那种)。
- Regular——适合平时用。
- Light——比较细。
- Bold——粗体。
- Medium——介于Regular与Bold之间。
请自己按需食用。
如果你想在你的网站上使用Fira Code,插入以下代码:
```html
<link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css">
```
## 3. 为什么我的浏览器/编辑器/终端显示不了Fira Code 的连字效果?
一些浏览器/编辑器/终端显示不了连字效果。
### 终端:
| 可以显示连字效果 | 不可以显示连字效果 |
| :----------------------------------------------------------: | :----------------------------------------------------------: |
| **Butterfly** | **Alacritty** |
| **crosh** | **Windows Console (conhost.exe)** |
| **Hyper.app** | **Cmder** |
| **iTerm 2** ([3.1+](https://gitlab.com/gnachman/iterm2/issues/3568#note_13118332)) | **ConEmu** |
| **Kitty** | **GNOME Terminal** |
| **Konsole** | **mate-terminal** |
| **mintty** (部分支持 [2.8.3+](https://github.com/mintty/mintty/issues/601)) | **PuTTY** |
| **QTerminal** | **rxvt** |
| **Terminal.app** | **xterm** |
| **Termux** | **ZOC** (Windows) |
| **Token2Shell/MD** | **gtkterm, guake, LXTerminal, sakura, Terminator, xfce4-terminal,** 以及其它基于libvte的终端。 |
| **upterm** | |
| **Windows Terminal** | |
| **ZOC** (macOS) | |
### 支持的浏览器:
- IE 10+, Edge Legacy: 需启用`font-feature-settings: "calt";`
- Firefox
- Safari
- 基于Chromium browsers (Chrome, Opera)
- ACE
- CodeMirror (需启用 `font-variant-ligatures: contextual;`)
### 编辑器:
| 可以显示连字效果 | 不可以显示连字效果 |
| :----------------------------------------------------------: | :------------------------: |
| **Abricotine** | **Arduino IDE** |
| **Android Studio** (2.3+) | **Adobe Dreamweaver** |
| **Anjuta** | **Delphi IDE** |
| **AppCode** (2016.2+) | **Eclipse** (Windows) |
| **Atom** 1.1 or newer | **Emacs** |
| **BBEdit/TextWrangler** (只有v11) | **Geany** (Windows) |
| **Brackets** (需有[这个插件](https://github.com/polo2ro/firacode-in-brackets)) | **gVim** (Windows环境) |
| **Chocolat** | **IDLE** |
| **CLion** (2016.2+) | **KDevelop 4** |
| **Cloud9** | **Monkey Studio IDE** |
| **Coda 2** | |
| **CodeLite** | |
| **Eclipse** (macOS 4.7+, Linux) | |
| **elementary Code** | |
| **Geany** (macOS) | |
| **gEdit / Pluma** | |
| **GNOME Builder** | |
| **GoormIDE** | |
| **IntelliJ IDEA** (2016.2+) | |
| **Kate, KWrite** | |
| **KDevelop 5+** | |
| **Komodo** | |
| **Leafpad** | |
| **LibreOffice** | |
| **LightTable** | |
| **LINQPad** | |
| **MacVim** 7.4以上版本 | |
| **Mancy** | |
| **Meld** | |
| **Mousepad** | |
| **NeoVim-gtk** | |
| **NetBeans** | |
| **Notepad** (Windows) | |
| **Notepad++** (要求:[链接](https://github.com/notepad-plus-plus/notepad-plus-plus/issues/2287#issuecomment-256638098)) | |
| **Notepad3** | |
| **PhpStorm** (2016.2+) | |
| **PyCharm** (2016.2+) | |
| **QtCreator** | |
| **Rider** | |
| **RStudio** | |
| **RubyMine** (2016.2+) | |
| **Scratch** | |
| **Scribus** (1.5.3+) | |
| **SublimeText** (3146+) | |
| **Spyder IDE** (只能Qt5) | |
| **SuperCollider 3** | |
| **TextAdept** (Linux, macOS) | |
| **TextEdit** | |
| **TextMate 2** | |
| **VimR** | |
| **Visual Studio** (2015+) | |
| **Visual Studio Code** | |
| **WebStorm** (2016.2+) | |
| **Xamarin Studio/Monodevelop** | |
| **Xcode** (8.0+, 或者安装[这个插件](https://github.com/robertvojta/LigatureXcodePlugin)) | |
| 很可能可以(凭rp): **Smultron, Vico** | 待定: **Code::Blocks IDE** |
用Dev-C++的同学,赶快转成其他的吧!
最后,祝大家rp++!
蒟蒻写博客不易,恳请大佬点个赞!