Hacker News new | past | comments | ask | show | jobs | submit login
Fira Code: monospaced font with programming ligatures (github.com/tonsky)
97 points by vdaniuk on Dec 19, 2015 | hide | past | favorite | 81 comments



As a developer, I have spent years writing and learning to parse the meaning of sequences like ==, ===, <=, ~=, and so on. For nearly all of us, the ligatures in this font are completely new. I think it's a creative and interesting idea, but it means re-training my brain to recognize them, which would take time.

And even if I could get my preferred editors to work with it, I would see the traditional symbols when reading code on the web, or pairing with another developer who does not use the font. It seems like a barrier to understanding, something that by nature developers strive to eliminate.

I'm torn. This idea could be something that changes how we all express code symbolically, or it will just become a fad that a tiny percentage of developers will insist on using, to the frustration of everyone else.


> ..developers will insist on using, to the frustration of everyone else.

I'm thinking It won't change the underlying text so I imagine it will only apply to the individual developer choosing to apply these ligatures on their display, as such should have little effect on other devs. Unless you mean to say people might start to use this in documentation and code examples, in which case this is indeed an interesting thing to consider.


Let’s be realistic. You don’t have learn or retrain your brain to understand Fira Code. Symbols are all the same, they just look better.


The difference between e.g. -> and --> is a length of a small solid line. To me that's equates to a huge drop in readability, countering the easy to brain-parse argument.


Agree, but no language uses both -> and -->


Nope. Fira gets semiotics subtly wrong.

For instance, the HTML comment bookends. In Fira, they are long arrows. In plain ASCII they are enclosing brackets connecting to comment.


that looks amazing, but I kinda wish that certain ligatures were optional (which they might be, need to look at the CSS docs again for atom)

I (personally) don't exactly want == to look too similar to a single =, after all!


They don't. The == variant is has double the width.


I am aware, I still find them too similar for my likings


Have you tried the font? = and == has 3× difference in width, it’s hard to mistake one for another. I’m using Fira Code for a year now, never had mixed them up


At least for me, monospaced fonts are very helpful for looking at column specific features. == and === are row specific, so seeing the delimiters between them makes them easier to parse on a row level for me.


`===` is triple stroked in these fonts, but that is probably not enough for you. Just saying though! :)


Thanks for pointing that out, I didn't notice! I think that I could get used to that.


I upvoted your post on account of the dry humour.


> I (personally) don't exactly want == to look too similar to a single =, after all!

Me, either!

Amusingly (irritatingly?), /== has separation between the = characters. :/

I... have no idea why ~= turns into ~-on-top-of-= and =~ into =-on-top-of-~ . Some of these glyphs just seem ill-advised. :(


tilde-equals is the "inequal" operator in Lua, so I suppose that makes some degree of sense. Then again, the equals-tilde makes zero sense.


Escape using zero-width space character to break up the ligatures ...


"Your eye spends non-zero amount of energy to scan, parse and join multiple characters into a single logical one."

citation needed


The brain is very good at turning complicated features in to abstract concepts. In fact that is mostly what some parts do. So, not clear if this actually improves things or not.

For example, the == and === look quite a bit similar in the font. You have to compare relative sizes, whereas with the normal fonts you can count the spaces.

The rest of the ligatures look pretty cool!


You probably mean = and ==. They have 3× difference in width, which, in practice (I’m using Fira Code for a year now), is more than enough to tell the difference.

Regarding the difference between == and ===, latter has three lines (and so does !==), so in fact in Fira Code === and !== the looks implies the meaning, whether in other cases you have to bend your mind to accept that negation of “three equals” is a “two equals and a bang”


I'm not sure why this has to be done in the font. Vim has support for conceal characters, which can "conceal" syntactic constructs into other characters, i.e., any Unicode code point. This works out pretty well in LaTeX documents for example, because you can see the mathematical symbols. [1]

One gripe I have though is that columns become misaligned when you have concealed characters or ligatures. In the source, \alpha is 6 columns and \beta is 5. Displayed, α and β are both 1 column. This messes up things like visual block insert mode, because the location of that column in the source and what's being displayed might differ. Should you line up the displayed version and make it look nice for you and those with the same plugin, or don't you?

[1]: https://github.com/vim-pandoc/vim-pandoc


I have been using Fira Code font with Atom for some time and I am absolutely in love with the aesthetics. All credit and praise goes to http://tonsky.me/



= vs == vs === seems like a sure way to have bugs.


My thoughts exactly. Probably depends on the person but I am certainly the type who would have trouble detecting the difference.


Just give it a try. There’s 3× difference in width, so _in practice_ you won’t mistake them, ever. I’m using that font for a year now, not a single case of misreading


The use of triple bars for === strongly distinguishes it visually from the two bars of ==, which is a nice touch.


After so many years, there's still no better coding font than MS Consolas. I use it everywhere (where by "everywhere" I mean Linux and OSX, since I don't use any MS products other than this font).



