Counter Control Hints
The Counter Control hint mechanism controls counter spaces in a glyph. A counter may be defined as an area of white space which is delimited by a pair of horizontal or vertical stems. This mechanism is designed to aid in the rendering of fonts containing complex glyph shapes by ensuring that the size and proportions of all counters in a glyph are rendered as accurately as possible.
For example, if multiple counters are exactly the same measurement in width or height, the Counter Control mechanism will make them the same number of pixels, providing there are a sufficient number of pixels available. Similarly, if the width of two counters in the original design are, for example, in the ratio of 3:5, the interpreter attempts to preserve this proportion, based on the constraints of the glyph's width.
Counters may be organized into groups, with each group consisting of a section of the glyph whose stems are to be considered in relation to each other by the rasterizer. For a relatively simple glyph, for example, all horizontal stems may be considered to be in a single group. For more complex glyphs, putting all stems in a single group might overconstrain the grid fitting problem. Also, the ordering of the groups determines the priority for the allocation of pixels, which may be critical for lower resolutions.
For fonts with complex glyphs, it is very important to include Counter Control hints; failure to do so can result in performance and quality degradation. Some rasterizer implementations are able to control counters by making an initial pass through the font to compile hint data, and a second pass to rasterize the glyphs. Thus the rasterizer supplies some of the Counter Control hints, but at the cost of reduced performance.
Counter Control Groups
A Group is a list of coordinates for counters, delimited by stems of a single orientation (either horizontal or vertical), that are to be adjusted relative to each other. They are listed in ascending order (in character space) as pairs of numbers. Each pair consists of a value for the left (or bottom) edge and the width of the stroke, where the left (or bottom) edge is encoded as the distance from the previous stem, or the distance from zero (for the horizontal direction, the distance from the left sidebearing point) for the first entry.
Since the count of the number of stems in a group is not given, the sequence is encoded by making the distance to the final stem extend to the far edge of the stem, and then making the final width negative. For example, if the last pair of numbers would ordinarily be `...100 20...', it must be encoded as `...120 --20...'. Not all stems in a glyph need be included; if one or more counter spaces are judged to not need control, they may be omitted from the Counter Control hinting.
The order of each group in the calling sequence determines the priority for that group. This priority (for a group, not for individual counters) determines the order in which the groups are allocated white space pixels. The order of the groups can be determined algorithmically, or by a designer. This prioritizing scheme gives the designer the ability to specify the groups whose counters will be the last to ``collapse'' (have no white pixels) at small sizes, and which will be more accurately rendered at intermediate sizes. This has the potential to significantly improve quality and legibility at a range of sizes. Even if the group order is not manually or algorithmically determined, it is still much better to have Counter Control hinting than to not have it at all.