Hack – A typeface designed for source code

8 years ago (github.com)

This was posted to HN a couple of years ago. Has it changed since then? The discussion back then was fairly comprehensive, and most of the comments in here will likely replay the same questions (ligatures, comparison to other fonts like DejaVu sans, I vs i, etc.).

https://news.ycombinator.com/item?id=10140728

  • Upvoted so maybe the next person will see it before lengthily replaying the DejaVu comparison like I just did.

    Then again, this is probably one of those perennial sorts of topics that's just enjoyable to chew over every now and again.

This is an infuriating experience on mobile. Show me white background and black text with your font. I'll be damned if I'm going to learn new paradigms in scrolling and waiting just to then notice I can't see anything anyway because it is a responsive 1080p screenshot of 12pt text.

  • Pretty infuriating on the desktop as well.

    I scrolled down for an example, saw the screenshot of tiny text and assumed that either I've gone blind or that screenshot is shit; I'm going with the latter. Maybe it looks better on a computer with an apple on it, but not on ubuntu / chrome.

    Hack seems to be a nice font, otherwise. I don't know that I would switch to it as my primary, but I'll gladly add it to the collection of 20 or so "programming fonts" i seem to have collected over the years.

    Does anyone program in <= 12pt type? I'm looking at this "specimen" link[1] and 12pt seems unnecessarily small. I can read it clearly, but I feel like I'm working harder to do so. 16pt is more my style.

    1: http://source-foundry.github.io/Hack/font-specimen.html

    • (Had no trouble zooming the screenshot to legibility on an iPhone SE. What do you want to bet the site was designed in an exclusively fruit-machine shop? They're getting to be pretty crap for dev work lately, too, but that's another discussion.)

      I use 9pt fonts in Emacs on my personal laptop, because otherwise I can't use my preferred layout (a maximized frame containing three vertically split windows) and fit enough code on a 13" display.

      With a high-DPI display, it's workable enough - at 72dpi it'd be a disaster, as I had opportunity to discover during a brief flirtation with a netbook. Workable though it be, I'd like to find a still broadly similar font that made pairs like i/l and ./, more easily distinguishable at such small size. Hack is not that font; it appears to be a slightly modified Vera/DejaVu Sans Mono, which is no bad thing to be sure - I've used that font exclusively for many years - but hardly revolutionary.

      To be clear, I'm not sure whether Hack actually is a modification of DejaVu Sans Mono, or whether it's a novel design. Doesn't change what it looks like either way. And some decisions seem much more driven by style than by usability - for example, curving the tail of the i, to match the l, would actively harm legibility compared to DejaVu Sans Mono, where l's distinctively curved tail makes it very easy to distinguish from every other glyph that consists primarily of a single vertical stroke. That's one of the two most commonly confused groups, and so I'm not really seeing a strong legibility rationale for making one of its members less distinguishable from another.

    • Does anyone program in <= 12pt type?

      I do. But the 10-point characters in my editor are the height of the 13 pt characters on that page. For comparable readability, my 10 pt "Droid Sans Mono" is more readable than the 18 pt "Hack" on that page.

  • The worst thing about the website is that there's more text in some other fonts than Hack itself.

  • Not even readable on a 15" laptop screen.

I'm going to be honest... After a while, all of these programmer fonts start to look the same to me.

  • A lot of fonts feel like this. It's only once you set a whole page set in them it they start to look different especially when you do side-by-side comparisons.

    Programmer fonts are even more samey as they are used at such small sizes comparatively and of course have the additional constraint of being monospaced (most of the time).

    Personally with the amount of code I stare at each day even an oddly placed pixel can be annoying.

  • I know. I just use one of the available monospace fonts on whatever OS I'm using (there's always at least one). I'm just too lazy/apathetic to bother with installing one of these things.

    • I used to feel the same way. Then for some reason Source Code Pro caught my attention on someone else's screen. Now I set up all my Dev environments with that (plus all the fancy extras for zsh).

  • Yeah like, why bother stressing over the exact configuration of pixels that you're using to make your i's tail.

    Just pick a monospaced font that you can read and get to making something worthwhile.

    • If your project involves picking a default likable font for others to use it makes sense.

      Also, in the larger scope of things all the "good enough"'s at times add up to something awful. Had we perfected everything the bothering wouldn't exist. You would look at the font and click some button to have or have not become it part of your collection.

For those feeling adventurous: Input[1] is a proportional font made for coding. It's also highly customizable.

