Reliance on mono-spaced font; tabular
formatting assumes that the editor
uses a fixed-width font. Most modern
code editors support proportional
fonts, and the programmer may prefer
to use a proportional font for
readability.

To be honest, I don't think I've ever met a programmer who preferred a proportional font. Nor can I think of any really good reasons for using them. Why would someone prefer a proportional font?

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
If this question can be reworded to fit the rules in the help center, please edit the question.

10

I like proportional fonts for reading, but I strictly use monospaced fonts for code. Always, always, always.
–
Frank SheararSep 20 '10 at 8:08

Many years ago, a prof I had in college half-jokingly said "... because it's not programming unless it's courier new."
–
Steve EversNov 18 '10 at 15:58

8

My reason for using a proportional font is very simple. It’s not the 1980s anymore. We’ve moved on from character terminals. Newspapers, books and websites generally don’t use monospace fonts for reasons of readability. I think they have a point.
–
TimwiFeb 20 '11 at 0:07

12 Answers
12

Smalltalk environments like Pharo use proportional fonts and due to the language style it looks very good there. But in C-style languages like Go or others like Erlang or Python I prefer monospaced fonts.

I used to use a proportional font, mostly because I find punctuation is actually easier to differentiate, but over time I've given up because nobody else does it and everybody unconsciously assumes mono spaced fonts (as the wikipedia article mentions, trying to do tabular formatting, ascii art in comments and so on).

Plus, issues in Visual Studio, that Microsoft don't want to fix, basically make it impossible to use well-designed proportional fonts anyway.

Love your comment mini-battle with microsoft on that bug. And their cheery response which is basically "Hi! Thanks! Great to meet you! We're gonna do nothing. OK, thanks lovely to chat with you!" Just imagine if people acted like that in real life...
–
danioSep 20 '10 at 11:24

2

You get an upvote for sympathy, since, though I don't use a proportional-width font for some of the very reasons you cite, my inner typographer constantly yearns for proper editor support, in design and programming alike.
–
Jon PurdySep 20 '10 at 11:55

Weird, I was just thinking that punctuation is actually harder to differentiate (particularly full stops) because it takes up less space. I also remember that Notepad++ used Comic Sans MS on comments for the longest time.
–
DisgruntledGoatSep 22 '10 at 11:28

3

If you find punctuation hard to identify in a monospace font, there are other monospace fonts - it doesnt mean you need to use a proportional font.
–
rmxNov 18 '10 at 15:45

Exactly for better punctuation, I sometimes use EnvyCode A or B.
–
zanlokNov 1 '12 at 7:35

Checking page 5 of my Special Edition: proportional fonts are generally considered as better for text, using them allows fewer illogical line breaks, and most people get used to it. I find it easy to read. Stroustrup is presenting code here, not trying to create it, and that may make things different.
–
David ThornleyDec 30 '10 at 16:18

2

@David, yes, he is presenting code. But, it is presented for "reading" and the very question of fixed vs proportional is for "reading" code, IMHO.
–
NivasDec 30 '10 at 17:38

I didn't realise that the Ubuntu font had been released. I think it works well there.
–
Alan PearceNov 18 '10 at 15:34

+1 for showing me WenQuanYi Zen Hei Mono, that font is amazing. I’ll almost certainly use it in my thesis. Depends on how well it looks printed – on screen it looks amazing and doesn’t take a lot of horizontal place, which is very important in print.
–
Konrad RudolphJan 28 '11 at 22:09

3

Really, there's just one big fat point against proportional: you can't really align because nobody cares for elastic tabstops. Which is utterly odd, given how it benefits both the monospaced die-hards and those who actually prefer reading good-looking variable-width fonts. Come on, world! Elastic tabstops!
–
romkynsFeb 28 '12 at 10:30

2

@romkyns: Adopt an indent style that doesn't rely on lining up with other lines. Simple.
–
Zan LynxApr 9 '12 at 22:28

2

@ZanLynx I did, because I like proportional fonts more than I like vertical alignment at places other than the start of the line.
–
romkynsApr 11 '12 at 18:47

Personally I don't care. As long as you keep my tabs aligned and the font legible, I couldn't care less whether I use monospace, proportional, or some other off-the-wall spacing. Just don't start substituting my tabs with spaces, and you'll have no quarrel with me.

I fully agree. And with tabs (as opposed to hard-coded spaces) you can switch between monospace and proportional fonts and adjust the tab width accordingly. What I have yet to see, though, is an editor in which you can set the tab width in units of EMs.
–
August KarlstromSep 8 '12 at 11:37

