From d71ef2647cb6542bafd3ca01fdfaa5e5bdcdd042 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Tue, 30 Jan 2024 15:57:55 +0000 Subject: [PATCH] [anchor_propagation] fix adjusting mark component's named ligature anchor Fixes the issue described in https://github.com/googlefonts/glyphsLib/pull/975#issue-2108199066 --- Lib/glyphsLib/builder/anchor_propagation.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/glyphsLib/builder/anchor_propagation.py b/Lib/glyphsLib/builder/anchor_propagation.py index d2399db39..4fe7455aa 100644 --- a/Lib/glyphsLib/builder/anchor_propagation.py +++ b/Lib/glyphsLib/builder/anchor_propagation.py @@ -110,10 +110,17 @@ def _adjust_anchors(anchor_data, ufo, parent, component): t = Transform(*component.transformation) _componentAnchor = _componentAnchorFromLib(parent, component) for anchor in glyph.anchors: + if anchor.name.startswith("_"): + # only base anchors should get propagated + continue # adjust either if component is attached to a specific named anchor # (e.g. top_2 for a ligature glyph) # rather than to the standard anchors (top/bottom) - if _componentAnchor and _componentAnchor in anchor_data: + if ( + _componentAnchor is not None + and _componentAnchor.startswith(anchor.name + "_") + and _componentAnchor in anchor_data + ): anchor_data[_componentAnchor] = t.transformPoint((anchor.x, anchor.y)) # ... or this anchor has data and the component also contains # the associated mark anchor (e.g. "_top" for "top") ...