There are instances where font matters, and I go back to TurboC on my 8086 and Fortran 'scards' on a VMS mainframe + terminal, so I'm not a whiny mod-crazy hipster.
> Fonts Creating Bugs:
Some fonts are more prone to errors. Lower case L vs number one, zero vs. capital O, braces vs parens, lowercase g vs 9. Go look at old Unix fixed fonts, and even courier and you can see how hard it is to distinguish. (Unix '10x7' was my favorite until horz resolutions crossed the 1600px.)
> Readabilty vs. Coding Style causing (literal) Headaches:
Staring at code 10+ hours a day, eyes fatigue. Some fonts are noisier than others, some fonts read faster than others, some fonts have more space than others.
And, if the coding style of the person you are reading does not use spaces between '=' or '()', or ample newlines, Courier can be a very taxing font due to all the serifs.
Lucida Mono provides a nice way out of this, but not all systems have it. Consolas solved the problem for a very long time.
> Ligature Bling
The addition of ligatures is mostly bling. I tried Firas cuz the => glyphs were nifty, but ultimately a big fat triple equals looks worse than '===' and I'd rather not waste time tweaking my goddamn font!
> Proportional
What kind of savage codes with a proportional font?
> Portability
I switched to Consolas because I can use it on Vi on macOS, Win, and *nix, and it saves my eyes from dense programming style.
> What kind of savage codes with a proportional font?
I did for some time. I only switched back because our coding standard limits the length of a line and that is hard to check with a proportional font.
I honestly don't get why source code needs a fixed character grid.
My prefered code formatting doesn't require lining up things using spaces in the middle of the line. If things need to be lined up, then I put them in the beginning of the line with the apropriate indentation. This way anyone can choose any font they like and make use of the increased readability of proportional fonts.
I honestly don't get why source code needs a fixed character grid.
> Alignment of blocks and assignments. It's that simple.
The benefits from the increased legibility and clarity can be quite tangible. Code that is the same looks the same, and it's easier to scan for anomalies.
> What kind of savage codes with a proportional font?
I have, for more than a decade. Why do you call me a savage? ;-)
I know you're kidding, of course, but now you owe me (and yourself) a favor.
Go to the linked test page. Pick a color theme you like, change the language if you want and leave the other settings alone. Now do some reading and editing in the source code box.
Don't worry about whether you like or dislike this particular font, Input Sans. I'm not much of a fan of it [1], but it will serve to make the point.
Does the code look OK and editing it works OK?
Now switch the font to Input Mono and take another look. Switch back and forth between Sans and Mono a few times to compare.
(Skip Input Serif for this comparison as it's a rather different style of font. The cursor keys are handy here: click on Input Sans and then use the up arrow to go directly to Input Mono, and down arrow to go back to Input Sans.)
To my eyes the code looks pretty similar in the Sans and Mono variants, how about you?
But Input Sans is a proportional font, not monospaced!
As stkdump noted, proportional fonts only break down if you use column alignment. Take this line in the Python code for example:
The parameters will line up only if you're using a monospaced font. In a proportional font the last two parameters will appear to be shifted to the left.
But you don't have to do it that way! This kind of column alignment has many disadvantages even in a monospaced font. (What if you rename the function or output variable?) Like stkdump, I would use indentation here:
Now you don't have to re-align if you change those names, and the code will be perfectly readable in any font, proportional or monospaced.
Don't get me wrong, I'm not trying to persuade you to start using proportional fonts. I am hoping to persuade you and other developers to be more tolerant of those of us who like proportional fonts, and to avoid column aligned coding styles regardless of the font you prefer. Fair enough?
[1] My favorite coding font right now is Trebuchet MS. It renders beautifully on high-DPI displays, much nicer to my eyes than Input Sans, and it has easy-to-distinguish glyphs for the common mixups like Il|. It does have a wimpy tilde, so I used a font editor to copy in a better tilde from another font.
No need to realign manually after renaming variables, we are programmers after all. Use a beautifier for your code. Wrote my first one in STOS Basic on the Atari when I was tired of forced line numbering and wanted to code with function names instead of Gosub 950.
Now the beautifier is often already built into the editor.
I get a lot like this:
$data = array(
'a' => 5,
'boom' => 25,
)
And having the values nicely aligned makes it much easier to read when it's 15 variables in that array.
> Fonts Creating Bugs:
Some fonts are more prone to errors. Lower case L vs number one, zero vs. capital O, braces vs parens, lowercase g vs 9. Go look at old Unix fixed fonts, and even courier and you can see how hard it is to distinguish. (Unix '10x7' was my favorite until horz resolutions crossed the 1600px.)
> Readabilty vs. Coding Style causing (literal) Headaches:
Staring at code 10+ hours a day, eyes fatigue. Some fonts are noisier than others, some fonts read faster than others, some fonts have more space than others.
And, if the coding style of the person you are reading does not use spaces between '=' or '()', or ample newlines, Courier can be a very taxing font due to all the serifs.
Lucida Mono provides a nice way out of this, but not all systems have it. Consolas solved the problem for a very long time.
> Ligature Bling
The addition of ligatures is mostly bling. I tried Firas cuz the => glyphs were nifty, but ultimately a big fat triple equals looks worse than '===' and I'd rather not waste time tweaking my goddamn font!
> Proportional
What kind of savage codes with a proportional font?
> Portability
I switched to Consolas because I can use it on Vi on macOS, Win, and *nix, and it saves my eyes from dense programming style.