When it comes to my eyesight, why settle for anything but the best? Consolas is free as in beer to use. I just checked it into my dotfiles which I clone to all my machines.


I would rather put it “free as in torrents”. Microsoft https://www.microsoft.com/typography/fonts/family.aspx?FID=3... offers to buy it for €129


Maybe that's what it is now, but there was a window of time when Microsoft offered it as a free download off MSDN to anyone who wants it. That's when I got my copy.


This is really cool, but I must be getting old, because I find it particularly difficult to parse.


My vision is not 100% and when I code for a few hours my eyes get tired and it gets even worse. Fira Code helps! Thank you, tonsky <3


So happy to hear that!


I feel that if you hide the text you need to type to insert a symbol, learning a new language might be hard.

For instance, some languages use != and others use ~=. If both of those look the same, you're going to have one hell of a time learning a language.


I'm trying out Atom, and ligatures in Erlang don't always render. For example, -> in the head of a function clause doesn't render as a ligature, while inside the function body it does.

EDIT: In developer mode I can see the -> is being rendered as two single character <span>s when in the head of the function. The solution is probably to fix it in the grammar definition: https://github.com/jonathanmarvens/atom-language-erlang/blob...


I found the same thing, in Ruby -> was split up, while in Swift it was fine.


So, neither Emacs, nor vim (and none of it's gui variations) are supported.


I'm finding it works fine in OS X's Terminal.app and (by extension) emacs and vim (El Capitan 10.11).


Good news.

What about standalone (not terminal-based) Emacs on OSX?



Also, just got report that MacVim supports ligatures in latest version


I tried using ligatured when Pragmata added them, but the issues made me return to the normal version.

If you use your editor for multiple languages and documentation as well, you may find things like lines in comment blocks made of '%', '#', or '-' to break from the ligatures. Also if your doc markup(-down) uses underlines of '-' or '=' for headings, they are affected.

On Windows, I found some editors where the ligatures were enabled, some where they weren't, and not many where you had any option to toggle either way.


Really cool, but what, if any, are the plans to get it working with Vim? It's the universal editor you're likely to find everywhere.


Vim isn't there problem, it's your terminal. There is an open feature request with iterm2, but terminal.app is probably a lost cause. I know nothing about the state of Unicode font rendering in Linux.


Strangely enough, I had Terminal.app listed as not supported (at it wasn’t when I checked).

But checking now, ligatures render just fine. Yay! (that implies console vim & emacs, of course)


It works fine under konsole 15.08.


Konsole is the only terminal emulator I could get it working with, which is annoying because I much prefer rxvt. Konsole does weird stuff with my terminal colors in tmux, so I ended up not being able to use this nice font when I tried it previously.


Have you tried urxvt, by any chance?


Tried to get it at least readable for 15 mins or so and gave up: http://paste.click/msFBVy

Tried all kinds of variations of

    > fnt="xft:Fira code:pixelsize=10:size=15"; urxvt -fn "$fnt" -fb "$fnt" -fi "$fnt" -fbi "$fnt" -letsp -1
Can't get the font spacing to not be massive and the ligatures don't work.

My build is:

    rxvt-unicode (urxvt) v9.21 - released: 2014-12-31
    options: perl,xft,styles,combining,blink,iso14755,unicode3,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,pixbuf,XIM,frills,selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm

Edit: Tried hasklig that was mentioned. Ligatures still don't work but the spacing is fine: http://paste.click/cEWQZs


By "rxvt" I meant rxvt-unicode/urxvt. I'm quite fond of it, but it doesn't support glyph ligatures.


What about gVim?


I love the ligatures (arrows and fat arrows in particular), but the @ sign is so jarringly strange. It distracts me every time


Probably not possible with ligatures/glyph variants but really cool would be grouping of numbers: In groups of three the first digit would be moved to the right and the last one to the left to simulate a narrow space as thousands separator.


It's a shame the C/C++ standards committee(s) didn't just copy Verilog's base-n notation when they added the "0b" prefix. It's nice to be able to write large constants with optional underscores every four or eight digits, e.g. 32'hffff_0867_5309_beef, or 12'b1101_1110_1010.


You can write 1'000'000 for a million in C++14. http://en.cppreference.com/w/cpp/language/integer_literal.

They didn't use underscores because _100_000 is a valid identifier in C/C++.

Arbitrary bases aren't there.


Neat, I didn't know they'd done something similar with single quotes. (No law said they had to allow constants to start with an underscore, of course...)


I suspect that it's possible, but would require an impractical number (1000) of ligatures in the font.


I wander if it would correctly draw:

  1 000 000
and not do:

  100 000 0
assuming its parsed left to right?


It’s possible with classes https://medium.com/@larsenwork/class-based-contextual-positi...

And assume we only support 4-10 digit numbers, it would require e.g. 6 rules or so.

But substitutions are done left-to-right, that might be a problem


Probably a silly question, but can't we just generate ttf files from this so that you can use it in any windows editor?


I think the relevant issue is whether the editor can render the OpenType ligatures (well, contextual alternates) contained in the font.

You _could_ convert to .ttf, changing the curves to TrueType-style quadratics, but they'd still have to have the OpenType substitution tables for the "ligatures" to work, and I don't think that would really improve compatibility much, if at all.


Are there any problems with installing otf on windows? I installed and used them just fine


See I knew it was a silly question :) A few minutes ago I converted the otf files to ttf using font forge. That appeared to work, but it seems the ligatures are gone. On top of that the ttf version of the font did not show up as a monospaced font in my code editor. I might have done something wrong though as I only dabble a bit with font forge.

