Fira Code | 為寫程序而生的字體

程序員福利?。。?/strong>
今天為大家?guī)?lái)一個(gè)專為程序員寫程序設(shè)計(jì)的字體 —— Fira Code
Fira 是 Mozilla 公司(火狐瀏覽器她爹)主推的字體系列。Fira Code 是其中的一員,專為寫程序而生。出來(lái)具有等寬等基本屬性外,還加入了編程連字特性(ligatures)。

Fira Code 就是利用這個(gè)特性對(duì)編程中的常用符號(hào)進(jìn)行優(yōu)化,比如把輸入的「!=」直接顯示成「≠」或者把「>=」變成「≥ 」等等,以此來(lái)提高代碼的可讀性。

Fira Code|Fire Mono

代碼示例

Ruby:

Ruby

JavaScript:

JavaScript

Erlang:

Erlang

Elixir:

Elixir

Go:


Go

LiveScript:


LiveScript

Clojure:


Clojure

Swift:


Swift

正片

安裝 Fira Code

使用 .ttf 文件安裝

訪問(wèn)此網(wǎng)站 https://github.com/tonsky/FiraCode
找到 Download 這個(gè)鏈接,單擊它。

Install Fira Code

單擊這個(gè)地址可以下載 v1.204 版的 Fira Code -> Download v1.204

下載好后,解壓它。
打開(kāi)解壓后得到的文件夾。
打開(kāi) /ttf文件夾
會(huì)看到以下文件

Install Fira Code

Ctrl+A 全選 -> 右鍵 -> 安裝。

使用 Chocolate 安裝

關(guān)于 Chocolate,請(qǐng)參考這篇文章。
使用以下命令安裝

$ choco install firacode

如何使用

只有以下編輯器、瀏覽器可以完美支持 Fira Code:

VS Code

介紹一下在 VS Code 中如何配置(因?yàn)閂S Code 是我主要使用的編輯器,別的不是很熟悉)
打開(kāi) VS Code。
文件 -> 首選項(xiàng) -> 設(shè)置

Use Fira Code

然后在右邊的窗口中添加

    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true

Use Fira Code

Ctrl+S 保存。如果沒(méi)有生效就使用以下代碼

    "editor.fontFamily": "'Fira Code'",
    "editor.fontLigatures": true

Ctrl+S 保存。

別的編輯器可以參考 -> https://github.com/tonsky/FiraCode/wiki#how-to-enable-ligatures

Chrome

可以將 Fira Code 設(shè)為 Chrome 的 等寬字體。

打開(kāi) Chrome。點(diǎn)擊右上角的 -> 設(shè)置

Use Fira Code

選擇 自定義字體
Use Fira Code

寬度固定的字體 -> 在下拉菜單中選擇 Fira Code
Use 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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容