FiraCode: Free monospaced font with programming ligatures
github.com
github.com
I don't like ligatures either, but I think that this depends on the editor. For example, if typing Rust in IntelliJ, if you type `Box<Box<String>>`, it will show two regular ">" characters. But if you type `x >= 3`, it will replace it with a single glyph.
I would be very surprised if the editor enabled and disabled ligatures in sections of code based on information from a proper parser...
I've tried both Fira Mono and Jetbrains Mono, it seems to barely get the two glyphs closers. Below are screen captures of Jetbrains Mono.
With ligatures: https://ibb.co/vQ3nCsd
without ligatures: https://ibb.co/DtD1P9X
But, to your point, it would seem it doesn't enable ligatures based on the parser, since there is a difference between ligatures active and disabled, and it applies on both lines.
Luckily we can each have our own way and still work on the same code.
Agreed. Looks very nice in editor, but programming is not about looks. It's about ease of editing and maintainability.
What if ligatures makes it easier to edit and maintain?
I assume you only use light mode and the system fixed font for your programming?
However.
If ligatures were turned on by default, I would turn them off.
Same reason one uses spaces over tabs, except in Makefiles because someone decided tabs are mandatory. With spaces copying the code from one place to another doesn't change the indentation too much.
I'm sure I would get used to it after a while, but right now I'm having trouble even reading the examples. I don't need my editor to be too special.
Some PR tools let you select your font. I think more should.
For one example on the web today, you can use github.dev (shortcut '.' on the github.com page for the PR) to open GitHub PRs in the web version of VS Code, which will Settings Sync, including font choice, with your regular VS Code profile. (Though, of course, that uses the GitHub Issues and Pull Requests extension to provide PR tools, and you can also just install that same extension locally into VS Code and never visit the web in the first place and just use VS Code for PR reviews if you like.)
If you prefer a more traditional git-based dotfiles sync, github.dev and GitHub Code Spaces will also look for a public or private repo under your account called dotfiles.
I don't think vscode.dev has a way to provide a dotfiles repo, though, and I think it only supports the cloud sync. (vscode.dev is the other web hosted VS Code like github.dev but for other generic things like its Theme Playground and a subset of github.dev functionality for Azure Repos missing things like PR review support because there is no equivalent extension to GitHub Issues and Pull Requests for Azure Repos.)
I do have dotfiles repo but no VSCode stuff there, and no Microsoft account, might explain why I never got past the "setting up your web editor" screen when I tried the '.' shortcut.
It was also just one example I knew of where code review tools were getting more respectful of user preferences. I stated pretty plainly that I wish a lot more tools were doing that beyond the examples that I knew. I'd love to see more font options in code review tools.
I don't know about Gitlab and the last I used Slack I had wished it had font options because I hated whatever fonts they chose that they thought aligned best with their brand. Mailing lists are actually an easy answer: use a mail client that happily lets you switch an email's fonts. (I used to do that when reading code in mailing lists in Thunderbird to switch from the default proportional fonts of email to a monotype font and back. I assume Thunderbird still has features like that, but it has been forever since I've personally been on a mailing list involving code reviewing.)
You're missing my point, I don't want to have to set a special font for everything I use. Simplicity and minimalism is my way. Not VSCode + Microsoft account + github.dev, I have no use for either. I could do it in my current tools, until a client uses something else, and I would have to set it up again. Or maybe I'm in a VM, not logged into github.com and reading some repository.
I respect that people use it, but it's really not for me. It makes the code harder to read IMO
It reminds me of the debates about font antialiasing back in the 1990s. A vocal minority of programmers then insisted that font antialiasing wasn't suitable for coding, as a pixel-oriented monospace font (e.g. Monaco at 9 points) provided better text density and better readability[1].
Then, like now, I could see the validity of the arguments of both sides. Readability is a highly subjective thing (and also varies over time, even for the same person). And the screens and antialiasing algorithms of the day weren't as sophisticated as what we now enjoy.
Personally I waffled on it for a while, but now I always code with ligatures enabled in my main work (which is predominantly using TypeScript and Rust, so the default ligatures of these fonts make sense).
I suspect that the majority opinion will shift to using ligatures for coding (if it hasn't already) once that is the default experience of most editors with the default fonts, and it becomes something you have to turn off, rather than turn on.
[1]: This is an example of Monaco, although what they show as 12 point is how I remember 9-point looking... not sure if my memory is faulty or what, though, it was a long time ago. https://www.fontriver.com/font/monaco/
It's absolutely a personal preference thing, and I personally prefer it. At least for the languages that I typically work with. I could see it being annoying with certain languages.
Also kinda meta but I see three different font related links on the homepage right now? Just coincidence?
*opens comments*
*shakes head, closes tab*
Can we get slashed 7s too? Maybe even slashed Zs.
I would like to learn how most people decide on choosing a monospace font for their code editor and terminal. Is it pure choice based on looks? Or some other things are considered?
But fwiw, there is this game-ified tool to choose fonts: https://www.codingfont.com/
[1] And if ligatures are designed independently from ordinary glyphs, there is no reason to make them default.
I think it’s because operators like != are actually considered a singular symbol not two characters. We just don’t have that many available keys so we use multiple characters. But in my mind it’s a single symbol and ligatures go a long way to help my brain parse it that way
> Your eye spends a non-zero amount of energy to scan, parse and join multiple characters into a single logical one.
I don’t know how many calories are expended by the brain to perform this, but it has to be near-negligible.
I am _extremely_ used to seeing characters as they are in ASCII, and retraining myself for some infinitesimal savings in visual processing seems like a net negative.
Maybe this is useful if you grew up with them? By all means do whatever you want for your own env.
As for the brain, the brain doesn't see characters at the perceptual level, that it then needs to join at the cognitive level into tokens. At the perceptual level it just sees shapes. Whether it takes more energy to parse != or ≠ is something I don't anyone has ever researched.
One could argue that that is already part of the character detection/interpretation process.
Ever wonder why you can't really seem to read properly when you're hungry and tired? That part of your brain is in power-saving mode.
Is the implication that with FiraCode, the eye will finally spend zero energy on scanning, parsing and joining glyphs? Finally, after all these years, a perpetual motion machine! :-)
There’s the reason. It’s different than what you’ve been seeing most days of the last X years
Cascadia Code (introduced with MS Terminal, aka Caskaydia) is also a very great typeface as well.
I like Fira Code slightly more though... especially as a terminal font, I use the fork with extra nerd font characters linked from starship.rs[1][2]
1. https://starship.rs/presets/nerd-font.html 2. https://www.nerdfonts.com/font-downloads
It has a more stylized look than your typical coding font, and I don't use it all the time, but I enjoy swapping it in when Source Code Pro starts to feel a bit boring.
One (minor) language that does have quite a lot of support is Rakudo which allows both unicode and ascii equivalents for many operators. https://docs.raku.org/language/unicode_ascii
Edit: There is annoying popup, but click away from it and you can do the thing.
My favorite coding font is the Go font. It’s very readable and brutally simple.
I use comic mono and I absolutely love it.
I like to use Monokai/Molokai and joke with my colleagues that I'm using "clown colours"
I’ll admit I prefer ligatures while working with ML syntax and Lisps, they feel a little wrong(?) when working with C style languages. Is anyone aware of a way to toggle them on a per language basis in vs code?
"[c]": {
"editor.fontLigatures": true
},- [1] https://input.djr.com/ - [2] https://github.com/ToxicFrog/Ligaturizer
I’ve been code using Input Sans a (gasp!) proportional coding font for years now and I love it. Input also comes in a monospaced version FWIW.
a = 1
ab = 2
abc = 3
Guess what, this is equally readable a = 1
ab = 2
abc = 3
and some code formatters yield this anyway (eg: Elixir's, if I remember well.)It's a very good exchange: a little feature to miss, much more readable code.
I gave a try to Input but it was not OK for me. I can't remember the details. I'm giving a try to Sweden Sans, from yesterday's HN.
I used to use all the column alignment tricks like the one you showed, and stuff like this:
do_something_special(first_argument,
second_argument,
third_argument);
Then one day I renamed a function and the length of its name changed, and I had to go through all the code and line things back up again.So I abandoned this kind of column alignment completely and switched to a purely indentation-based format:
do_something_special(
first_argument,
second_argument,
third_argument
);
(Assume for the sake of discussion that those arguments are long enough that they need to be on separate lines.)That's when the proverbial light went on. I thought, "since I'm not using column alignment any more, why not try a proportional font?"
I did just that, and never looked back. If you're not doing column alignment, proportional fonts work just fine.
Where I currently work, most of our code is in Python. We used to use the YAPF formatter with Google's settings that are full of column alignment. Last year we switched to Black, and I noticed something interesting.
Black-formatted code does not use column alignment at all. It uses only indentation, as in your second example and my second example. So it is just as readable in a proportional font as in monospaced!
My current coding font is something I call Trebuchet++. It's based on Trebuchet MS, but with a few customizations that I like for code: a better tilde glyph (the one in Trebuchet MS look too much like a hyphen), a little extra space before and after a dot, and a sneaky trick to make names_with_underscores more readable: I reduced the width that the underscore takes up but extended the underscore below the text before and after it. These last two adjustments fix a problem with stuff like foo_bar_baz.moo_mar_maz() where the underscores are wider than the dot, creating the wrong visual grouping.
I wish I could publish Trebuchet++, but it is based on a copyrighted MS font. Maybe I will contact them to see if they could give their blessing to this "derived work".
In the meantime, if you or anyone reading wants to have a look at it, my email is in my profile and I can send you a copy "on the sly". :-)
I have a couple of other improvements in mind. One is to add a bit of spacing inside parentheses, curly braces, and square brackets, but I'm pretty happy with the font as it is so far.
Call me basic, but I love it. :)
Also on the list of things people hate… victor mono has joined-up italics! Which I also love. :)
In the end, they don't make that much of a difference other than being a small source of aesthethic pleasure. zero impact on supposed readability
IMHO coding really needs a simple monospaced font. I use Input Mpno with a slightly squashed horizontal spacing, and an almost overlapping vertical spacing.
Ligatures are just presentational so they don’t impair editing. If you ever try them again and use VSCode, you might like the Disable Ligatures that dynamically disables them for the selected line or cursor position.
https://marketplace.visualstudio.com/items?itemName=Coenraad...
I just wish Fira Code had an Extra Light option, sometimes, depending on the terminal/OS I find Fira Code too chunky.
https://github.com/be5invis/Iosevka/blob/main/doc/stylistic-...
Anything new here?
[citation needed]
The font looks good but I find it really hard to read C code with the ligated symbols.
And it looks like I am not alone: https://practicaltypography.com/ligatures-in-programming-fon...
Personally, I'd love to do my coding without a mono-spaced font but most of the world keeps space-aligning things, so that's not going to work unfortunately.
Of course, you don't have to use ligatures, no-one is suggesting we make them compulsory
- if a ligature looks just like a grapheme of another character, why not use that character? why the replacement is done at font level???
- using ligature across morpheme or token boundary is rude typesetting. e.g "selfish" or "c<int>=1;"
Other than that, I do not have anything against ligatures that enhance legibility of text (what they are meant to accomplish)