Then I just did what you suggested, install the otf instead (d'oh) Now the fonts do show up as monospaced font. But my editor does not display the ligatures. But at least it is usable.


What editor do you use? Is it listed as supported here? https://github.com/tonsky/FiraCode#editor-support


No, it is an editor called "the hammer" [1]. As it is I am one of the developers of that editor. It is rather specialized and targets the programming language DataFlex. The editing component is based on the codemax component. While I have access to all the code, I'm not sure on how-to add ligatures support.

[1] http://vdf-guidance.com/The_Hammer.asp?Page=THEHAMMER


What software is typically used to create a font like this? Are there any good open source options?


Glyphs.app provided a free license for Fira Code since font is open-source. I’m using it because original Fira Mono is developed in it as well.

Monoid uses FontForge (free)


The readme says "Fira Code is now drawn and built in Glyps 2 app (should improve compatibility)."


On what planet does it make sense to release a programming font which explicitly refuses to support both vim and emacs?


Vim and emacs are terminal applications, thus it's down to the terminal emulator to support the font. Some terminal emulators do (eg Konsole). However many do not.

Frankly, I'm amazed at the number of programmers who have made the complaint about vim and emacs support since writing terminal applications (ie stuff that prints to STDOUT) is basically programming 101. It should be pretty obvious to any programmer where the support is required.


Emacs is a graphical application to me. That's the default behaviour, how I use it, and what I see people doing things like screencasts use.


That's not emacs then, it's a Cocoa / Win32 / whatever port of emacs. Unless your talking about "graphical" in the same sense that ncurses is. But either way, emacs default behaviour is a terminal application.


GNU Emacs 24.3.1

Copyright (C) 2013 Free Software Foundation, Inc.

`emacs` launches a graphical window.

Any objections?


I just installed GNU Emacs on my PC and it seems you're right. I swear that never used to be the case; or maybe I've only ever used emacs on headless servers so it defaulted to the terminal renderer? Weird - but sorry for arguing with you on that point.


:-) I guess even ancient 80s (?) software keeps with the times to some degree. Notwithstanding all the idiosyncratic (in our environment) defaults for ergonomics and terminology..


The ligatures don't work because lots of editors don't bother to use text rendering that supports ligatures. It's an interesting perspective to blame that on the font.


On what planet people still use teletype emulators to edit code?


Exactly. However I see now that there's an Emacs workaround... maybe I'll try that some time.


I think you've got that backwards.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: