Fira Code | 為寫程序而生的字體
程序員福利!!!
今天為大家帶來一個專為程序員寫程序設計的字體 —— Fira Code
Fira 是 Mozilla 公司(火狐瀏覽器她爹)主推的字體系列。Fira Code 是其中的一員,專為寫程序而生。出來具有等寬
等基本屬性外,還加入了編程連字特性(ligatures)。
Fira Code 就是利用這個特性對編程中的常用符號進行優化,比如把輸入的「!=」直接顯示成「≠」或者把「>=」變成「≥ 」等等,以此來提高代碼的可讀性。
代碼示例
Ruby:
JavaScript:
Erlang:
Elixir:
Go:
LiveScript:
Clojure:
Swift:
正片
安裝 Fira Code
使用 .ttf 文件安裝
訪問此網站 https://github.com/tonsky/FiraCode
找到 Download
這個鏈接,單擊它。
單擊這個地址可以下載 v1.204 版的 Fira Code ->
Download v1.204
下載好后,解壓它。
打開解壓后得到的文件夾。
打開 /ttf文件夾
。
會看到以下文件
Ctrl+A
全選 -> 右鍵 -> 安裝。
使用 Chocolate 安裝
關於 Chocolate,請參考這篇文章。
使用以下命令安裝
$ choco install firacode
如何使用
只有以下編輯器、瀏覽器可以完美支持 Fira Code:
VS Code
介紹一下在 VS Code 中如何配置(因為VS Code 是我主要使用的編輯器,別的不是很熟悉)
打開 VS Code。
文件 -> 首選項 -> 設置
然后在右邊的窗口中添加
"editor.fontFamily": "Fira Code", "editor.fontLigatures": true
Ctrl+S
保存。如果沒有生效就使用以下代碼
"editor.fontFamily": "'Fira Code'", "editor.fontLigatures": true
Ctrl+S
保存。
別的編輯器可以參考 -> https://github.com/tonsky/FiraCode/wiki#how-to-enable-ligatures
Chrome
可以將 Fira Code 設為 Chrome 的 等寬字體
。
打開 Chrome。點擊右上角的 ┇
-> 設置
選擇
自定義字體
寬度固定的字體
-> 在下拉菜單中選擇
Fira Code
附錄
支持的終端
Work | Doesn’t work |
---|---|
Black Screen | Alacritty |
Butterfly | cmd.exe |
Hyper.app | Cmder |
Konsole | ConEmu |
QTerminal | GNOME Terminal |
Terminal.app (OS X default terminal) | iTerm 2 (coming in 3.1) |
Termux (Android terminal emulator) | mate-terminal |
ZOC (macOS) | mintty |
PuTTY | |
rxvt | |
ZOC (Windows) | |
gtkterm, guake, LXTerminal, sakura, Terminator, xfce4-terminal,and other libvte-based terminals (bug report) |
支持的編輯器
Work | Doesn’t work |
---|---|
Android Studio (2.3+, instructions) | Arduino IDE |
Anjuta (unless at the EOF) | Adobe Dreamweaver |
AppCode (2016.2+, instructions]) | Delphi IDE |
Atom 1.1 or newer (instructions) | Eclipse (Win, vote here) |
BBEdit/TextWrangler (instructions) | Standalone Emacs (workaround) |
Brackets (with this plugin]) | gVim (Windows workaround) |
Chocolat | IDLE |
CLion (2016.2+, instructions) | KDevelop 4 |
Cloud9 (instructions) | Monkey Studio IDE |
Coda 2 | SublimeText (vote here) |
CodeLite | |
Eclipse (Mac 4.7+, Linux) | |
Geany | |
gEdit / Pluma | |
GNOME Builder | |
IntelliJ IDEA (2016.2+, instructions) | |
Kate, KWrite | |
Komodo | |
Leafpad | |
LibreOffice | |
LightTable (instructions) | |
LINQPad | |
MacVim 7.4 or newer (instructions) | |
Mancy | |
Meld | |
Mousepad | |
NetBeans | |
Notepad (Win) | |
Notepad++ (with a workaround) | |
PhpStorm (2016.2+, instructions) | |
PyCharm (2016.2+, instructions) | |
QtCreator | |
Rider | |
RStudio (instructions) | |
RubyMine (2016.2+, instructions) | |
Scratch | |
Spyder IDE (only with Qt5) | |
TextAdept (Linux, Mac) | |
TextEdit | |
TextMate 2 | |
VimR (instructions) | |
Visual Studio 2015 | |
Visual Studio 2017 | |
Visual Studio Code (instructions) | |
WebStorm (2016.2+, instructions) | |
Xamarin Studio/Monodevelop | |
Xcode (8.0+, otherwise with plugin) | |
Probably work: Smultron, Vico | Under question: Code::Blocks IDE |
支持的瀏覽器
- IE 10+, Edge: enable with
font-feature-settings: "calt" 1;
- Firefox
- Safari
- Chromium-based browsers (Chrome, Opera)
- ACE
- CodeMirror (enable with
font-variant-ligatures: contextual;
)
參考
本文章參考了:
原文地址:Fira Code | 為寫程序而生的字體
歡迎關注我的博客 (・ω・) ノ:Mogeko`s Blog