How to flatten sidebearings on a whole master?

Hello,
for an entire master, I’d like to flatten all dynamic values in sidebearings (ex: =| or =N*1.2 etc)

How can I do it?
Thanks in advance

You could use a script:

for l in Font.selectedLayers:
    l.setLeftMetricsKey_(None)
    l.setRightMetricsKey_(None)

(edited, see post below)

It works, thanks!

that’s a nice one. thanks.

one question: is it always recommended to double the metrics keys in a script that deals with metrics keys – like you did here with the parent and without? (why) wouldn’t the parent line be enough?

I just checked and it is not necessary to set the metrics key of the parent.

Georg, thanks for the info!

Hi, Georg. I’ve tested this script today with the last G2 version, but it doesn’t work as expected. When flattening values, it writes them as

== (nn)
where nn is a number.
It is coloured in blue, as an invalid setting.

The script should be

for l in Font.selectedLayers:
    l.leftMetricsKey = None
    l.rightMetricsKey = None

worked, thanks :slight_smile:

There’s a mekkablue script for that already: Spacing > Remove Metrics Keys.