Is it possible to add alignment zones in a script? I assume so (partly because of the addAlignmentZone function in the core API doc), but could you please help me undertand what syntax is required?
For example, I want to find the max Y point of my /Aring out of all masters, then add an alignment zone there, across all masters. I also want an alignment zone mirroring this, but below the baseline.
My overall script is like this (it’s not yet working):
font = Glyphs.font
# vertically centers bounding box on caps
ascent = 2816
descent = -768
for master in font.masters:
master.addAlignmentZone_([2816, 16])
master.addAlignmentZone_([-768, -16])
The master.addAlignmentZone_
is erroring.
I’ve tried:
> master.addAlignmentZone_(2800, 16)
> master.addAlignmentZone_(-752, -16)
Which returned the error:
Traceback (most recent call last):
File "<string>", line 14, in <module>
TypeError: Need 1 arguments, got 2
So, I then tried:
> master.addAlignmentZone_(2800)
> master.addAlignmentZone_(-752)
…which resulted in this error:
Traceback (most recent call last):
File "<string>", line 16, in <module>
ValueError: NSInvalidArgumentException - -[OC_PythonNumber setParent:]: unrecognized selector sent to instance 0x600007d61a10
…and:
> master.addAlignmentZone_([2800, 16[)
> master.addAlignmentZone_([-752, -16])
…which resulted in this error:
Traceback (most recent call last):
File "<string>", line 16, in <module>
ValueError: NSInvalidArgumentException - -[OC_PythonArray setParent:]: unrecognized selector sent to instance 0x600007d16f30
How might I set these in script? Thanks for any tips!