[1]: http://input.fontbureau.com

  • I was using proportional fonts for a couple weeks. A problem I ran into was that in coding styles that I typically work with, you need to align stuff with spaces to match some artifact on a previous line (e.g. an opening paren of a function call). At that point you pretty much need the space to be as wide as any non-whitespace character that might appear there, otherwise things end up looking wrong. This is what basically killed it for me. a) I don't like how it looks. And b), I don't want to have patches bounced over formatting trivia that I don't notice.

    (Edit: typos.)

  • It's not just proportional. I've used Input Mono as my goto text editor font for many years now.

  • I've been using proportional for a few years now and can never go back to typewriter fonts (code just looks wrong). This looks really nice, I was looking for a proportional coding font. I'll have to give it a shot!

    Too bad it doesn't include programmer ligatures, I've been looking for a proportional font that included those (I tried hacking them in myself but couldn't figure out the font hacking tool chain).

  • > For those feeling adventurous: Input[1] is a proportional font made for coding

    I consider myself fairly adventurous, but this is clearly beyond my comfort zone :)

  • Thank you for this!

    I'm not adventurous enough for proportional fonts, but the monospaced Input looks quite nice. And I'd not heard of it before. I'll definitely give it a spin.

  • I've been using it since about a year -- I love it. The Serif/Sans Serif versions are also quite good.

Sorry, but nothing beats the good old IBM 3270 font.

https://github.com/rbanffy/3270font

If you are used to DejaVu Sans Mono (or its ancestor Bitstream Vera Sans Mono), you might like Hack as well — it modifies DejaVu Sans Mono to make it even more suitable for source code and introduces a number of nicely aligned glyphs (geometric shapes, etc.) for use in terminals and status lines.

Great for both terminal emulators and code editors alike.

  • That explains why the font looked so familiar. I've been using DejaVu Sans Mono since forever and it's great.

Real programmers use a 3x5 pixel font, to get the most code on the screen as possible!

https://web.archive.org/web/20150407130603/http://mckoss.com...

Hack isn't all that great. Here are tons of alternatives:

https://github.com/chrissimpkins/codeface

(Use Input)

Lower case "i" and "l" are just way to similar. In addition lower case "i" looks a lot like a "t" to me. This is not a good sign for a coding font.

I use and enjoy this font. Easy and clear to read, and not having to patch the fonts for Vim Powerfline saved a little time (although nearly all patched fonts are available in the AUR).

Honest question here, does anyone else have no idea what font they are using in their text editor?

I use emacs, and don't have a clue as to what font I'm using. It's monospace, and that's about all that matters to me. As long as I can tell the difference between I, 1 and l - I really couldn't care less.

  • Yeah, lots of people don't know or care. As long as it shows them what they need to see, they don't care, and that's 100% fine.

  • Dejavu Sans Mono.

    For some reason, I've typed it out in a few files, such as my Emacs init and .Xresources.

Stop making sans serif fonts for code!

Code has to be readable. Those serifs aren't merely decoration: They're visual cues that help your eye intuitively determine which letter is intended by a given shape.

Sans fonts may look "clean" but they actually take your eye longer to read.

I prefer Iosevka, which was trending a while ago: https://github.com/be5invis/Iosevka

  • The best thing about Iosevka is that it's configurable in so many different ways. You're not limited to a configuration that the author of the font thinks to be the best. The attention to details in Iosevka is also notable (like the alignment of special characters). Iosevka is very balanced: it looks good both in a source code editor and a terminal.

  • I have my own build of iosevka with my name in it.

    I've yet to find a better condensed programming font with ligatures, it's close to perfect already (for me).

    • When I looked at ligatured fonts a few months back I went with Monoid instead, it fits my uses better, and I was especially attracted to the triple-equal ligature for JS contexts (in Monoid, `===` is rendered as a long ≡ making it visually very distinctive from assignment or regular equality).

      1 reply →

    • > I've yet to find a better condensed programming font with ligatures, it's close to perfect already (for me).

      Agreed. It's narrow, but does not sacrifice readability.

Only good match is bitstream vera sans. I prefer Hack because it is lighter (cf. i) The only thing I prefer in Vera is the 0. The dot inside the zero in Hack is too big.

I switched my Sublime Text to it and watched my fonts change ever-so-slightly. This font is essentially "Source Code Pro"

Which font to use depends on many factors. First of all fonts don't look the same under various font rendering engines, and those engines have parameters leading to even more variations.

Then, your screen is another factor. With a lot of dpi (e.g: 4K or superior) you can pretty much anything you want since most fonts will look very readable.

All sorts of problems installing this on OSX; to be fair, the process for installing fonts on OSX is horrible anyway, but there are still errors.

