GSComponent provides an openBezierPath, but it appears to return incorrect values.
layer = f.selectedLayers[0]
for c in l.components:
# from the current layer
print(c.openBezierPath)
# from the component's layer
c_layer = f.glyphs[c.componentName].layers[0]
print(c_layer.openBezierPath)
print(c.openBezierPath) returns below values instead of NSBezierPath.
<native-selector openBezierPath of <GSComponent 0x7feadcc8bab0> kiyeokCho-ko.001 (parent:<GSLayer 0x7feadcc8b870> Regular (gagg-ko)) {0, 0}>
print(c_layer.openBezierPath) returns below values.
Path <0x6000064af8e0>
Bounds: {{173, 455}, {124, 105}}
Control point bounds: {{173, 455}, {124, 105}}
173.000000 504.000000 moveto
….
Did I miss something to get openBezierPath from the component?
thanks in advance.
It should be component.bezierPath. Glyphs.app Python Scripting API Documentation — Glyphs.app Python Scripting API 3.5 documentation
There is a distention between .bezierPath and .openBezierPath as the one is usually filled but the other usually stroked. (.openBezierPath for components is missing from the python wrapper and docu page so you need to add ()). GSLayer has the same API.
print(layer.openBezierPath)
# but
print(component.openBezierPath())
Thanks,
component.openBezierPath() works!
I miss read your question. But answered it anyway 
1 Like
BTW,
How can we know whether completeOpenBezierPath has items or not?
openBezierPath returns ‘None’ while completeOpenBezierPath returns ‘Path’ if it has no items.
do we have to check whether it has any items in it with ‘hasContent()’ like below?
print(l.completeOpenBezierPath.hasContent())