compare paths independently of contour order

the order of contours modified by Skia is not stable and may change. So when we compare the original and the modified paths, we compare the paths as unordered sets of contours.

The order of contours doesn't produce any visible difference, but we try to keep the changes to the minimum here to avoid unnecessary diffs
This commit is contained in:
Cosimo Lupo 2020-09-30 13:40:01 +01:00
parent 66a0d91bf9
commit 7f9462dfa6
No known key found for this signature in database
GPG Key ID: 179A8F0895A02F4F

View File

@ -95,8 +95,8 @@ def removeTTGlyphOverlaps(
# remove overlaps # remove overlaps
path2 = pathops.simplify(path, clockwise=path.clockwise) path2 = pathops.simplify(path, clockwise=path.clockwise)
# replace TTGlyph if simplified path is different # replace TTGlyph if simplified path is different (ignoring contour order)
if path2 != path: if {tuple(c) for c in path.contours} != {tuple(c) for c in path2.contours}:
glyfTable[glyphName] = glyph = ttfGlyphFromSkPath(path2) glyfTable[glyphName] = glyph = ttfGlyphFromSkPath(path2)
# simplified glyph is always unhinted # simplified glyph is always unhinted
assert not glyph.program assert not glyph.program