俗話說,工欲善其事,必先利其器。算法固然重要,但真正實踐也很重要。
一個字體的好看程度,直接決定了寫代碼和看代碼的心情。比如這樣:
代碼1:
#include <iostream>
#include <cstdio>
...
代碼2:
#include <iostream>
#include <cstdio>
...
對比強烈,一目了然。
接下來,讓我們看一看這個為程序員而生的字體——Fira Code。
1. Fira Code長什么樣?
先上圖感受下:
看起來還挺美觀的吧?
不過,相信一些同學看出來它的特殊之處了。
這就是它的特殊之處——編程連字特性。
這樣,就可以提高代碼的可讀性。
在\(C++\)中,Fira Code有很多符號都做了類似的優化。
比如,\(<=\)變成了\(\le\) ,\(!=\)變成了\(\ne\) 。
如果你仔細觀察,會發現\(++\)、\(--\)、\(<<\)也變了。
當然,遠不止這些符號。這是官方給出的全圖:
沒錯,它還包括PowerLine字符,因此用Vim的同學也可以大膽使用。
2. 怎么獲取Fira Code
說了這么多,怎么下載Fira Code字體呢?
單擊這個地址可以下載 v1.204 版的 Fira Code -> Download v1.204
當然,考慮到有些同學沒有 木弟 子,這里給一個我打包上傳的鏈接:點這里
解壓后雙擊即可安裝字體。
-
Retina——適合視網膜屏幕(蘋果的那種)。
-
Regular——適合平時用。
-
Light——比較細。
-
Bold——粗體。
-
Medium——介於Regular與Bold之間。
請自己按需食用。
如果你想在你的網站上使用Fira Code,插入以下代碼:
<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+) | ConEmu |
Kitty | GNOME Terminal |
Konsole | mate-terminal |
mintty (部分支持 2.8.3+) | 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 (需有這個插件) | 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++ (要求:鏈接) | |
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+, 或者安裝這個插件) | |
很可能可以(憑rp): Smultron, Vico | 待定: Code::Blocks IDE |
用Dev-C++的同學,趕快轉成其他的吧!
最后,祝大家rp++!
蒟蒻寫博客不易,懇請大佬點個贊!