Input: Fonts for Code
input.fontbureau.com
input.fontbureau.com
It's a beautiful (but not free/open) font though.
(I’m not affiliated, just a big fan of the font).
These days I use Input fonts in Emacs, all terminals, and writing apps like Ulysses, also on iOS. Nothing else comes close in terms of readability.
I wish Input didn't remove ligatures from their latest release.
One day I spent an afternoon looking for a better coding font.
I liked Inconsolata. When I Googled to find out more about it, I learned it is a knock-off of something that was hiding right under my very nose: Consolas found on Windows boxes.
I tried that and found it better. I now have Consolas all over the place. I'm typing in it on Firefox. I have it in Ubuntu right inside Gnome terminal and other places.
Thank you, Microsoft!
I don't like the weird proprietary licence though. There are plenty of excellent free software fonts out there (e.g., Hack or its ancestor Deja Vu Sans Mono and sibling Ubuntu Mono — all three exist today because of the permissive licensing of their common ancestor Bitstream Vera).
https://twitter.com/rob_pike/status/567476552187641856
I much prefer reading proportional fonts. This new font solves a problem I've had: punctuation is hard to discern in proportional fonts. But I'll still have trouble with deeply-nested functions not lining up.
put = blah
get = blah
post = blah
patch = blah
gofmt accepts it as aligned, but the equals signs are visually unaligned when using a proportional font.I wonder what it would take to create an editing environment where you have a proportional font that shrinks or grows the (visual) whitespace to align those, and whether it could scale to things like nested functions.
The key to using proportional fonts is to stop using column alignment and use only indentation instead. There's an illustration of this in the rustfmt code I posted elsewhere in this thread.
And you're right, once you abandon column alignment, there's no longer any reason to prefer spaces over tabs, so you can take advantage of the other benefits of tabs.
Consider for any of these ideas (and the idea of various fonts) just how well it would work for the masses. Consider the mess if someone works on an open source project and checks in a bunch of code formatted for this.
Which is why I guess I'd see any kind of "fancy" spacing or even proportional fonts to be a real problem in an organization or structure where potentially many people, or new people over time, will have to work with the code.
This is one reason I don't use Go today. I am never going back to a column-aligned format that is hard to read in a proportional font, so I would have to avoid the use of gofmt, which would make me an outcast in the Go community.
Still doesn't solve the issue of having ASCII art diagrams in your comments. Though... the comment word wrap plugin I use for Visual Studio has markup to say that it should leave a section of the comment alone (I use this for ASCII art bits). And clang-format has similar directives for blocks of code that it should leave alone. Would be nice if text editors could recognise these (and other similar markup - or perhaps markup could even be standardized between tools?) and render the appropriate sections in a monospaced font. That might be a useful compromise.
This doesn't sound exactly like what that extension does, but it might be something good to look at to get some ideas. (Hopefully it's open source!)
Thanks!
One of its features is that you can pop comments sections in a <pre>...</pre> block to stop Comment Reflower doing anything to them. Here's an example, where you can see that the preformatted section extends past the wrap column.
// Watford DDFS reads by initiating a multi-sector read,
// counting sectors read, then doing this when it's got
// the data it wants:
//
// <pre>
// 0D43: ldy #$60 A=00 X=FF Y=60 S=DC P=nvdIzC (D=60)
// 0D45: dey A=00 X=FF Y=5F S=DC P=nvdIzC (D=D0)
// 0D46: bne $0D45 A=00 X=FF Y=5F S=DC P=nvdIzC (D=01)
// 0D48: lda #$D0 A=D0 X=FF Y=00 S=DC P=NvdIzC (D=D0)
// 0D4A: sta $FE84 A=D0 X=FF Y=00 S=DC P=NvdIzC (D=D0)
// </pre>
//
// The loop at D43 is $5f*(2+3)+(2+2)=$1df=479 cycles, or
// 240 usec.
So if you had a text editor that implemented my idea, the first and last paragraph would be in proportional type, and the disassembly bit in the middle would be shown in monospaced to preserve the formatting.(In the long run, ideally, I suppose, you'd want your code text editor to support a wide range of formatting options, so that you could have italics and bold and monospaced and all sorts. But if you just decided that initially a simple proportional/monospaced font switch would be useful, this is the sort of markup you could use to key the transition off.)
Even if this doesn't do exactly what I'm looking for, it will definitely help give me some ideas on how to do what I want. It is indeed open source, and it looks like VS2017 support was added a few months ago:
With one exception, it has easily distinguished punctuation and characters like 0Oo and 1lI|. The exception is that it has a rather poor tilde. One of these days I'll load it into a font editor and put in a better tilde.
Regarding deeply-nested functions not lining up, the solution there is to stop using column alignment and use indentation instead. As an example, the Rust team recently changed their style from this alignment-based format:
let mut rewrites = try_opt!(subexpr_list.iter()
.rev()
.map(|e| {
rewrite_chain_expr(e,
total_span,
context,
max_width,
indent)
})
.collect::<Option<Vec<_>>>());
to this indentation-based format: let mut rewrites = try_opt!(
subexpr_list
.iter()
.rev()
.map( |e| {
rewrite_chain_expr( e, total_span, context, max_width, indent )
})
.collect::<Option<Vec<_>>>()
);
Even if you use a monospaced font, the latter style is much more practical. For example, if the arguments to `rewrite_chain_expr` were longer in length, you would simply change it to: let mut rewrites = try_opt!(
subexpr_list
.iter()
.rev()
.map( |e| {
rewrite_chain_expr(
e,
total_span,
context,
max_width,
indent
)
})
.collect::<Option<Vec<_>>>()
);At least Linux seems to handle the multitude of visual weights decently these days; when Input first came out it seemed like Linux would pick one weight as Regular and one as Bold and every other weight was mapped to one of those two.