Elastic tabstops - a better way to indent and align code
|let mainAppleFonts = [|
|//name of font used by Apple||use||created|
|("Chicago",||"Mac OS system font",||1984),|
|("Charcoal",||"Mac OS 8 system font",||1997),|
|("Lucida Grande",||"Mac OS X user interface",||2000),|
|("Helvetica Neue",||"iOS 7 typeface from 2013",||1957),|
|("San Francisco",||"All Apple OS typefaces from 2015",||2015),|
|("Motter Tektura",||"1977 logo type",||1975),|
|("Apple Garamond",||"1984 corporate font",||1977),|
|("Myriad",||"2002 corporate font",||1992),|
Why Apple should use elastic tabstops for Swift
Ever noticed how these days the only place you see monospaced fonts is in code? Steve Jobs famously insisted on proportional fonts for the original Mac in 1984. He also made sure that proportional fonts could be displayed properly in NeXTSTEP by making Display PostScript an integral part of that OS (which later became OS X). Jobs must take much of the credit for the switch from monospaced fonts being used for all computer text, to only being used for code. After seeing Swift and understanding its designers' emphasis on making a beautiful programming language, I think Apple has an opportunity to remove the need for monospaced fonts completely, at least for that language.
I've invented a way for programmers to use proportional fonts in their code. It's called "elastic tabstops" and it makes tab characters delimiters between table cells in a manner reminiscent of how they're used in tab separated value (TSV) files. Not only does this ensure columns of text always stay lined up, but it also allows each programmer working on a project to use their own choice of font and indent size, and minimises diffs in version control systems (because the whitespace characters don't change, just the displaying of them).
So why isn't everyone using elastic tabstops? There's something of a chicken and egg problem here. Google has adopted elastic tabstops in the gofmt tool used by their Go language. However, Google only uses my algorithm internally to layout code before converting it to a traditional monospace-only format. The true strengths of my invention come when it is implemented in a text editor or IDE (which the Go team have not made yet).
How Apple could lead the way (again)
This is where Apple has an opportunity. Apple has control over the language and (unlike Google) an IDE, has stated that they want Swift to be a beautiful language, and has a track record pushing technologies that enable beautiful proportional fonts.
I propose that Apple implements elastic tabstops in Xcode and makes it the default format for writing code. As the creator of Swift and Swift's main IDE, and a historical proponent of proportional fonts, Apple is the one company that can and should pull this off.
So if anyone from Apple sees this post, please get in touch. Programmers spend most of their working lives staring at code. Let's try and make that as nice an experience as possible, and complete what Steve Jobs started, by removing the last requirement for monospaced fonts.
Posted on Friday, 2016-07-01 at 14:04 UTCInput Sans Narrow (designed for code) Input Serif Narrow (designed for code) Arimo Arvo Bitter Bree Serif Crete Round Merriweather Merriweather Sans Montserrat Open Sans Open Sans Light Source Sans Pro Verdana Inconsolata (Monospaced)
Comments are closed.