When hinting glyphs, round y-offsets to integers#896
Conversation
|
This makes me think of rounding stuff in Parley recently. |
This one? linebender/parley#297 |
|
Yes, sir. |
DJMcNab
left a comment
There was a problem hiding this comment.
I don't know if we have any good docs for this, but https://docs.google.com/document/d/1gEqf7ehTzd89Djf_VpkL0B_Fb15e0w5fuv_UzyacAPU/edit?disco=AAABctut6QY is relevant (it's a link to a specific comment) here.
I don't think this is quite the right place to be doing this quantisation; we would need to be rounding the absolute y coordinate, not the "local" y coordinate.
Separately: ideally, there's be some way to warn if this changed frame-by-frame (that is, the baseline isn't rounded). But I don't think there's any way to detect that, because the relationship between y and the baseline is not so simple.
Hmm... I guess you're right, in that depending on |
Is it not impacted by the "adding" of the transform on (new) line 163? |
I was going to write it is not, but on second thought it is partially impacted. The order of operations is effectively: (Where you have to read However, if |
On top of #896 (that should land first). See c0b7786 and onwards for the changes here. This builds on the work landed in #889. This generalizes our detection of when (vertical-only) hinting can be performed. When the second coefficient (`b`) of the affine transformation matrix is 0 (first column, second row), glyphs are not skewed vertically or rotated, and can be hinted. Because of this generalization, the `horizontal_skew` special case has been removed. We now calculate the total transformation matrix once, and separately calculate the glyph translations using the run's transformation matrix for global glyph positioning. This reduces the number of affine multiplies per glyph to one-and-a-bit down from three.
Without this, while glyph outlines will be hinted to integers, the translation can bump the outlines to fractional locations again.