7

I want to experiment with all fonts, including those that aren't mono-spaced. I understand the reason for using monospaced fonts, but frankly they don't seem legitimate to me.

For instance, one reason to use monospaced fonts is so that code blocks line up perfectly in the editor. But why couldn't a grid simply be built up from the smallest character in the given font, or perhaps some unit that accomplishes this. It seems like a holdover from ASCII days. I've googled, but can't find much information about this.

Has anyone tried this before, or know of any projects that are trying to enable this? In particular I want to use the fonts in VIM and iTerm2 on OS X.

4
  • Sounds more like a OS X issue than a font or vim issue... Nov 15, 2011 at 8:06
  • Some monospaced fonts are proportional fonts that have been edited to look good when they are aligned in a grid. It is basically what you are asking for, but a designer has gone to the trouble of making it look nice in the end. I think monospaced fonts are fully legitimate ;^)
    – beroe
    Sep 24, 2013 at 21:54
  • 3
    For the record (and Googlers), this got a working answer over on Vi.SE: vi.stackexchange.com/a/707/2221
    – Robin
    Jun 11, 2015 at 1:47
  • Also horrible display on Ubuntu. For me, writing long but readable paragraphs such as in LaTeX or markdown would be more confortable with a non-monospace font. Jul 31, 2019 at 12:09

5 Answers 5

5

I've read a number of blog posts in the distant past written by people who actually preferred proportional fonts for their code. Usually, what they liked about that kind of font was their expressiveness but they invariably needed some very rich syntax highlighting and/or custom external tools to make it work and actually be able to read and understand their own code.

You don't read code like you read a text. One is mostly vertical, the other is mostly horizontal.

Like you know, monospaced fonts are designed against a grid so that each character takes up the same horizontal space as the others. Because of that we can align things and read and understand our code in discrete chunks without much brain work: everything is regular and predictable which is a necessity in our craft.

Because we tend to write short lines and the logical pieces of our source files are distributed vertically most of our eye movements are vertical, that's the natural flow of programming. Monospaced fonts facilitate such movements because things can be neatly aligned and we don't have to move our eyes too much.

Each individual glyph of a proportional font is designed with a different width and different default white space settings. Additionally, such fonts make heavy use of kerning (the adjustment of whitespace between glyphs) which is what actually makes text look good. Remove kerning and any proportional font (even the best ones like Frutiger or whatever) will look like ish. Individual glyphs will still be well drawn but they won't fit with each other anymore and create the distinct rhythm that makes them useful and agreeable.

Applying a grid to a text set in Helvetica Neue would result in uneven distribution of black/white and an unreadable mess because we would actually remove the most important feature of proportional fonts.

proportional fonts, are not designed for vertical flow at all. A lot of care is put in kerning to allow for the best possible horizontal rhythm but that kind of feature is totally unnecessary in the context of programming.

To finish, you can actually set Vim's font to some proportional font, here is how it looks with Helvetica Neue at 12 px:

Screenshot
    (Click images to enlarge)

and the same file with Inconsolata-dz at 12 px:

enter image description here

I guess these screenshots speak for themselves.

11
  • It would probably be a little less horrible if the anchor of the glyphs was at the bottom center instead of the bottom left. But still horrible. Nov 15, 2011 at 8:31
  • 1
    The antonym you're looking for is proportional font.
    – Andrew Vit
    Nov 15, 2011 at 10:28
  • 5
    I find myself more and more convinced that I would like to try proportional-width fonts. These screenshots merely demonstrate that vim makes a ham-fisted job of displaying them - it forces each character into a fixed-width box regardless. I'd be interested in seeing more relevant screenshots before making a judgement. When reading code, the only thing that needs to be aligned nicely is the whitespace at the start of the line. Proportional-width fonts work just as well as fixed-width for that. But yes, I admit, there are times when I do extra aligning after the first non-whitespace character. Nov 30, 2014 at 11:52
  • 1
    For the record (and Googlers), this got a working answer over on Vi.SE: vi.stackexchange.com/a/707/2221
    – Robin
    Jun 11, 2015 at 1:48
  • 1
    Whatever the arguments, this is not an answer. Jul 31, 2019 at 12:12
2

I'm using a modified SciTE (windows) which make use of Scintilla (portable from source code) and have switched to proportionnal font after many years as monospace fan. The text is more compact (and eye pleasing especially for long class name) so rarely needs line wrap. The vertical line-up is maintained with tab, which I defined as number of pixels. Adding a 'tabify' routine and using small tab-width (about 3 spaces) you can line up any block code neatly: not only at begining of line but multi-column struct or multi-line #define The catch is your code look bad in other editor, and you have to reformat other people codes.

0

It is possible to do many thing with variable spaced fonts, but history has shown, as well is the general opinion that it is a bad idea. Most editors aimed at programmers therefore don't allow you to use them, and rightly so.

Say you were to "draw a box" out of a smallest characters in the given font. And somehow managed to get it to line up.

Put a space in front of one row ... since space is relatively wide, ruins the whole thing. Now you have to either space it several times, ... until widths again match, or ... it's a bad idea. There isn't even a discussion on this one.

2
  • Well, one could screw with the font engine and tell it to draw each character in a fixed-size cell, which I believe the asker was getting at. Nov 15, 2011 at 8:16
  • @IgnacioVazquez-Abrams - Based on his title and text, I wasn't sure what he was asking. But, whatever it was ... my strong stand on this is that it's a bad idea. EOD. (Btw, yes, nice choice fo words ... :)
    – Rook
    Nov 15, 2011 at 8:35
-1

The Terminal programs lets me set any typeface, not just monospaced. I think I could get used to this!

enter image description here

I am sure you have seen the lists of other styles of Monospaced fonts too... Some free ones and the Wikipedia page

1
  • It says more about the terminal capabilities than the proportional fonts.
    – tejasvi88
    May 2, 2021 at 7:22
-1

No idea how OSX renders its fonts, but there is the obligatory Old New Thing blog post about all things quirky and historic among computing.

The blog post talks about how for TrueType fonts, the letters aren't drawn in nice little grids. Some purposely hang out of the grid while others don't. To programmatically make the font fit into a nice neat grid requires you to not use TrueType fonts. Hence we have come full circle.

But this is on the Windows side. No idea how OSX renders TrueType fonts, but I am willing to bet this is the reason why all fonts aren't available, besides the whole "Does it support every character?" thing.

1
  • Well, you can use scalable fonts, but they have to explicitly be marked as monospace in the headers (and it helps if they actually are monospace, of course). Nov 15, 2011 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .