FiraCode

带有编程连字的等宽字体。(Monospaced font with programming ligatures.)

Github星跟蹤圖

Fira 代码:带有编程连字的等宽字体

问题

程序员使用很多符号,通常用几个字符编码。对于人类大脑,像 -> ,<= 或 := 这样的序列是单个逻辑标记,即使它们在屏幕上占用两个或三个字符。 您的眼睛花费非零的能量来扫描、解析和连接多个字符到一个逻辑字符中。理想情况下,所有编程语言都应该为运算符设计完整的 Unicode 符号,但目前还不是这样。

解决方案

下载 v1.206·如何安装·疑难排解·新闻及更新

Fira Code 是 Fira Mono 字体的扩展,该字体包含一组连接符,用于常见的多字符组合编程。这只是一种字体渲染功能:底层代码仍然与 ASCII 兼容。这有助于更快地阅读和理解代码。对于一些常见的序列,如 .. 或 //,连字允许我们纠正间距。

代码示例

Ruby:

JavaScript:

PHP:

Erlang:

Elixir:

Go:

LiveScript:

Clojure:

Swift:

终端支持

工作 不工作
Butterfly Alacritty
crosh (ChromeOS, instructions) Windows Console (conhost.exe)
Hyper.app Cmder
iTerm 2 (3.1+) ConEmu
Kitty GNOME Terminal
Konsole mate-terminal
mintty (partial support 2.8.3+) PuTTY
QTerminal rxvt
Terminal.app ZOC (Windows)
Termux gtkterm, guake, LXTerminal, sakura, Terminator, xfce4-terminal, and other libvte-based terminals (bug report)
Token2Shell/MD
upterm
Windows Terminal
ZOC (macOS)

编辑器支持

工作 不工作
Abricotine Arduino IDE
Android Studio (2.3+, instructions) Adobe Dreamweaver
Anjuta (unless at the EOF) Delphi IDE
AppCode (2016.2+, instructions) Eclipse (Win, vote here)
Atom 1.1 or newer (instructions) Standalone Emacs (workaround)
BBEdit/TextWrangler (v. 11 only, instructions) gVim (Windows workaround)
Brackets (with this plugin) IDLE
Chocolat KDevelop 4
CLion (2016.2+, instructions) Monkey Studio IDE
Cloud9 (instructions)
Coda 2
CodeLite
Eclipse (Mac 4.7+, Linux)
elementary Code
Geany
gEdit / Pluma
GNOME Builder
GoormIDE (instructions)
IntelliJ IDEA (2016.2+, instructions)
Kate, KWrite
Komodo
Leafpad
LibreOffice
LightTable (instructions)
LINQPad
MacVim 7.4 or newer (instructions)
Mancy
Meld
Mousepad
NeoVim-gtk
NetBeans
Notepad (Win)
Notepad++ (with a workaround)
PhpStorm (2016.2+, instructions)
PyCharm (2016.2+, instructions)
QtCreator
Rider
RStudio (instructions)
RubyMine (2016.2+, instructions)
Scratch
Scribus (1.5.3+)
SublimeText (3146+)
Spyder IDE (only with Qt5)
SuperCollider 3
TextAdept (Linux, Mac)
TextEdit
TextMate 2
VimR (instructions)
Visual Studio 2015
Visual Studio 2017 (instructions)
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

浏览器支持

