Is there a method in TrueType hinting to round a point to the grid along one axis, and then shift another point by the same amount, but along a different axis?
I am attempting to shift a diagonal line such that it remains at a 45 degree angle, but has both its endpoints rounded to the nearest intersections of the raster grid lines. I have managed to get the top point in the attached picture rounded to the grid in the vertical direction, and the bottom left point shifted in the vertical direction to match, and to get the bottom left point rounded to the grid in the horizontal direction, and the top point shifted in the horizontal direction to match, using this xgridfit code:
<with-round-state round="to-grid">
<with-vectors axis="x">
<move>
<point num="1"/>
<shift><point num="2"/></shift>
</move>
</with-vectors>
<with-vectors axis="y">
<move>
<point num="2"/>
<shift><point num="1"/></shift>
</move>
</with-vectors>
</with-round-state>
Point 1 is the point in the bottom left of the picture. Point 2 is the point at the top of the picture. The line connecting them is the one I am trying to keep at 45 degrees.
The next step is to round the top point in the horizontal direction, and
move the bottom point in the vertical direction the same amount to
compensate and keep the angle of the line at 45 degrees.
Thank you for your time,
Patrick
Comments
I note that the width of a diagonal line at 45 degrees can be any half integer multiple of sqrt(2) that is greater than or equal to sqrt(2). For example, the line on the left in the attached picture has a width of sqrt(2) and the line on the right in the attached picture has a width of 1.5 * sqrt(2).
And other than dropout control being on/off, there is no notion of pixels being on: all you do is control distances between specified points (typically on-curve points, but they can be off-curve). You can move specified points either before or after you interpolate untouched points (IUP) for all other points. For most big effects and regularization, you are doing “before” hints. For fine tuning of a curve or diagonal, it might be after.