I am new to scripting with Glyphs and encountering an issue.
transform = NSAffineTransform.transform()
transform.translateXBy_yBy_(50, 0)
For instance, when I translate a glyph by 50 units in the x-direction like this, all origin and target information in the hints gets incremented by 50. The behavior I expect is that only the origins of vertical hints should be incremented by 50.
How can I achieve the expected behavior? I would also appreciate knowing whether the current behavior is a bug or if it is considered correct as per the specifications.
- Glyphs version: 3.2.2 (3259)
- Python version: 3.11.6 (Glyphs).
- macOS: 14.4.1
The full example code is as follows:
from Foundation import NSAffineTransform
# X-direction movement amount
x_factor = 50
# Select the currently open layer
current_layer = Glyphs.font.selectedLayers[0]
# Get hint information for the current layer
hints = current_layer.hints
# Output hint information before the transformation
print('before transform:')
for hint in hints:
print(hint)
print('\n')
# Define a transformation to move 10 units to the right
transform = NSAffineTransform.transform()
transform.translateXBy_yBy_(x_factor, 0)
# Apply the transformation
current_layer.applyTransform(transform)
# Output hint information after the transformation
print('after transform:')
for hint in hints:
print(hint)
Thank you in advance for your help.