How to batch convert the “==” metric key to value?

Does anyone know if there is there a script that will remove all double equal signs “==” from metric keys and set whatever value it is currently at?

Yes there is. Try Script > mekkablue > Spacing > Find and Replace in Metrics Keys.

Looks like Remove Layer-Specific Metrics Keys might what I am looking for…although when trying it, it doesn’t seem to be working.

Is it supposed to change like this?
==100 → 100 (this type conversion is my main objective)
==H → H

If there is something such as
LSB: =H RSB: =|
it correctly simplifies =H → H
and =| → | (which is incorrect syntax?)

The double equal sign means that the metric key is attached to the layer and not to the glyph.

A metrics key starts with an equals sign =. It can only be left out if what follows is exactly one glyph name. Since | cannot be a glyph name, it must be =|.

The problem is, what should happen if one layer has ==H, and another layer has ==H+5?

This is a fundamental difference. =100 and ==100 are metrics keys that can be updated with Glyph > Update Metrics. But 100 is just a metric value (typically LSB, RSB or width). Are you sure you want to remove the metrics key altogether?

You should not so much look at the equal sign but more if the key is in the layer or the glyph. And if there is one at the layer and none at the glyph, remove it in the layer and add it to the glyph. If there are keys in both and they are different you need to decide what to do.

At the moment, the Remove Layer-Specific Metrics Keys script doesn’t catch that and simplifies =| → |

Hmm not sure. These should prob be left alone or reduced to the resulting value.

I guess I am still unclear of what is meant by the script description “Deletes left and right metrics keys specific to layers (==), in all layers of all selected glyphs.”

Essentially, I want to be able to remove metric keys only when they are double equal signs followed by a lone numeric value (==100)…without affecting anything else (=100, =H, =H+5, =|, etc).

I tend to use ==[number] while drawing (in combination with Sync Metric Keys) to set a sidebearing value, adjust the outline, adjust sidebearing, and have everything updating automatically. (for example: the RSB of “L” can be set to ==10 and the horizontal bar can extend/retract and the sidebearing will remain 10) It’s not really necessary to keep after so I am trying to remove the == and only leave the value.

Just get rid of the layer-specific keys? Put this in Macro window and run it:

for g in Font.glyphs:
	for l in g.layers:
		l.leftMetricsKey = None
		l.rightMetricsKey = None
1 Like