Detect Overlaps with Script

Has someone made a script already :blush:?

Wei have you seen Touche?

For Robofont but perhaps the logic could be ported to a Glyphs script?

What exactly do you mean? Overlaps of paths with each other?

There’s a glyphs app version of Touche already actually! (I made a fork which outputs the results as tabs :slight_smile: https://github.com/weiweihuanghuang/Touche )

@mekkablue I mean to check which glyphs have path overlaps in itself

You could make a copy of the paths, remove overlap and check if they changed (removing overlap mostly changes the start point so your comparison needs to take this into account).

Do you have any advice to rule out false positives where glyphs without overlaps but through the process of apply remove overlap their starting point changed?

I have tried running a “correct path directions” on both the original gylph and the new “remove overlap” glyph, but there’s still situations where the new and old will have a different starting point even though nothing has changed – i.e. it flip flops between 2 points.

You could just do a more thorough analysis, I guess? Something that is geared to what you need this for.

Here is some code that might help. There are overlaps if the len() of the segments changes.

paths = list(Layer.paths)

GSPathOperator = NSClassFromString("GSPathOperator")
segments = GSPathOperator.segmentsFromPaths_(paths)
print len(segments)
PathOperator = GSPathOperator.new()
PathOperator.addIntersections_(segments)
print len(segments)
2 Likes

thanks georg thats really helpful!