I’m running a script that centers anchors in an outline glyph but am noticing that the component (plus another nested component) that it is used in isn’t updating…for example the dot of the i isn’t aligning to the stem even though the anchors are centered after running this script. It is only after I click on the component that is jumps into the correct position.
I suspect there is some update interface solution. Also thought that it would adjust itself on export or after saving but it doesn’t.
Is there some way to run a script that will force an update on the components and the interface to make sure everything in the file is completely updated?
import GlyphsApp
from Foundation import NSPoint
import math
font = Glyphs.font
print("Updating all components...")
for glyph in font.glyphs:
for layer in glyph.layers:
for component in layer.components:
offset = NSPoint(1, 0) # small offset
component.applyTransform([1, 0, 0, 1, offset.x, offset.y]) # move slightly
component.applyTransform([1, 0, 0, 1, -offset.x, -offset.y]) # move back
print("All components updated.")
You can try disabling and reenabling updates for the interface with font.disableUpdateInterface() and the same thing with enable. Actually best to put the disable early in the script and the enable late, speeds up the script.