Set global guidelines to alignment zones

Hey there,

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

I’m in the right direction?

Thank you so much.

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
1 Like

But why do you need the guides. The zones are kind of guides already.

1 Like

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.

Does it make sense?

That makes sense. But you need to check the overshot visually not so much mechanically.

1 Like

Take a look at the Show Tops and Bottoms plug-in. Could be of use here.

1 Like

I know, Georg. However, sometimes I need to be very constant in the overshoot so I need that nodes to be on the right position.

Thank you so much, Rainer! I’ll take a look.