程序員福利!J研崖媚!
今天為大家?guī)硪粋€專為程序員寫程序設(shè)計的字體 —— Fira Code
Fira 是 Mozilla 公司(火狐瀏覽器她爹)主推的字體系列亦歉。Fira Code 是其中的一員,專為寫程序而生畅哑。出來具有等寬
等基本屬性外肴楷,還加入了編程連字特性(ligatures)。
Fira Code 就是利用這個特性對編程中的常用符號進行優(yōu)化荠呐,比如把輸入的「!=」直接顯示成「≠」或者把「>=」變成「≥ 」等等赛蔫,以此來提高代碼的可讀性。
代碼示例
Ruby:
JavaScript:
Erlang:
Elixir:
Go:
LiveScript:
Clojure:
Swift:
正片
安裝 Fira Code
使用 .ttf 文件安裝
訪問此網(wǎng)站 https://github.com/tonsky/FiraCode
找到 Download
這個鏈接直秆,單擊它濒募。
單擊這個地址可以下載 v1.204 版的 Fira Code -> Download v1.204
下載好后,解壓它圾结。
打開解壓后得到的文件夾瑰剃。
打開 /ttf文件夾
。
會看到以下文件
Ctrl+A
全選 -> 右鍵 -> 安裝筝野。
使用 Chocolate 安裝
關(guān)于 Chocolate晌姚,請參考這篇文章。
使用以下命令安裝
$ choco install firacode
如何使用
只有以下編輯器歇竟、瀏覽器可以完美支持 Fira Code:
VS Code
介紹一下在 VS Code 中如何配置(因為VS Code 是我主要使用的編輯器挥唠,別的不是很熟悉)
打開 VS Code。
文件 -> 首選項 -> 設(shè)置
然后在右邊的窗口中添加
"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 設(shè)為 Chrome 的 等寬字體
。
打開 Chrome盅安。點擊右上角的 ┇
-> 設(shè)置
選擇
自定義字體
寬度固定的字體
-> 在下拉菜單中選擇 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;
)
參考
本文章參考了:
原文地址:https://mogeko.github.io/2017/006
歡迎關(guān)注我的博客 (?ω?) ノ:Mogeko`s Blog