Dynamic Anchors positioning?

It is planned in the next big update to implement something like this:​

Export-1722627826280

A way to link a node or segment to an anchor, plus some instructions to always update the anchor’s position? I think I already read something about a similar concept in the forum, but cannot find.

Plus, I have a question: Is there a syntax to add some text in an anchor name that is ignored by glyphs (like a comment)?

4 Likes

no.

What kind of comment are you speaking about?

you could add a comment to the anchor’s userData, e.g. GSAnchor.userData['comment'] = 'your comment'

Is this the post?

1 Like

Something like syntax used for GlyphsData.XML

ogonek@maxX;baseline

That’s what I used to make my demo :wink:

This syntax is currently only used to better approximate the initial position. It can’t center on a stem, only at the bounding box.

I know, but I was wondering if it was possible to set a text in anchor name ignored by glyphs.
I will try to make a plugin to do what I want, and will be really helpful if I could use anchor name to specify some rules instead to use anchor.userData

To make the anchor name work in that way would mean to change almost all code that handles anchors. We are trying to move away from using names to store data (e.g. with the layer attributes that where stored in the name before).
I would suggest to make a custom sidebar property view (like the one for context anchors) to allow input of the extra info and draw that alongside the anchor name

1 Like

I’m interested in hearing users’ thoughts on this.
Currently, I am considering implementing these dynamic links:

  1. Node: To keep anchors always synchronised with the position of a node.
  2. Segment: To ensure anchors are always at a specific time within a segment, such as the midpoint.
  3. Path: To maintain anchors at a specific location within a path’s bounding box, such as the middle or top right.
  4. Layer: To keep anchors synchronised with the layer’s bounding box.

I would like to implement something similar to the existing syntax/system for setting default anchor position in GlyphData.xml.

1 Like

Consider linking to “1 or 2 nodes” instead:

1 Like

Export-1722953704196

3 Likes

bg wesh

1 Like

That’s super cool. It would be nice if you could visualise which nodes the anchor is referring to, like arrows in TT hinting. Also, there may be a use case for simple calculation (e.g. +10 from node, or 30% on the left rather than dead centre).

1 Like

All this is already planned :wink:

1 Like

Export-1723018927252

3 Likes

Cool, I think it would make more sense to let the arrows flow from the anchor to its nodes instead of between the nodes. Because that’s basically the connection you create.
That way it’s also more clear if the anchor is farther away from its nodes (like if you have that vertically-middle-ish anchor in the /l)

1 Like

Here is a quick demo with four features :

  • Sync with 2 nodes
  • Sync with segment
  • Sync with path
  • Sync with layer bounding box
2 Likes

The curvy line feels strange. Seems like it should be some sort of straight line between the nodes with maybe a tick to represent at which point the anchor is aligning to.

centerX
•----|----•

I imagine the syntax would had some basic math functions like

centerX-10
•–|------•

Is there a demo of what the Sync with 1 node would look like?