Edit: I don't know why this got downvoted; if there's a way in which you want me to alter it to be more acceptable, please let me know.

  • >All sorts of problems installing this on OSX

    Like what? Installed it with absolutely no problem at all in both Sierra and High Sierra (GM) -- and never had issues installing it in my older Mac OSes (or any other font -- some fonts created by amateurs --free .ttf varieties-- have broken metrics/config and you're warned about it sometimes. Other than that, absolutely zero issues).

    >to be fair, the process for installing fonts on OSX is horrible anyway

    It's literally double clicking on a font file and clicking "Install Font" on the preview that pops up.

    How is that in any way "horrible"?

    • UPDATE (& TL;DR & Introduction!): Killing Font Book between operations avoids all sorts of errors and weird display issues you'll get if you try to install multiple font files in a single 'session'. Open Font Book from fresh, locate font files in Finder, drag them into it and you'll do everything in one operation, and it will even update to show you what's happened!

      > Like what?

      Errors about duplicate fonts. Several occasions where dialogs open and close immediately, indicating some kind of problem, but not sure what. Even after going through the "yes, please do really install this font, even though there are 'duplicate fonts'", nothing seems to happen sometimes.

      I've managed to install three of the fonts (font variants?) — Regular, Bold, and Bold Italic — but Italic refuses to install altogether.

      > How is that in any way "horrible"?

      Having to open four separate font files, then click a button each time to actually install them seems like a pretty tortuous process — I'm grateful it was only 4! It would be a LOT nicer if I could just select the files, right-click and choose "Install font(s)" and have it all done in a single step. That's totally aside from all the errors.

      Having said that ... pro-tip: drag-and-drop. I always forget that drag-and-drop is sometimes the 'first class' way of doing something on OSX. So the quickest way, I think, would be:

      1. Open 'Font Book' 2. Locate files in Finder 3. Drag and drop from the latter to the former

      This process finally allowed the "Italic" variant to be installed. I'm assuming it will work with multiple variants at once; I would test that, but trying to remove the family/variants in Font Book just gives me a 'no-op' (after a confirmation dialog).

      2 replies →

    • You never get it complaining about duplicate names that aren't, or have to kill and restart Font Book after installing each font because otherwise it will silently fail to install the next one? You never have it pick a random display for the "font problems" dialog, and then open that dialog buried under every other window on the display?

      It was fine in Mavericks. In Sierra it has been a minor player among a very sizable collection of annoyances.

      2 replies →

I do not get the feeling it is an improvement over other Fonts. Just another Font face.

WOW! The website looks so shiny just for hosting a single font. Almost thought it was some website advertising Hack the language related stuff. Great web devs behind the site. Kudos to you.

What are Powerline glyphs?

  • Glyphs that are commonly used in status lines of terminal applications (editors, shell prompts) to delineate sections and to indicate the status of various things (e.g., the current character encoding, line-endings, git status, git branch name, etc.).

    These glyphs include a number geometric shapes and symbols. By using a font that supports them with the proper metrics, the status line looks sharp and flawless.

  • Custom glyphs used to render bold easy-to-distinguish vim status lines or shell prompt lines to make terminal scrollback more parsable

Does anyone like the way they've done the dotted zero? I've always disliked it personally. If they offered a slashed version I would definitely try it out.

  • No! It's an Abomination^TM

    Keep stuff out of the middle of my zeros, please.

    The circle surrounding nothing wonderfully symbolizes a subtle concept.

    Drop a dot in hole and now what are you symbolizing? A nice golf shot? When you put a slash across it are you warning me away?

    No, no. I prefer my voids empty, thanks very much.

Pleasing to the eye, but too wide for my taste. I like to have divide a 1080p screen into three columns of 80 chars width, and most fonts are too wide for this.

  • If you're referring to a vertical 1080p screen, which is pretty common for developers, then you'd need a 4.5-pixel-wide font, which would be extremely difficult to read (5-pixel-wide + 1 border characters are probably the limits of having recognisable characters for the full ASCII range), but with it horizontal then only 8 pixels wide would be sufficient, and there are plenty of fonts in that range. Various 8-pixel wide "VGA"/"DOS"/"IBM terminal", as well as the classic "6x13" and "7x14" fonts which are my favourites, would qualify.

I'm having troubles differentiating between Hack and Menlo .. is it just me or are they quite similar?

  • Both Hack and Menlo are based on DejaVu Sans Mono / Bitstream Vera (the DejaVu family extends Vera). Very little difference indeed.

Can we please stop polluting the global namespace with names like "Hack"?