Why do Programmers use Monospace Fonts?

Programmers prefer monospace fonts, right? I know I did. I didn’t really consider using anything but - even though I had noticed that Bjarne found a proportional-width font was better for his book. Bjarne has had lots of great ideas, I thought, but also a number of peculiar ones and I figured this was one of those.
A few months ago I tried switching to Verdana in Visual Studio. And I must say that I am pleased so far. I haven’t yet missed monospacing and come to think of it, I don’t really have any good reasons for wanting it. Formatting, you say? Well indenting works just the same whether your font is monospace or not. The only formatting problem that could arise is with alignment of things like fancy comment “frames” which I don’t really use anyway (if you make lots of those, notice that you are probably putting too much code into one file - which makes you want to add distinguishable “headlines” that are easy to spot when scrolling through the file. You should probably split your code into more files or get a folding editor.)
Verdana is much more narrow that most monospace fonts, which means that the need for horizontal scrolling is less. This comes in handy especially in the build output where error messages can often grow long. And, I find that it is generally more pleasing to the eye.



4 Responses to “Why do Programmers use Monospace Fonts?”

  1. Ian Walker Says:

    A long time ago I managed to blag a copy of Fortran Powerstation from Microsoft. For free. Legitimately (really) Microsoft were discontinuing their support and so it was free. So I blagged it. I was then faced with the dilemma of the IDE - there wasn’t one. So I looked around to see what was at hand and lo! up popped Word. Yup, good ole MSWORD. It was easy to use macros to compile link and run my monospaced courier code. And then I got to thinking - I knew a lot about word, and knew how to use things such as styles, glossaries, TOCs, figures, tables and embedded objects… I never looked back, and even the current versions of VS etc cannot even get close to what I had with WORD and fortran/C++ etc.
    I had -styles, color coding, auto gen of docs

    monospaced fonts -hah VS and others are primitive!

    The only thing I haven’t got going properly yet is (and this should send *shivers* down your spine if you really think about it) is the grammar checker…

    cheers

  2. kristian Says:

    Ian,

    I have to admit that I am not sure whether this is some kind of Aprils Fool, but it does sound like it would allow for interesting IDE research. Using Code Browser, I often make meta-documents containing links and descritions of the code and I would love it if I was allowed to do simple formatting (bold/italics etc.) in there.

  3. Amit Patel Says:

    I used to use proportional fonts when programming, and people would peer at me suspiciously. One trick, if your spaces are too narrow, is to use syntax highlighting to make the leading spaces use courier or some other fixed width font, and use proportional fonts for the rest of the line. Continuation lines for multi-line statements don’t line up so well with proportional fonts (at least with Emacs), but other than that, things worked pretty well.

  4. nemo Says:

    Elastic tabstops solve the formatting problem and allow proprtional fonts to be used: http://nickgravgaard.com/elastictabstops/

Leave a Reply

-->