Improving Postscript / CCF hinting

I’m still new to hinting and I’d like to learn more about how to improve PS hinting. From several [1] sources [2] around the typo-sphere it seem the future is in CFF webfonts.

(on Windows) Whenever I look at Glyphs app made autohinted CFF webfonts (which I understand uses the Adobe autohinter) at text sizes (12pt to 24pt), I don’t like the results, especially in ClearType GDI.

No hinting:
The rhythm and proportions get really messed up and the stems and other areas in general are fuzzy. When there is no hinting, the rhythm and proportions are better but it’s illegible at text sizes due to being extremely fuzzy. One glaring issue is the cross bar of the e.

DirectWrite: a lot better but the problem of the e glyph persist.

How can I improve my PS hinting? Particularly, the proportion and spacing, and glyph details.

I’ve read the Glyphs tutorials but what it suggests that I can do is no better than what autohinting does. I’ve tried changing the stems and even used stemHist and from the AFDKO with no better results. I looked at the results from FontLab and they’re only a little bit better with the proportion and spacing in smaller sizes.

Thanks in advance

Resources I’ve found so far:

The problem with PS hints is that you can’t do much. There, you have to rely on the renderer. With Truetype, you have much more control and it usually results in a sharper but much bigger difference from the original design. It is kind of like the difference between Mac and Windows rendering. Windows is a bit sharper but it is more difficult to distinguish different styles, or even weights at smaller sizes because the outlines are aligned more strongly with the pixel grid. The windows rasterizer for OpenType fonts became much better in recent years that it might be possible to use CFF based fonts, especially for sizes bigger than ~16px. For smaller sizes, it will most likely be better to use TTF.

Honestly, I don’t think the result is bad at all. Consistent stems and vertical metrics. That’s what you can do with PS hinting, and that is what you achieved.

Really? It looks like a different font here, everything is wider, more goofy even. Look at the /e /g for example.

So there’s really nothing I can do for CFF webfonts for my above issues?

Relax. The outlines are distorted to better fit on the pixel grid. And at low resolutions, one pixel distortion is already a significant percentage. Of course, they are made wider, rather than narrower, on order to avoid the potential loss of counters.

That is what hinting does. The point is not to preserve your shapes as much as possible, but to maintain legibility through more consistent (and sharper) stems, as well as more consistent x-height, baseline, etc.

Also, at small sizes, it is a good idea to distort letters to wider proportions and larger counters. A typical size-specific adjustment, you can read about it in Shoko and Tim’s book. Again, I think your result is pretty good, I’d be happy about it.

And this is a default setting that can’t be changed for Postscript hinting?

Why would you want to change it? At low pixel resolutions and very small sizes, that is the better alternative. Would you rather have it distort to a smaller counter, thus hampering legibility? I don’t think so.

So can it or can it not be changed? I ask because CFF looks good (and stays more true to the design) in DW, and TT looks good in GDI and DW, so I assumed it’s not impossible to make CFF also do the same. But I don’t understand the difference between how they work and the limitations.

Also how small are we talking about? I’m looking at the text at 20px here btw — decreasing the counter would not be disastrous. And from the little I know about TT hinting, where it’s possible to apply ppm size specific settings—I wondered if there is some kind of font-level delta settings for PS as well.

You could also try to delete all vertical hints or horizontal hints, depending on what you find important. Now the glyphs are being distorted in both direction on a small area. This has much effect on the outcome.

I will try that, what’s the easiest way to do that? I couldn’t find any Glyphs App scripts.

I haven’t done since I started working with Glyphs. I used to do that in FL…

I assume DW only (or mainly) takes the horizontal stem hints in account, because it can rely on subpixel rendering for the vertical stems.

Basically, PS hints are really hints in the literal sense. They say, ‘hi renderer, I give you a hint: this here is a stem, but that’s just for your information, do with it whatever you like’. What the renderer does with this information is beyond your control. This principle of PS hints is often shortened to: dumb font, smart renderer. It is therefore to be expected that a CFF font will look different in different rendering environments.

On the opposite, TrueType hints are not hints but actually instructions, a.k.a. smart font, dumb renderer. You can precisely tell the outline whether to align to the top or bottom pixel edge, or to the nearest pixel center, etc.

What a renderer does is (1) distort the outlines in a way that they will fit better on the pixel grid, and then, (2) calculate the pixel image, i.e., determine which pixels become black, and which remain white, and if you have antialiasing as well, then also which pixels become a shade of grey, or a color if subpixel rendering is involved.

And keep in mind that 20PPM is not so much, that means that you have about 10px for the x-height, and on average 7px for the width of a lowercase letter. So, 6px instead of 7px is already −15%, whereas 8px instead of 7px is +14%. In other words, 1px is already a lot at 20PPM. So whichever way, it is a huge adaption from the point of the outline. Even on low-resolution MacBook Air displays, that is approximately 10pt in size, which is small, given the viewing distance is bigger than with a printed book.

If you do not want any distortions, then the wisest thing to do is not apply any hinting at all. But research has shown that a sharper image is better for legibility in the very most cases, so for a reading typeface, I usually recommend the tradeoff of less fidelity for a sharper image.

1 Like

The main difference between GDI and DW is that DW improved the handling of CFF. It uses less rigid pixel snapping and a improved antialiasing. This is conceptual similar to the rendering in MacOS. Both systems will have some problems in certain sizes.

1 Like

Sometimes when PS-hinting goes too crazy, I hint the problematic glyph manually inside Glyphs by first applying autohinting and then remove or change the hints manually that creates the craziness. This means the specific glyph does not get hinted by the final auto hinter since it’s already hinted. Accents can often benefit from this and complex glyphs like lowercase g which can get too many hints when autohinted.

I would definitely try to fix that lowercase g this way.