Menu ▾ ▴

#195 Union produces different contour order depending on platform

*
closed
nobody
None
1
2019-11-29
2019-11-06
No

Hi!
We are wrapping 6.4.2 for Python over at https://github.com/fonttools/pyclipper to provide boolean operations for font editors and compilation of fonts. In https://github.com/typemytype/booleanOperations/issues/55, I found that the order of contours returned after an operation depends on the platform you're running on. In https://gist.github.com/madig/998ec05ef8a496f984aaa86aeceda6fc, I made a script to drive the Python wrapper directly, using the results of my Windows box. So far, I couldn't make out an obvious pattern. Is this a known limitation of the algorithm and is there anything we can do about it?

Discussion

  • Anonymous

    Anonymous - 2019-11-06

    Addendum for clarification: ideally, the contours stay in the same order across platforms, whatever that order is. This is important for font compilation because font hinting for TrueType fonts works on absolute point numbers, which depend on contour order.

     
  • Angus Johnson

    Angus Johnson - 2019-11-06

    Sorry, due to the sweep algoritm, this is how the polygons will be returned. There's no (easy) way to change this. Also, this might be a feature request but it isn't a bug :).

     

    Last edit: Angus Johnson 2019-11-06
  • Angus Johnson

    Angus Johnson - 2019-11-06
    • status: open --> closed
     
  • Anonymous

    Anonymous - 2019-11-06

    Oh well, thanks for the response. I'm curious though, why is the order tied to the platform? Or is it undefined behavior that just is?

     
  • Anonymous

    Anonymous - 2019-11-29

    due to the sweep algoritm, this is how the polygons will be returned. There's no (easy) way to change this

    I understand it may not be not easy to fix this, but it would nice if you could you elaborate a bit a bit more why this is happening.

    How is it not a bug that the results change depending on the platform in which the library is compiled?

     

Anonymous
Anonymous

Add attachments
Cancel