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代码的项目
替代
其他带有连字的等宽字体:
- Hasklig (免费)
- PragmataPro (€59)
- Monoid (免费)
- Fixedsys Excelsior (免费)
- Iosevka (免费)
- DejaVu Sans Code (免费)
本地构建 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
- 作者:Nikita Prokopov @nikitonsky
- 基于: Fira Mono
- 灵感来自: Hasklig