Control selection state of extra nodes

Hello, I would like to control the selection state of extra nodes (or handles, as I found out they’re called). Is this possible? I tried handle.selected, but this doesn’t exist. Looking through the available methods, I can’t find one that would allow me to control the selection state.

A related question: How do I iterate over the extra nodes in a layer?
print(Layer.extraHandles()) doesn’t return anything.

What extra nodes/handles do you mean?

The intersections of paths, the grey dots you can click on. When I select one and run print(Layer.selection[0]), a GSHandle is returned.

Those are extra nodes. They do not belong to the layer, as they depend on the tool that is currently active.

Is there any way of setting their selection state?

What are you trying to do? The extra nodes are stored in the selection tool I would need to refactor that a but to improve script access.

I am reading coordinates from fontbakery checks and want to highlight the nodes in question. This works fine for regular nodes, but since fontbakery also reports nodes at intersections, I would like to highlight these as well, if possible.

I have since decided to just write a reporter to highlight nodes instead, this will somewhat circumvent the issue.

Hi, Georg, as a Chinese font designer, I need this function: select all the extra nodes of the current character at once, and then add corner ink traps. You know, there are so many strokes in Chinese characters, and it takes too much time to select one time.

1 Like

You can use this script:

tool = Font.parent.windowController().toolEventDelegate()
Layer.selection = tool.currentTool().extraHandles()

Wow, that’s great!
It works, thanks!

Hello, I have a new idea: Is it possible to put the extra node add corner component in the exported custom parameter?

Perhaps with the LayerGeek plug-in.

Thank you for your suggestion, I don’t know anything about scripts, I may need to ask the developers for help

How to add corner components on GSHandle? The following script shows that the added corner component is not in this GSHandle, it at the origin.

for handle in tool.currentTool().extraHandles():
    corner = GSHint()
    corner.name='_corner.abc'
    corner.type = CORNER
    corner.originNode = handle
    layer.hints.append(corner)

If you want to do something that requires scripting, it is a good opportunity to pick up some Python. You can learn the basics in an afternoon.

1 Like