How Glyph Level PS Hints actually work?

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!

 

Comments

  • John HudsonJohn Hudson Posts: 1,569
    edited February 23
    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?
  • 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):

     


     
  • John HudsonJohn Hudson Posts: 1,569
    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).
  • John HudsonJohn Hudson Posts: 1,569
    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).
  • 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.
  • 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!

Sign In or Register to comment.