Updating editview/metrics during manipulation


Is there a method to force Glyphs to update the EditView/Metrics (similar to what Font>Save do) displayed when manipulating sidebearings or components?

I’m using a script to check if auto-alignments are synced across files and fix them. It works, but for nested components, it needs to be run 2 or 3 times to work properly.

You can add a loop calling layer.doAlignComponents() for all layers.

Thanks for the tip, but it doesn’t solve my problem.

I think the issue lies in how glyphs made with components are updated when a component is modified.

It seems that the component position/outlines are only overwritten when glyphs need to be drawn in EditView.

Here’s an example:

I have a script to check path height consistency between Roman and Italic. Let’s say it found inconsistencies in O, Ô, and Ö. I discover the problem came from the O component, so solving it should resolve the issues in the others. However, when I solve it and run the script again, it continues to report Ô and Ö as if their data hasn’t been updated.

If I save, close, and reopen my .glyphs file, they are no longer reported by my script.

Just saving should be enough.

But you can add a layer.alignComponents() in your script before you query the layer. That should update it.

I tried but neither work :confused:

Here is snippet to get minY and maxY of shapes of a layer :

c_Layer = Layer.copyDecomposedLayer()

for s in c_Layer.shapes:
	print(int(s.bounds.origin.y), int(s.bounds.size.height))

I would not do this:

c_Layer = Layer.copyDecomposedLayer()

The shape.bounds require that the layer as a parent. But the c_Layer doesn’t have one.

for s in Layer.shapes:
	print(int(s.bounds.origin.y), int(s.bounds.size.height))

And if you have problems with not updated aligners, loop over all glyphs/layer and align them, first.

for glyph in Font.glyphs:
    for layer in glyphs.layers: