After doing some transformations on a glyph in Python the resulting coordinates are fractional. Even though I set the grid spacing back to 1 afterwards and round all the coordinates in a script, the nodes are still coloured red in Glyphs as they are floating point numbers that differ from the integers after 10 decimal places or so:
# round all coordinates for path in Layer.paths: for node in path.nodes: node.x = int(round(node.x)) node.y = int(round(node.y)) if (node.x != round(node.x)): print ("fractional coordinates in ", node, node.x, round(node.x))
fractional coordinates in <GSNode 0x60016401bae0> 610 -24 CURVE SMOOTH 609.9999999999998 610
Is there a way I can set the coordinates back to the integer values they were before the transformation?
I looked but couldn’t find a method to remove fractional coordinates in one go.