Most common approach to round a non-integer coordinate for Italic Angle?

Hello. I'm working on the plugin for Glyphs that highlights the segments that are not precise (or not closest) to Italic Angle, and proposes the coordinate where the angle will be precise (or closest to it). For a better understanding, here's a preview of how it works:



However, I have a dilemma on how to round the angle with decimal coordinates to the integer ones on the x axis (marked with the red color on the image below). Even with a good Italic Angle ratio, such a rounding cases usually happens in the middle bar of H or E, or in hyphen, etc.



My first implementation was to round to the closest coordinate (left side on the image above), so the angle could be greater or smaller (of precise) depending on which coordinate is closer. Then we talked with Tim Ahrens and he proposed to round down (to a coordinate with a smaller angle) if precise angle is impossible to fit (right side on the image above). By "rounding down" I mean to move the upper node to the left integer, or to move the lower node to the right integer, to have a smaller angle. Perhaps, Tim's approach makes a sense because, for a very short segments, a smaller angle will give less peaky shape. However I still have some doubts of what is best for everyone. So for now I implemented both approaches with an option to switch the rounding mode – to always round down, or to round to a closest coordinate.

The question is what the approach should be by default – round to a closest coordinate or round down. Please share your personal preference, if possible with a reasoning. Thanks in advance.

Comments

  • Simon Cozens
    Simon Cozens Posts: 791
    The kind of rounding for OpenType Variations - where you often end up with fractional values that need to be rounded - is specified in the OpenType Spec:

    round the result to the nearest integer (for fractional values of 0.5 and higher, take the next higher integer; for other fractional values, truncate).

    So that's what variable fonts will do; I suggest that should be the default.
  • Hi Simon. I'm agree that what the specification describes is a common approach in general, but I wonder if it could be different when we're talking about Italic Angle. I try to find the logic in Tim's approach, like what are the advantages of rounding down instead of rounding to the closest coordinate? The only thing that comes to mind is that in some cases the shapes become less sharp when the angle is smaller. I know this is more of a question to Tim, but I'm curious what others think about this and if anyone else uses the rounding down approach.