GSPath.bezierPath returns GSSaveBezierPath type instead of NSBezierPath


#1

I’m trying to find if a point is inside a bezier path, by using AppKit’s NSBezierPath.constains().
According to the Glyphs’ API, when I do:

letter = "A"
allGlyphs = Glyphs.font.glyphs
letterLayer = allGlyphs[letter].layers[0]
print(type(letterLayer.paths[0].bezierPath))

I should expect to get a NSBezierPath, but I get an GSSaveBezierPath.


#2

GSSaveBezierpath is a subclass of NSBezierpath. So all methods work the same.


#3

When I do;

p = NSPoint(20, 20)
print(path.bezierPath.contains(p))

I get:
AttributeError: ‘GSSaveBezierPath’ object has no attribute ‘contains’


#4

NSBezierPath has no method contains() but one called containsPoint: