I’m trying to check for superscript and subscript letters that are at the wrong Y height, but it would be easier to either check for those already at the right value, mark those, and then go through the rest one by one, or to specifically search for glyphs marked as superscript/subscript that does not have a spesified elevation value.
Have a look at the magical world of Python. Glyph’s scripting API is very comprehensive and well documented.
Cycle over all (selected) superscript glyphs. For each glyph, cycle through its layers. In each layer, check the component’s position and report an error if it is not at a specified y value. Ideally, simply set the component’s y position to the desired value.
This is doable in 3 lines of Python:
for glyph in Font.selection:
for layer in glyph.layers:
layer.components[0].position = (layer.components[0].position.x, 400)
This code is a bit inelegant in oder to fulfil the three-line promise, but it works. Replace 400 with whatever value you actually want.
This script will position the first component in all layers of your selected glyphs at y=400.
You could write a script that check the height of one of the superscripts (that you hand checked) like the superscript zero. Then apply the same y coordinate to all other superscript for that master.
That’s what my script above does (except it takes a manual value).
Here you define a reference glyph (zerosuperior):
reference_glyph = Font.glyphs["zerosuperior"]
for glyph in [g for g in Font.glyphs if "superior" in g.name and g != reference_glyph]:
for layer in glyph.layers:
layer.components[0].position = reference_glyph.layers[layer.associatedMasterId].components[0].position