Bind a component with a node

Hi,

Is there a way to bind a component with a node? I have to realign all serif components after changing width with RMX Tuner.

I could make use of userData prop of a node, but how to identify a component? Does a component instance have a unique id that I could assign to the userData prop of a node?

The only solution I can think of is to store a component index from layers.components array, but it requires rebinding after every operation like adding, removing, fixing compatibility…

1 Like

A GSNode has a name attribute. You could use that to identify nodes.

Have you considered converting to corner components?

A GSNode has a name attribute.

I don’t understand how? Docs say:

Name of the master. This usually is a combination of GSFontMaster.weight and GSFontMaster.width and is a human-readable identification of each master, e.g., “Bold Condensed”.

Have you considered converting to corner components?

No. I need smart components.

You quoted the name attribute of GSMaster, under GSNode, it says:

Attaches a name to a node.
Type: unicode

Ahhh yes. Because a link is broken. When I click ‘name’ under GSNode the page scrolls to GSMaster.

However, I have no problem with identifying a node but a component. Is it possible?

I can try to add a userData to the components. But did you try corner components? They are aligned automatically.

Yes, I tried corner components, but I need smart components. I need to change serifs’ width.

Georg, userData or unique id of a component instance would do the job for me :slight_smile:

For now, you could misuse the .anchor property of the component.

Good idea! Thanks!

I added .userData to the components in version 1089.

1 Like

@GeorgSeifert have u considered smart corner components?

1 Like

Yes.

1 Like