Can I use the NSClassFromString(“GlyphsFilterOffsetCurve”) function on individually selected paths in the macro version? Currently, it can only be applied to all paths at the same time.
You can use this:
OffsetCurve = NSClassFromString("GlyphsFilterOffsetCurve")
offsettedPaths = OffsetCurve.offsetPath_offsetX_offsetY_makeStroke_position_objects_capStyleStart_capStyleEnd_(path, offsetX, offsetY, makeStroke, position, None, capStyleStart, capStyleEnd)
My code is as follows, and the comments in the code are the results obtained. Can you give a simple example to explain how to operate it specifically so that it can obtain the correct result?
OffsetCurve = NSClassFromString("GlyphsFilterOffsetCurve")
for layer in Glyphs.font.selectedLayers:
# If I use offsetLayer, I can get the normal result.
OffsetCurve.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_error_shadow_(layer,10,-30,False,False,0.5,None, None)
layer.paths[1].selected = True
# If I use offsetPath, there is no change, but I can continue to run and get 'offsetPath-1'.
OffsetCurve.offsetPath_offsetX_offsetY_makeStroke_position_(layer.paths[1], 10, -30, False, 0.5)
print('offsetPath-1')
for path in layer.paths:
if path.selected == True:
# The result of this is the same as the one above.
OffsetCurve.offsetPath_offsetX_offsetY_makeStroke_position_(path, 10, -30, False, 0.5)
print('offsetPath-2')