Repository navigation
[compatibility] Normalize contour points before comparing - #1173
Conversation
CompatibilityChecker walks masters index-by-index over the raw UFO point list. This is not the same logic used by the point pen in fontTools, which rotates the point list so that it ends on the first on-curve point (see https://github.com/fonttools/fonttools/blob/82cd560fd9/Lib/fontTools/pens/pointPen.py#L186-L188 ). This meant that the CompatibilityChecker would reject curves that were actually compatable, when two masters had serialized the same point list with a different start point. This makes CompatibilityChecker match the rotation logic of the point pen, which means fontmake can now compile a number of fonts that it would previously fail on, such as Exo, Raleway-Italic, and RobotoMono-Italic. Note that for a contour that really is incompatible, the reported point index is now in normalized rather than glif order.
|
we should not apply this rotation unconditionally. cu2qu rewrites the glyph through the segment pen (so it actually rotates) only when a cubic was converted or varLib then does not error in this case but simply warns "glyph has incompatible masters; skipping" and the VF ships with empty gvar glyph with no variations. The keep-direction/keep-quad exists exactly so that point indices stay put (e.g. for manual VTT hinting workflows where that matters). You could add a
maybe say "point N (counting from the first on-curve point)" so it isn't read as a glif index |
Make the normalization behaviour controlled by a flag, so that we can more closely control when it runs, ensuring that the CompatibilityChecker is matching the behaviour used to generate the actual contours for interpolation.
Been looking at the various cases on crater where fontmake fails and fontc doesn't, and came across this.
CompatibilityChecker walks masters index-by-index over the raw UFO point list. This is not the same logic used by the point pen in fontTools, which rotates the point list so that it ends on the first on-curve point (see https://github.com/fonttools/fonttools/blob/82cd560fd9/Lib/fontTools/pens/pointPen.py#L186-L188 ).
This meant that the CompatibilityChecker would reject curves that were actually compatable, when two masters had serialized the same point list with a different start point.
This makes CompatibilityChecker match the rotation logic of the point pen, which means fontmake can now compile a number of fonts that it would previously fail on, such as Exo, Raleway-Italic, and RobotoMono-Italic.
Note that for a contour that really is incompatible, the reported point index is now in normalized rather than glif order.