Customize text editor and terminal to use non-monospaced fonts without the horrible results?
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.
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:
(Click images to enlarge)
and the same file with Inconsolata-dz at 12 px:
I guess these screenshots speak for themselves.
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.