is there already a script, that “re-interpolates Metrics” of all brace layers at once?
I guess it might be written within two minutes, but I can’t script
Right now I am opening all glyphs with “New Tab with all Brace Layer” and select all brace layers manually to re-interpolate matrice. I think this could be perfectly done with a script within seconds instead of one hour.
finally, I tried do the script. I took your existing script “New Tab with Special Layers” and modified it, but it doesn’t work as expected. Basically, I just replaced the “newTab” function with “reinterpolateMetrics”.
Within the Makro Window, I get this error:
Traceback (most recent call last):
File "<macro>", line 19, in <module>
AttributeError: 'NSKVONotifying_GSFont' object has no attribute 'reinterpolateMetrics'
This is the script right now, I have no idea why the function doesn’t work.
#MenuTitle: Reinterpolate Brace Metrics
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Reinterpolates Metrcis of all special (bracket & brace) layers.
"""
Glyphs.clearLog() # clears log of Macro window
thisFont = Glyphs.font # frontmost font
affectedLayers = []
for thisGlyph in thisFont.glyphs: # loop through all glyphs
for thisLayer in thisGlyph.layers: # loop through all layers
# collect affected layers:
if thisLayer.isSpecialLayer:
affectedLayers.append(thisLayer)
# Reinterpolate Brace Metrics:
if affectedLayers:
reinterpolateMetrics = thisFont.reinterpolateMetrics()
reinterpolateMetrics.layers = affectedLayers
# otherwise send a message:
else:
Message(
title = "Nothing Found",
message = "Could not find any bracket or brace layers in the font.",
OKButton = None
)
Any help is really appreciate. My current typeface has to many Brace Layers to do it by hand…
You must call reinterpolateMetrics on a GSLayer object. While you iterate through layers, you can just call that on every one for which isSpecialLayer is True
Note: the function reinterpolateMetrics() is not documented on the Python Scripting API doc. This would have saved me a lot of time, instead I wrote some really clunky script to do this manually