Generating Instances with Rounded Integer Values



  • I noticed when I generated instances with DesignSpaceEdit, all the point and kerning values were floating points (1 decimal), is there a way to generate instead so that they're all rounded to integers.

    I need to compare the difference between a large bunch of UFOs and the old instances I am comparing to have rounded integer values, but with the new bunch of instances it's returning false positives using DigestPointPen() since 110 and 110.0 aren't the same.


  • admin

    hello Wei,

    you can generate instances using DesignSpaceProcessor directly, it has an option to round all coordinates:

    from ufoProcessor import DesignSpaceProcessor
    
    designspacePath = 'myFolder/example.designspace'
    
    D = DesignSpaceProcessor(ufoVersion=3, useVarlib=True)
    D.roundGeometry = True
    D.read(designspacePath)
    D.generateUFO()
    

    cheers!



  • Awesome thank you so much!