5 ms·
Monospace - This is an universal requirement for source code typography. It's not just an historic artifact from the olden days of terminals, but an useful con
by kbenson 11y ago
Monospace - This is an universal requirement for source code typography.
It's not just an historic artifact from the olden days of terminals, but an useful convention to allow two dimensional structuring and highlighting differences on the character level.
Well, since there are people that swear by using variable space fonts for programming, it's not necessarily a universal requirement. I agree it is a very useful convention though, and prefer monospace fonts for terminals and programming myself.
- jowiar 11y agoI'm waiting for the editor with a layout engine that doesn't assume monospace -- the tooling is a bigger problem than anything else for variable-width fonts.
- dri_ft 11y agoI haven't used it much, but I recently learnt that emacs allows it. There's a minor mode called ‘variable-pitch-mode’.
- terhechte 11y agoEmacs can do it just fine: mx variable-pitch-mode https://www.dropbox.com/s/f7u7iagunxl4p25/emacs-var-pitch.png?dl=0 https://www.dropbox.com/s/f7u7iagunxl4p25/emacs-var-pitch.pn...
- geofft 11y agoYou might like the "elastic tabstops" idea: http://nickgravgaard.com/elastic-tabstops/ http://nickgravgaard.com/elastic-tabstops/ Although the editor support for the concept doesn't look great.
- tobr 11y agoMostly works in Sublime, which I've been using with Input Sans for a bit over a year. The only thing that breaks is indentation guides, which end up in the wrong place. I would not want to go back to a monospaced font.
- kbenson 11y agoSlightly related, I've been thinking for a while how an editor that tracked indentation and made each indentation/scope a different background shade and/or slightly smaller font might be interesting to play with. Does anyone know of a system that uses this?
- terhechte 11y agoThere's a package for emacs to do that: http://www.foldr.org/~michaelw/emacs/color-box.png http://www.foldr.org/~michaelw/emacs/color-box.png http://foldr.org/~michaelw/emacs/ http://foldr.org/~michaelw/emacs/
- kbenson 11y agoThanks! Now I wonder what it looks like if you keep dropping the font a point.
- LeonidasXIV 11y agoHas been working in SciTE since ages and SciTE is not even a particularly fancy editor. I used to program Python in proportional fonts which worked pretty well.
- Nadya 11y agoSource code typography and programming are two different things. And by source code typography I imagine more ASCII markup for "drawing" flow charts and structuring for headers which would not align or break entirely with variable space fonts.
- teddyh 11y ago> there are people that swear by using variable space fonts for programming This might include Bjarne Stroustrup – all the code examples in The C++ Programming Language is in a variable space font.
- _acme 11y agoBjarne uses Rob Pike's Sam text editor, which by default uses a proportional font (Lucida).
- teddyh 11y agoThe Smalltalk system also used proportional fonts.
- alexeiz 11y agoA variable space font is good for a programming book where it can be a challenge to fit 80-character wide line of code on a page, but awful for actual programming.
- mavelikara 11y agoMany academic papers and books do this. For example, see the famous paper "Why Functional Programming Matters" [1]. To me, having non-monospaced font in a paper or book is a signal that the contents are "too academic" to be of practical use. This is a very weak signal though - for example, Sally Goldman's excellent book "A Practical Guide to Data Structures and Algorithms using Java"[2] has pages and pages of useful Java code in non-monospaced font. [1] https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.p... [2] http://www.amazon.com/Practical-Structures-Algorithms-Chapman-Applied/dp/158488455X http://www.amazon.com/Practical-Structures-Algorithms-Chapma...
- kbenson 11y agoI think to some degree this is influenced by norms of publishing, some by the constraints of the medium (you have very limited horizontal space), and some by the authors (often) already using italics and bolding within the code for emphasis (such as in your second reference).
- copperx 11y agoStrousoup 's books always have the C++ code in promotional size.