How Glyph Level PS Hints actually work?
Igor Petrovic
Posts: 307
Let's say we have a capital H with glyph level PS hints defined as on the image below. The question is how these hints communicate with the rasterizer in order to accomplish gridfitting.
In other words, we have H scaled down to the lower resolution, which looks wrong because of rounding errors (left stem is i.e. one-pixel size and the right is two, the bar is at the wrong position). And then PS autohint approaches rasterizer and says what?
Also, in that conversation, what means the hint position (bold green line) and what hint size?
Thanks!
In other words, we have H scaled down to the lower resolution, which looks wrong because of rounding errors (left stem is i.e. one-pixel size and the right is two, the bar is at the wrong position). And then PS autohint approaches rasterizer and says what?
Also, in that conversation, what means the hint position (bold green line) and what hint size?
Thanks!
Tagged:
0
Comments
-
Some of the hints in your illustration are wrong. You should have a positive ghost hint at the baseline, i.e. starting at the bottom of the stem and ascending vertically 21 units (standard for bottom ghost hints). And you should have a negative ghost hint at the cap height, i.e. starting at the top of the stem and descending vertically -20 units (standard for top ghost hints).
Do you have a baseline blue (alignment) zone?3 -
You are right, I deleted ghost hints because I thought they are an unnecessary product of autohinting. Which implies that I am not quite sure what hints are actually doing. I thought they are used only to define V/H stems (therefore connecting anchors with anchors, defining space in between as a stem).
Yes, I have alignment zones defined, baseline zone as well (13pt size). Here is the new screenshot (with ghost zones restored):
0 -
Glyph level hints perform a number of functions. They attach features to alignment zones (which is why you need the ghost hints), and they affect the thickness of strokes. So in the case of your H, the top and bottom ghost hints attach the tops and bottoms of the vertical stems to the cap height and baseline alignment zones; the hinting of the horizontal bar will stop it from getting two thick at sizes where it might otherwise round to two pixel height; and the two vertical stem hints will keep the uprights at the same weight. In addition to defining your alignment zones, you should also have defined at least one standard stem value each for horizontal and vertical stems (these days, you can often get away with only one of each, but if you have a big difference in stem weight between caps and lowercase you might want two of each).2
-
One of the best introductions to the PS hinting model is still the old Adobe Type 1 Font Format specification, since it was imported pretty much unchanged into CFF OpenType.
Also, even though you're working in FLVI, the Glyphs tutorials autohinting is worth reading (so is the one on manual hinting, but the autohinting one provides more detail of how to set various values and what there effect is).1 -
PS hints worked like a spatial distortion function that “alters” coordinates when interpreting the drawing instructions. And unlike TT, engines can interpret the hints differently.3
-
Thanks for your answers and links, it's much more clear now. At this point, I would summarize it like this (please correct me where I am wrong or unprecise):
1. Three main functions of glyph level PS hints are to:
a) define what in the glyph should be considered as a vertical/horizontal stem
b) control the position of that identified stems (horizontal bar of H i.e.)
c) attach glyph elements to the alignment zones (using ghost hints).
2. Once vertical and horizontal stems in each glyph are identified by glyph level PS hints, rasterizer uses that information and compares with Standard Stems (defined on the font level) and makes:
a) elements of the glyph defined as stems at least 1px wide at any size.
b) the closest match from the offered standard stems.
3. The position of the stem (i.e. horizontal bar of H i.e.) is controlled by the position of the hint root line. In other words, while doing gridfitting, rasterizer tries to favor the edge of the stem where the root of the hint is (bold green line), while the ending of the hint (thin dashed line) is "gridfitted". Maybe like hint tells rasterizer: "wherever the edge on which I am resting falls, that pixel should be colored with black, no matter that edge doesn't catch the "pixel middle dot". And then apply the closest standard stem from there."
Thanks!
0 -
I've just gone once again through the Glyphs article on manual PS hinting, and there is one thing I still do not completely get it. Maybe @Georg Seifert and @Rainer Erich Scheichelbauer might help, or anyone else
Is it true that an autohint alone (without being "attached" to the alignment zone) defines the thickness of the stem but not its exact position (where it falls on the raster grid).
This is fine for vertical stems, because pixel left/right is fine, but is awful for horizontal alignment. That's why we need ghost hints for those parts that are touching the zones but not going into it.
In short, hints are instructions for thickness, zones are for the position?
0 -
Blue zones suppress overshoot at low ppem sizes. They may also ensure that differing amounts of overshoot are suppressed at the same time (this may be rasterizer-dependent, I imagine).
That does indeed have the effect of rounding a position up or down. This is generally used in conjunction with a standard position, such as the baseline, cap height, or x-height. An additional hint can maintain the thickness of the stem while the position is being adjusted. Blue zones are normally used to make things snap to those standard heights, which might otherwise go beyond them. But AFAIK they do not change the base position, only things that deviate from it.2 -
Got it, thanks. Here is the other example where I like the mid bar on lc/a being sharp in the smaller hinted version, but I don't like it being pushed down. If I could pick, I would move it one pixel up. How to achieve that?
I have a hint for the mid bar (making the bar sharp), but seems that I need to define a zone only for it (to control the position), right?
0 -
Forcing a height to round up or just be larger isn’t really something you can do in PostScript hinting. You can totally do that with deltas in TrueType instructions a.k.a. hinting (though it is not guaranteed that all rendering environments will fully respect said instructions).1
-
This is why we say that TrueType has instructions, but PostScript just has hints. In TT you tell the renderer what to do. In PS, you make polite suggestions.4
-
Oh, I got it, thanks for debunking a decade-long misconception I had on this0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 803 Font Technology
- 1K Technique and Theory
- 622 Type Business
- 444 Type Design Critiques
- 542 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 485 Typography
- 303 History of Typography
- 114 Education
- 68 Resources
- 499 Announcements
- 80 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 270 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports