9 ms·
Fira Code: monospaced font with programming ligatures
- vdaniuk 11y agoI 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/ http://tonsky.me/
- tonsky 11y ago️
- RubyPinch 11y agothat 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!
- leonatan 11y agoThey don't. The == variant is has double the width.
- RubyPinch 11y agoI am aware, I still find them too similar for my likings
- tonsky 11y agoHave 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
- codezero 11y agoAt 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.
- to3m 11y agoI upvoted your post on account of the dry humour.
- simoncion 11y ago> 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. :(
- striking 11y agotilde-equals is the "inequal" operator in Lua, so I suppose that makes some degree of sense. Then again, the equals-tilde makes zero sense.
- mborch 11y agoEscape using zero-width space character to break up the ligatures ...
- yawaramin 11y agoReally 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.
- deleted 11y ago[deleted]
- wffurr 11y agoVim 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.
- baghira 11y agoIt works fine under konsole 15.08.
- gh02t 11y agoKonsole 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.
- endgame 11y agoHave you tried urxvt, by any chance?
- Tiksi 11y agoTried to get it at least readable for 15 mins or so and gave up: http://paste.click/msFBVy 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 http://paste.click/cEWQZs
- legulere 11y agoProbably 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.
- duskwuff 11y agoI suspect that it's possible, but would require an impractical number (1000) of ligatures in the font.
- samwillis 11y agoI wander if it would correctly draw: 1 000 000 and not do: 100 000 0 assuming its parsed left to right?
- tonsky 11y agoIt’s possible with classes https://medium.com/@larsenwork/class-based-contextual-positioning-in-monospaced-fonts-cb6b8b9ffe6f#.bmuw3a4xt 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
- CamperBob2 11y agoIt'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.
- Someone 11y agoYou can write 1'000'000 for a million in C++14. http://en.cppreference.com/w/cpp/language/integer_literal 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.
- tanyared 11y agoMy 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
- tonsky 11y agoSo happy to hear that!
- aw3c2 11y ago= vs == vs === seems like a sure way to have bugs.
- donatj 11y agoMy thoughts exactly. Probably depends on the person but I am certainly the type who would have trouble detecting the difference.
- tonsky 11y agoJust 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
- espadrine 11y agoThe use of triple bars for === strongly distinguishes it visually from the two bars of ==, which is a nice touch.
- epmatsw 11y agoI love the ligatures (arrows and fat arrows in particular), but the @ sign is so jarringly strange. It distracts me every time
- codezero 11y agoThis is really cool, but I must be getting old, because I find it particularly difficult to parse.
- wila 11y agoProbably a silly question, but can't we just generate ttf files from this so that you can use it in any windows editor?
- zerocrates 11y agoI 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.
- tonsky 11y agoAre there any problems with installing otf on windows? I installed and used them just fine
- wila 11y agoSee 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.
- tonsky 11y agoWhat editor do you use? Is it listed as supported here? https://github.com/tonsky/FiraCode#editor-support https://github.com/tonsky/FiraCode#editor-support
- wila 11y agoNo, 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 http://vdf-guidance.com/The_Hammer.asp?Page=THEHAMMER
- anentropic 11y ago"Your eye spends non-zero amount of energy to scan, parse and join multiple characters into a single logical one." citation needed
- ryanobjc 11y agoThe 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!
- tonsky 11y agoYou 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”
- chrissnell 11y agoWhat software is typically used to create a font like this? Are there any good open source options?
- melted 11y agoAfter 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).
- malnourish 11y agoDo you not like Inconsolata? https://www.google.com/fonts/specimen/Inconsolata https://www.google.com/fonts/specimen/Inconsolata
- melted 11y agoWhen 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.
- tonsky 11y agoI would rather put it “free as in torrents”. Microsoft https://www.microsoft.com/typography/fonts/family.aspx?FID=300 https://www.microsoft.com/typography/fonts/family.aspx?FID=3... offers to buy it for €129
- melted 11y agoMaybe 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.
- pekk 11y agoOn what planet does it make sense to release a programming font which explicitly refuses to support both vim and emacs?
- jumpwah 11y agoExactly. However I see now that there's an Emacs workaround... maybe I'll try that some time.
- ygra 11y agoThe 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.
- PhasmaFelis 11y agoI think you've got that backwards.
- laumars 11y agoVim 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.
- throwaway999888 11y agoEmacs 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.
- deleted 11y ago[deleted]
- laumars 11y ago
- foz 11y agoAs 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.
- evolve2k 11y ago> ..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.
- tonsky 11y agoLet’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.
- Terretta 11y agoNope. 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.
- lttlrck 11y agoThe 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.
- gravypod 11y agoI 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.
- z1mm32m4n 11y agoI'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 https://github.com/vim-pandoc/vim-pandoc
- Luc 11y agoI'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/master/grammars/erlang.cson https://github.com/jonathanmarvens/atom-language-erlang/blob...
- melloclello 11y agoI found the same thing, in Ruby -> was split up, while in Swift it was fine.
- golergka 11y agoSo, neither Emacs, nor vim (and none of it's gui variations) are supported.
- melloclello 11y agoI'm finding it works fine in OS X's Terminal.app and (by extension) emacs and vim (El Capitan 10.11).
- golergka 11y agoGood news. What about standalone (not terminal-based) Emacs on OSX?
- jibsen 11y agoI 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.