<!-- HTML -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/tonsky/FiraCode@1.206/distr/fira_code.css">
/* CSS */
@import url(https://cdn.jsdelivr.net/gh/tonsky/FiraCode@1.206/distr/fira_code.css);
/* Specify in CSS */
font-family: 'Fira Code', monospace;
  • IE 10+,Edge:使用 font-feature-settings启用:“calt”1;
  • 火狐
  • Safari浏览器
  • 基于 Chromium 的浏览器(Chrome,Opera)
  • ACE
  • CodeMirror(使用 font-variant-ligatures: contextual; 启用)

使用Fira代码的项目

替代

其他带有连字的等宽字体:

本地构建 Fira 代码

如果你想改变 FiraCode.glyphs,自己创建 OTF/TTF/WOFF 文件,可参考我在macOS 上使用的设置:

# install all required build tools
script/bootstrap
# build the font files
script/build
# install OTFs to ~/Library/Fonts
script/install

Credits

概覽

名稱與所有者tonsky/FiraCode
主編程語言Clojure
編程語言Clojure (語言數: 8)
平台Windows, Mac, Linux, BSD
許可證SIL Open Font License 1.1
發布數29
最新版本名稱6.2 (發布於 )
第一版名稱0.1 (發布於 2014-11-12 01:47:20)
創建於2014-11-11 19:32:38
推送於2024-02-29 16:53:30
最后一次提交2024-02-29 10:53:59
星數75.3k
關注者數713
派生數3k
提交數596
已啟用問題?
問題數1312
打開的問題數381
拉請求數132
打開的拉請求數4
關閉的拉請求數50
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

Fira Code: monospaced font with programming ligatures

Problem

Programmers use a lot of symbols, often encoded with several characters. For the human brain, sequences like ->, <= or := are single logical tokens, even if they take two or three characters on the screen. Your eye spends a non-zero amount of energy to scan, parse and join multiple characters into a single logical one. Ideally, all programming languages should be designed with full-fledged Unicode symbols for operators, but that’s not the case yet.

Solution

Download v.2 · How to install · Troubleshooting · News & updates

Fira Code is an extension of the Fira Mono font containing a set of ligatures for common programming multi-character combinations. This is just a font rendering feature: underlying code remains ASCII-compatible. This helps to read and understand code faster. For some frequent sequences like .. or //, ligatures allow us to correct spacing.

Code examples

Ruby:

JavaScript:

PHP:

Erlang:

Elixir:

Go:

LiveScript:

Clojure:

Swift:

Stylistic sets

See How to enable

Terminal support, Works, Doesn’t work, ------------------, ------------------, Butterfly, Alacritty, crosh (ChromeOS, instructions), Windows Console (conhost.exe), Hyper.app, Cmder, iTerm 2 (3.1+), ConEmu, Kitty, GNOME Terminal, Konsole, mate-terminal, mintty (partial support 2.8.3+), PuTTY, QTerminal, rxvt, Terminal.app, xterm, Termux, ZOC (Windows), Token2Shell/MD, gtkterm, guake, LXTerminal, sakura, Terminator, xfce4-terminal, and other libvte-based terminals (bug report), upterm, Windows Terminal, ZOC (macOS), ### Editor support, Works, Doesn’t work, -----, --------------, Abricotine, Arduino IDE, Android Studio (2.3+, instructions), Adobe Dreamweaver, Anjuta (unless at the EOF), Delphi IDE, AppCode (2016.2+, instructions), Eclipse (Windows, vote here), Atom 1.1 or newer (instructions), Standalone Emacs (workaround), BBEdit/TextWrangler (v. 11 only, instructions), Geany (Windows), Brackets (with this plugin), gVim (Windows workaround), Chocolat, IDLE, CLion (2016.2+, instructions), KDevelop 4, Cloud9 (instructions), Monkey Studio IDE, Coda 2, CodeLite, Eclipse (macOS 4.7+, Linux), elementary Code, Geany (macOS), gEdit / Pluma, GNOME Builder, GoormIDE (instructions), IntelliJ IDEA (2016.2+, instructions), Kate, KWrite, KDevelop 5+, Komodo, Leafpad, LibreOffice, LightTable (instructions), LINQPad, MacVim 7.4 or newer (instructions), Mancy, Meld, Mousepad, NeoVim-gtk, NetBeans, Notepad (Windows), Notepad++ (with a workaround), Notepad3 (instructions), PhpStorm (2016.2+, instructions), PyCharm (2016.2+, instructions), QtCreator, Rider, RStudio (instructions), RubyMine (2016.2+, instructions), Scratch, Scribus (1.5.3+), SublimeText (3146+), Spyder IDE (only with Qt5), SuperCollider 3, TextAdept (Linux, macOS), TextEdit, TextMate 2, VimR (instructions), Visual Studio (2015+, instructions), 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, ### Browser support

<!-- HTML -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/tonsky/FiraCode@1.207/distr/fira_code.css">
/* CSS */
@import url(https://cdn.jsdelivr.net/gh/tonsky/FiraCode@1.207/distr/fira_code.css);
/* Specify in CSS */
code { font-family: 'Fira Code', monospace; }

@supports (font-variation-settings: normal) {
  code { font-family: 'Fira Code VF', monospace; }
}
  • IE 10+, Edge Legacy: enable with font-feature-settings: "calt";
  • Firefox
  • Safari
  • Chromium-based browsers (Chrome, Opera)
  • ACE
  • CodeMirror (enable with font-variant-ligatures: contextual;)

Projects using Fira Code

Alternatives

Other monospaced fonts with ligatures:

Building Fira Code locally

In case you want to alter FiraCode.glyphs and build OTF/TTF/WOFF files yourself, this is setup I use on macOS:

# install all required build tools
./script/bootstrap

# build the font files
./script/build

# install OTFs to ~/Library/Fonts
./script/install

Credits

去到頂部