Detect Overlaps with Script


#1

Has someone made a script already :blush:?


#2

Wei have you seen Touche?

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


#3

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


#4

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


#5

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).


#6

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.


#7

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


#8

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)

#9

thanks georg thats really helpful!