I use a proportional font (Arial is the best I've found so far, Verdana a close runner-up) and honestly I'm still bemused that people use fixed width fonts; why would you want to sacrifice readability like that? I could understand if tabular formatting were desirable, but it isn't, since it creates a maintenance nightmare regardless of font.

I’m surprised you like Arial and Verdana. I find them a bit rough and unprofessional. Have you tried Calibri?
–
TimwiFeb 20 '11 at 0:05

1

I'm using 8pt Verdana. Long identifier names are easier to read. I can view 70 lines of code without scrolling and lines are much shorter, so the code is a narrow column, like in a newspaper. This enables me to split the editor's view into two vertical columns: I view the declaration in one view and write code in another. Also when debugging, the screen is full with debugging windows, the code view fits in the small space. Using proportional fonts is remove the desire to vertically align things and put ascii boxes of asterisks around the comments.
–
CalmariusFeb 27 '12 at 20:59

I see 147 lines of code in Visual Studio on a 1920x1200 monitor rotated 90° for a portrait mode, using with Lucida Console font.
–
zanlokNov 1 '12 at 23:03

There is a reason which makes it practically impossible to use fonts other than monospace for coding, but was not mentioned in other answers: rectangular selections.

This feature, often not very useful and not very known when working with ordinary text, is essential for developers. You may imagine a multitude of scenarios: removing // comments on several lines, adding parenthesis or other characters, etc. This is even more valuable with advanced support of rectangular selections, as in Visual Studio 2010, where you can not only select and remove text, but select and replace it.

In this legacy code, I want to replace in-code rating by a method which will load my rating from Stack Exchange websites themselves, being able to always have an up-to-date data. I started to refactor the MyReputation property, and now I want to remove the initialization, in scope. Imagine that I have not four, but all 84 SE websites.

Here's what happens when using Consolas, a monospace font. I press Backspace, and that's all, I can spend the remaining time to do something actually useful.

Excellent point. I rarely ever use rectangles, but when I do, they're indispensable.
–
Jason BakerOct 2 '11 at 16:49

Have you actually tried it? It works perfectly well with a proportional font in Visual Studio 2010.
–
romkynsFeb 28 '12 at 10:27

2

This happened because you used spacing that happened to match the monspace font. If you had proper spacing w/r/t the proportional font, you wouldn't have this problem.
–
KosApr 11 '12 at 19:30

2

Eclipse actually supports using a different font for rectangular select mode, which makes this less of a problem.
–
NicholasAug 19 '12 at 17:11

1

@Kos RE: "proper spacing w/r/t the proportional font": But then if a different programmer uses a different font on the same file, it won't line up. If all editors use monospace fonts, it'll always line up (assuming the code doesn't abuse tabs for alignment).
–
Max NanasyAug 22 '14 at 1:01

I'm interested to know what environment this is a problem for you. You can use tabs with both proportional and fixed width fonts to line them up in columns. Where the issue arises is if you use spaces instead of tabs.
–
temptarFeb 28 '12 at 13:48

@temptar: consider "iii12345", "AAA12345" and "nnn12354" one above each other. The mistake ("345") is much easier to spot. you can't put tabs in the middle of a value.
–
Adam MatanFeb 28 '12 at 13:58

@temptar Tabs are not recommended by Python, and their width varies in different editors, which might lead to misaligned code.
–
Adam MatanFeb 29 '12 at 8:56

1

@Adam Matan Which is exactly why you shouldn't do fancy formatting.
–
August KarlstromSep 8 '12 at 11:42

I spent some time finding a good, readable font for Eclipse a while back, and under XP I used Verdana for quite some time. Consolas settled that because it is truly superb for programming.

These are my findings:

Most proportional fonts are designed for prose and only little punctuation (which in turn is usually one or rarely two characters). The C family of languages have lots of punctuation, which simply does not - in my opinion - look good and is harder to read than necessary.

Variable length characters mean that the length of lines vary. This makes it close to impossible to guess where the cursor will end when navigating using arrow buttons. I found this annoying.

Vertical spacing matters too. This is normally not something that can be overridden easily, and most proportional fonts have less room between the lines than I'd like.

Very few IDE's are tested with proportional fonts. This makes room for subtle bugs like putting the cursor in the wrong location, incorrectly repainting characters, and the like.

Hence I found that it was not worth the trouble for me.

Note on alignment and other layouts: I have set Eclipse to auto-format each file on every save, so all fancy layouts are automatically reset. Eclipse uses tabs instead of multiple spaces and these can be positioned correctly even with proportional fonts. Hence formatter layouts can be over one another, but we use the standard formatter configuration which does not have that.

I believe that the enforcement of automatic formatting for everyone on every save minimizes the false positives in the source control system, when doing forensic analysis.

While I do feel that proportional fonts are prettier, in some of them, especially sans-serif fonts, its impossible to see the difference between an "I" and an "l". Wait, what did I name that variable again?

Verdana has serifs on I for easier differentiation.
–
CalmariusJul 25 '12 at 19:40

0 and O is another major problem. Also ' vs ` and . vs , as well. Sometimes & and $ are a problem (worrisome in perl/php) However, Verdana is good for most of the above although not great at 0s. Sadly, on existing projects with tabs mixed with evil spaces, I usually give up and use Lucida Console. If you're asking about variable naming, though, you're not using modern code completion or at least copy/paste like you should.
–
zanlokNov 1 '12 at 7:47