syncMetrics() is a GSLayer method, not a GSGlyph method.
Try this:
for name in ['B','E','F','K','N','P','R']:
Glyphs.font.glyphs[name].leftMetricsKey = 'H'
for thisLayer in Glyphs.font.glyphs[name].layers:
thisLayer.syncMetrics()
Thanks @Nicolas, that did the trick. I have one more question though…
How can this be applied for multiple blocks without repeating the syncMetrics portion?
For example:
for name in ['B','E','F','K','N','P','R']:
Glyphs.font.glyphs[name].leftMetricsKey = 'H'
for thisLayer in Glyphs.font.glyphs[name].layers:
thisLayer.syncMetrics()
for name in ['C','G','Q']:
Glyphs.font.glyphs[name].leftMetricsKey = 'O'
for thisLayer in Glyphs.font.glyphs[name].layers:
thisLayer.syncMetrics()
collect all glyphs that you changed and then run another loop
allGlyphs = set()
LeftMapping = {'H' : ['B','E','F','K','N','P','R'],
'O' : ['C','G','Q']}
for key, names in LeftMapping.iteritems():
for name in names:
g = Glyphs.font.glyphs[name]
g.leftMetricsKey = key
allGlyphs.add(g)
for g in allGlyphs:
for thisLayer in g.layers:
thisLayer.syncMetrics()