Deltas
A delta is an instruction that operates only at a specific resolution. There are two kinds of delta, invoked by two Xgridfit elements: a <delta> element moves points, and a <control-value-delta> element edits the Control Value Table.
Use delta instructions when the non-resolution-specific parts of your programming have failed for some reason. Here are some situations in which deltas typically make sense:
- Rounding of a distance has produced an unattractive result. (If the distance was from the Control Value Table, consider using <control-value-delta>.)
- A feature does not render well at particular sizes, and you wish to remove or modify it. (But programming can also be made to operate at a range of sizes using an <if> construction.)
- Components of a composite glyph are poorly positioned relative to each other.
In addition, you may wish to use a delta to smooth a curve that has developed a kink, or to turn a pixel on or off. Before you use a delta, however, you should make sure that the problem you are correcting is not the result of your own careless programming: failure to use control values correctly, for example, or failure to think through the problems presented by a complex feature. It may well be less trouble to write a great many deltas than to think intensively about the intersection of two diagonals. But once you have written non-size-specific code that addresses a problem, it can easily be adapted to handle similar problems in the same or another font. The same can rarely be said of deltas. So think of the delta as a last resort or a finishing touch.
Another situation that may tempt you to use deltas arises when the original glyph outline contains small irregularities that show up only at certain low resolutions. When an o is not quite symmetrical, for example, it may appear lopsided at times. In this case you should consider whether the glyph's lack of symmetry is a feature you wish to preserve or an error you should correct. The best time to consider such issues as this is before you start writing the glyph program.
If you have used a graphical hinter like the one in FontLab, it may have left you in some confusion about where deltas can and should come in the sequence of a glyph program. Deltas may come anywhere, but they should generally be placed so as to correct any problems in the positioning of a point as early as possible. The letter q in the left-hand figure below illustrates. (The black lines show the original shape of the glyph and the green lines the grid-fitted shape; the brown squares show which pixels are on. The black vertical line shows the original right margin, and the green vertical line shows the grid-fitted one.)
|
|
The q on the left is too wide, and it bumps into the right margin. The problem arises after the left-hand curve has been hinted; then the overall width of the glyph is regulated by positioning point b relative to point a:
<move distance="bdpq-width">
<reference>
<point num="a"/>
</reference>
<point num="b"/>
</move>
The problem is that the distance "bdpq-width" gets rounded up at 15 ppem when it would be better visually for it to be rounded down. If you waited till the end of the glyph program to address this problem, you would need deltas to correct the position not only of b, but also of c, d, and several other points not shown here--for example, those that control the horizonal positions of the serif ends. All of these points are positioned relative to point b, so if you correct the position of b immediately after the execution of the instruction above, thus:
<delta>
<delta-set size="6" distance="-8">
<point num="b"/>
</delta-set>
</delta>
then the position of the others will automatically incorporate the correction, and the result will be the much better glyph on the right.
We can correct the problem even earlier than this, however. Notice that the <control-value> that controls the width of the q is named "bdpq-width": this is because that single entry controls the width of b, d and p as well as q. As the following figure demonstrates, the width of all