I’m thinking about a script that would set global guidelines to each alignment zone of each master (position+size) and, since I’m pretty new at programming I’m posting this topic in order to get some of the basic information/workflow about how this script should be built. Any suggestions?
Now I have a very basic scheme (Obviously I’m not using the syntax, it’s just a sketch):
· Master
· Alignement zones (position, size)
· Guideline (set guideline).
for master in Font:
for i in master.alignmentZone:
setGlobalGuideline
font = Glyphs.font # frontmost font
for master in font.masters: # iterate through its masters
master.guideLines = [] # delete existing global guides (remove line if you do not want this)
heights = [] # list for collecting all heights
for zone in master.alignmentZones: # iterate through zones
heights.append(zone.position) # add zone's pos to heights
heights.append(zone.position+zone.size) # add zone's other end as well
heights = set(heights) # trick for getting rid of potential duplicate entries
for height in heights: # iterate through remaining heights
newGuide = GSGuideLine() # create a new guide object
newGuide.position = NSPoint(0,height) # set its position, y=height
master.guideLines.append(newGuide) # add the guide to the master
Sometimes I discovered some points were moved 1 or 2 ems inside the alignments zones. Since the red circle around the point is always shown without difference if the point is on the end of the alignment zone or inside it I discovered that, setting global guidelines led me know if the point was at the end of the alignment zone. If I put a global/local guideline at the size of the alignment zone I can see that “diamond” around the point instead the circle. That is showing me more precisely that that point is not displaced.