Hack – a typeface made for source code
Complex lettering, confusing characters and bad antialiasing are all genuine problems faced by today’s programmers. Enter Hack 2.0, a typeface created exclusively for better readability of source code.
No more squinting to see if that’s a lowercase L or a capital i – that’s the promise of Hack, a free and open-source programming typeface that has been attracting much attention in the tech scene. We spoke to Hack creator Chris Simpkins about how a better font can make a programmer’s life easier.
JAXenter: Why did you think that source code needs its own dedicated typeface?
Chris Simpkins: Source code borrows characters from text and uses them to generate character pairings with visual appearances and meanings that can be very different from those experienced in text. A perfect example is the semicolon. In text, this punctuation character divides elements in a sentence and for this purpose it is expected to maintain the symmetry and rhythm of the rest of the typeface. A semicolon with a different weight or point shape in the middle of a sentence would look discordant. In programming languages that use the semicolon to indicate the end of a line of code, the level of importance attributed to this single character differs greatly. The semicolon indicates this is the end of a statement. I would argue that clarity is added to source code when the glyph receives visual emphasis. The character should be apparent (or much less transparent) in source code. In Hack, we’ve given the semicolon glyph a heavier weight and different point shape to distinguish it from surrounding alphabetic and numeral characters. We took the same approach with a number of the punctuation characters that are commonly used in source code.
Good typefaces must be highly tuned for their intended purpose (take the type used on street signage as a great example) and the type in source code is no different. The legibility of source code can be significantly improved or reduced by the level of testing and tuning that the face receives in source code during this tuning process.
What kind of fonts have programmers been working with now? And where did you see the problems?
There are a large number of excellent typefaces that are commonly used for source code. Some of the most popular include Source Code Pro, Consolas, Ubuntu Mono, Inconsolata, and Bitsream Vera Sans Mono/DejaVu Sans Mono. A number of newer development typefaces have delved into the technical side of typeface design employing OpenType features to create ligatures that change some of the more unsightly character combinations that we use in source (e.g. ->) into well-designed, more visually appealing shapes. Examples include Monoid, Hasklig, and Fira Code. And believe it or not, there are still those out there who are using bitmap fonts with excellent results. Long live Proggy!
It is a difficult task to point to a problem with any of these faces. It boils down to a subjective experience and everyone has their own favourite based upon characteristics that are important to them in their own body of source and the editor where they use the font. Opinions about development typefaces are strongly held among developers, having been honed through years of face time with the fonts.
There is a rich history of typefaces that were and are currently being designed for use in text editors to support development of source code, and of developers who have been involved in the type design process. In fact, Donald Knuth (yep that one) was a type designer himself. While not designed with the intent to support source code, his Metafont project was an early type counterpart to his TeX typesetting system.
How did you decide that open-source would be the best approach for building a typeface like this?
The Hack typeface is an evolution of a long-standing libre, open source typeface project. The glyph shapes were originally designed by Jim Lyles (Bitstream) as the open source Bitstream Vera Sans Mono typeface. The original Vera character set has been significantly extended by the DejaVu project and Hack began with the original Bitstream Vera Sans Mono glyphs and select Unicode character ranges from the DejaVu Sans Mono typeface as its base glyph set. The typeface that you see today extends upon years of contributions by type designers and developers who contributed to these projects.
60 contributors, 1534 glyphs and four faces
The Hack source is hosted on Github in the broadly supported UFO format. Users benefit from this approach because anyone may study the source, learn from it, modify it, and generate derivative typefaces with this knowledge. If you don’t like the appearance of the zero, which incidentally some have called the ‘eye of Sauron’, you can build your own version of the fonts with a slashed or dotted zero. Perhaps some motivated developer/designer will take the face and create entirely new and novel shapes with it, or a design that is much more focused on a specific subset of source code (or for that matter any text that commonly uses monospaced fonts – movie scripts are good example).
From a project maintainer and developer’s standpoint, the breadth of feedback from the open source community on the cross-platform, cross-application design of the face is something that simply cannot be achieved by other means and is a tremendous development resource. In the past week alone, I’ve received input from quite literally hundreds of developers who tried the typeface across enormously variable platform x editor x type renderer x antialias settings x hinting settings x type size combinations. During that short period of time, we were able to identify a problem on a single platform that occurred in a handful of editors and interfered with use for a subset of users. A fix was released yesterday. This vetting process among individuals with a vested interest in the product is driving the overall quality of the project.
Where do expect programmers to be making use of this typeface?
My goal is for the typeface to remain a general purpose face for source code in all formats including print, embedded applications (e.g. pdf, presentations), and the screen. The most common screen use is likely to be in text editors for development, but we’ve designed web fonts that are available by CDN with a simple, single line import in HTML. This makes the typeface readily accessible to those who display source code on their sites for educational purposes, as well as to the many web-based text editors out there. The teaser section of the jaxenter.com homepage is a perfect example (hint, hint)!