Hinting: Manual PostScript Hinting

  • by Rainer Erich Scheichelbauer
  • Tutorial
  • – Modified on

Do We Need Hinting at All?

Hinting is a delicate subject. Some people say, it’s increasingly unimportant, or decreasingly important or whatever. And as far as anti-aliased font rendering goes on Apple devices, they’re probably right. Macs and iOS machines do roll their own hinting on the fly. Other systems, however, do still apply hints, at least up to a certain font size. Windows systems do, for instance, as do Adobe apps like InDesign and Acrobat. And if we’re going to hint our fonts, we might as well do it right.

For most cases, automatic hinting will do just nicely. But some letters may turn out to not align properly at low resolutions or simply look super-bad as opposed to nice and crisp. Here’s an example of an eight. The top row shows the autohinted glyph, which looks somehow distorted, especially in the middle rendering. In the bottom row, you can see the same eight, but this time manually hinted. Pay attention to how the figure is rendered more symmetrically and more upright:

Mind you, not every font can be hinted satisfyingly. Ideally, your font has traits as regular as possible, i.e. re-uses its stem widths a lot, all its overshoots have approximately the same size etc. If, however, you have a very irregular design, like a grunge-style font, or a scanned handwritten font, you may want to consider not hinting it in the first place.

Font-Wide Settings

First, we need to set standard stem widths and alignment zones in the Masters section of the Font Info. We already covered that in the tutorial about autohinting, so I am not going to repeat that here. All you have to make sure now is that all your overshoots and horizontal stems that need to be aligned reach into those zones, no more no less.

Autohinting

The first step now is to export the font (Cmd-E) with autohinting enabled. And then, you test your font in InDesign at low resolution, i.e. at low zoom levels. It’s a very good idea to use the Adobe Fonts folder for that purpose.

Inevitably, you will come across a few letters that just don’t seem to cut it. It’s these letters that we’ll have to hint manually. Very likely candidates: letters with diagonals.

Manually Hint Single Glyphs

So, we go into those glyphs and have to do manually what the autohinter couldn’t do. Now concentrate:

First, make sure all extremum nodes are set. Perhaps you want to choose Paths > Add Extremes. You can also switch to the Path tool (P) and Shift-click on an outline segment to insert a node at the extremum. Read our tutorial on drawing good paths to find out more about extremum points.

Secondly, identify horizontal stems: Look for horizontal design elements that reach into an alignment zone, e.g. a serif, the crossbar of the t or f, or the upper curve of the o where it turns horizontal for a brief moment. For each such element, select both its top and bottom extremum nodes, right-click to open the context menu and choose Add horizontal hint. Glyphs will apply a horizontal hint encompassing the extremum points.

Thirdly, look for vertical stems. It’s the same story as with horizontal stems, only this time, alignment zones do not matter. Again, select two extremes, right-click and choose Add vertical hint from the context menu.

So, a manually hinted o, for example, could look like this:

Ghost Hints

Sometimes, a glyph reaches into a zone, but lacks that horizontal element that you so desperately want to hang a hint on. For these dramatic situations, the wise inventors of hinting invented ghost hints. In short, a ghost hint says, ‘Okay, there’s no serif here, but I’ll act as if I was one, and I’ll align myself to the alignment zone.’

You can add a ghost hint by selecting exactly one top or bottom extremum node, and choosing Add Horizontal Hint from the context menu:

There are ghost hints for bottom zones and ghost hints for top zones. When a ghost hint is selected, the grey info badge at the bottom indicates which one you have at your hands. Usually, Glyphs guesses right which one you need. However, if you need to change it, just click on one of the buttons and it will switch its orientation.

The classic example for this is an uppercase sans-serif I. Here's what it looks like, note the ghost hints at the top and the bottom:

Make sure you have top ghost hints reaching into top zones such as x-height, ascender or cap height, and bottom ghost hints at bottom zones such as the baseline or the descender. This way you can make sure your sans-serif letters align properly with each other at low resolutions.

By the way, you can convert an existing horizontal hint into a ghost hint by right-clicking on the grey number badge next to the hint and choosing Make Ghost Hint:

Export Again

Now, when you export your font again, make sure autohinting is switched on. Autohinting will then be applied to all glyphs that do not have any manually set hints. This means that once you do choose to manually hint a glyph, you have to do all the hints inside that glyph, be it vertical, horizontal, stem or ghost hint. Manually hinted glyphs and autohinted glyphs will then co-exist peacefully in the same font file.

Two words of caution: make sure your horizontal hints do not overlap each other. And also make sure your vertical hints do not overlap each other. So, for example, in the case of the figure eight in the screenshot above, we advise to only hint the lower bowl with vertical stem hints. This way, the upper bowl may become a little blurred through anti-aliasing, but it will stay symmetrical.

As of this writing, hint replacement is reserved for automatically hinted glyphs. So, avoid overlapping hints when you hint manually. In any event, it’s a good practice to keep the number of hints as small as possible. Only hint the most significant stems, leave out the details.

Multiple Master Goodness

If you make sure you always attach the circle and the triangle to nodes, you only need to hint the first master. If your paths are point-compatible, which they need to be anyway, Glyphs will automatically apply the hints to all instances. Nice!


Update 2016-02-19: Updated for Glyphs 2