Anchor position relative to layer width?

I have some anchors that I want them to be always at (0, layer.width), so if the layer width changes they would automatically move as well. Is there a way to do this in Glyphs? (I can script my way through it, but I’d need to remember to move the anchor every time I edit the layer and change its width)

I wonder whether you could use a horizontally flipped component, the original glyph would have the anchor at 0, 0.

Yes.

anchor = Layer.anchors["topright"]
anchor.setOrientation_(1)
print(anchor.orientation())
"""
	GSAlignmentLeft = 0
	GSAlignmentCenter = 2
	GSAlignmentRight = 1
"""
1 Like

Interesting. That is exactly what I needed, except that I now need glyphsLib to support it.

It would be nice to have some GUI for handling this as well.

This works with nodes, too. This can be useful to keep the in-stroke nodes at the RSB.

I add it to the wrapper so with the next version (3209) it will be:

anchor = Layer.anchors["topright"]
anchor.orientation = 1
print(anchor.orientation)
2 Likes

My big issue right now is that anchor positions are saved in the file relative to the alignment origin, but if they were saved as absolute values (as they are presented in the UI), Glyphs would keep them aligned and external tools would not need to explicitly support the alignment.

Good point. I’ll see if I can adjust that. There is hopefully nobody else using that feature :sweat:

1 Like