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!