ad by General Assembly Los Angeles
I have to respectfully disagree with's answer here, just the part that proportional fonts can't line up at the beginning of indents. I actually think there's a strong case to be made for the advent of proportional fonts in programming, especially after David Jonathan Ross' work with .
Converse Adults Adults Unisex Unisex Unisex Converse Unisex Adults Converse Converse Converse Converse Converse Unisex Adults Adults Adults Unisex So, first I'll screenshot the example from Elynn's answer in Input:
As you can see, lining up indents can also be achieved with appropriately adjusting spacing.
The real place proportional fonts shine is in readability. These are the letters 'm' and 'n' in Source Code Pro, a popular monospaced programming font.
Here they are again in Input:
Notice the subtle difference here, this may not be much but it turns out our eyes are way better at detecting typos when they have the letter's width as a clue, e.g.
is easier to tell apart than
in a sea of code. So, spaces before the beginning of a line are not a problem inherent to proportional fonts and can be solved with variable spacing.
To quote Input's creator:
I realize that using proportional fonts in code is a tad experimental, and some will keep to Input’s 56 monospaced variants. Input’s proportional fonts, Sans and Serif, try to take what is best about the monospaced genre and fuse it with a font that lets each letter take up the space it needs. I use and combine them on my computer for everything from code to correspondence. While most user interface fonts are generic, Input has a distinct voice. And when some of Input’s earliest beta testers never realized they were coding in a proportional font, I knew I was onto something.
Personally, I've tested this and my error rate from typos has gone down significantly, enough to convince me to switch despite some awkwardness. The only downside of this is a convention where spaces are used after characters to line things up, such as a variable declaration like the following:
This could actually be fixed with a more subtle variable spacing algorithm. It doesn't bother me enough to move off Input because
Unisex Converse Converse Converse Adults Adults Unisex Adults Converse Converse Unisex Unisex Converse Adults Converse Unisex Adults Unisex Adults Overall, the jury's still out on what's globally better (I asked this question) but I thought I should make a case for proportional fonts.
But if you're someone like me who makes typos semi-regularly, I'd definitely recommend trying out a proportional programming font like Input and seeing what your before/after is. I also highly recommend reading this essay about Input --.
The main power of mono-space font, and anyone who uses mono-space text editors will know this. Is simply that the screen becomes a grid of characters, to me this is the strength. Everything lines up. Abhinav’s answer said that it its hard to distinguish “function” and “fumctiom” with monospaced fonts, but this is mostly true only if the first letter is aligned which is not always as easy with proportional fonts. The alignment is the power of monospace. Also editing multiple lines at once comes in handy very frequently and it looks wrong in anything but monospace. (alt+shift for notepad++)
But think about this what if the line was longer than a single word? Sometimes tables are useful as configuration containers. When everything lines up in a block it helps reduce errors, and allows visual comparison on the rows above and below.
Proportional fonts have their place, Honestly it would be nice to switch between them for different parts of code. But if I were to choose a default it would be monospace every time no exceptions. Expecially for C, C++, D, Java, Haskell… Python might be Ok, I would still use monospace. Mostly for aligning values in list or dictionaries.
And yeah I know Proportional fonts are the future, fancy, and a reoccurring fad in programming. There is power in the grid.
But I must say I do respect an answer that flows against conventional wisdom. So kudos to you.
People use monospace fonts because they can align the code using text directly, which is the only supported alignment in the code editor. So, if there's some other mechanisms can solve the alignment problem, then I think maybe they will try proportional fonts, and font foundries will also try to make some.