Hacking Hack

Filed under Fonts, Text Editors, Visual Studio

First, the TLDR

Download my custom Hackd font here. Unzip, and install the two TTF files. That’s it.

On Programming Fonts

I’ve long been a fan of dedicated, monospaced programming fonts. I’ve even got a page here dedicated to a breakdown of most of the fonts I’ve had the opportunity to work with and review over the years.

I’ve used a number of these for a good period of time, including Consolas, Cascadia Code, and FiraCode among others.

But, for some time now, Hack has been my goto choice. It’s clear, simple, with good spacing, and excellent readability.

Alas…

As usual, though, there’s a few things that have always not sat well with me.

First, Hack has a peculiar dotted zero.

That’s just always seemed off to me.

Plus, it’s percent sign just didn’t jive with the rest of the font.

msedge_3oPHWPX4FB

And then there’s ligatures.

The Ligatures

If you aren’t familiar with ligatures, they’re basically substitutions of a single, conhesive glyph for 2 or more glyphs places next to each other.

For instance, a ligature for “greater or equal”, “>=” might look like this:

It’s important to note however, that ligatures are just a rendering nicety. They don’t actually change the characters you type at all. So, although it might look like one character on screen, your file’s content will still be “>=” just like it always has been.

I realize that there’s a lot of gnashing of teeth online about whether ligatures are worth it or not. In the end, I think it’s completely a matter of preference, and I happen to find them quite nice to look at and helpful during my day to day coding.

And Hack doesn’t have ligatures

When Monospaced isn’t Monospaced

Virtually all dedicated programming fonts are monospaced; every glyph has the same width. But, while a font might say that it’s monospaced, and might have all the right metadata to indicate that it’s monospaced, it turns out that all that doesn’t necessarily mean that it is monospaced.

In fact, there are some apps out there that detect a monospaced font not via metadata, but rather via a Windows call that actually tests if all the glyphs are the same width.

I happen to use a couple of those apps and, as it happens, Hack doesn’t pass that test, so it’s not listed as a choice for font in those apps. And that has been a (rather admittedly trivial) thorn in my side for some time now.

Introducing Hackd

So without further ado, I’d like to present my own take on a programming font; Hackd!

Hackd is based on Hack v3.003, used for most base symbols and upper/lowercase latin glyphs.

I then merged in glyphs from FiraCode v6.002 for all ligatures and pretty much all other characters.

Further, I pulled the % glyph from Firacode and tweaked it slightly to look more “Hack”ish.

 

And finally, I merged in the Powerline glyphs from “Hack Regular Nerd Font Complete Windows Compatible” from the NerdFonts collection.

NOTE: I left out virtually all of the excess glyphs from NerdFonts, including company logos, weather symbols, etc. I just don’t see much utility in having them in the font, unless, maybe, there might be some use for them in some kind of command line terminal customization? I did include the PowerLine symbols for that reason.

Would love to hear any comments on that…

How I Did It

I used FontForge for all manipulations.

I started with FiraCode-Regular and FiraCode-Bold.

Replaced all the glyphs from ! through ascii 255 with the Hack glyphs.

Then pulled all the powerline glyphs from the Hack NerdFont ttf file.

Replaced the % sign using the FiraCode version, then tweaked it by scaling it and repositioning it slightly to look better.

Tweaked all glyph widths to be the same. This automatically causes FontForge to generate a proper “monospaced” font that truly is considered monospaced. Originally, Hack had several glyphs that had a 0 advance, which caused the font to not be considered monospace, even though it really should be.

Updated various metadata in fonts to reflect the history, source, new name and version number.

Repeated all this for both the Regular and Bold versions of the font.

What About Italics?

Once that was done and the new fonts installed, the regular, italics, bold and bold italics alternatives were all available, so I did not create the BoldItalic, Italic, BoldOblique or RegularOblique alternatives as they didn’t seem necessary.

Disclaimer

I’m no fontographer, and I definitely couldn’t have done this without the fantastic work done by the Hack and FiraCode authors, much less the author of FontForge, so my hat’s off to all of them!

Font choice is a highly personal thing, and this work reflects my own personal preferences and taste. My main reason for documenting this is to show that there are tools available that make this kind of customization completely possible, if not easy.

 

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*