Find and Replace formulas in Metrics Keys

I am working on a project that started in Fontlab 7, and has the FL7 syntax for formulas, for a simple = on Glyphs, Fontlab duplicates it and show like this ==, it is useful for some exceptions, but in this specific case they are not necessary (and looks like a mess), I would like to know if there is any way to detect and change them to the basic sintax, or show them in a new tab to correct manually, I tried with Find and Replace in metric keys of Mekkablue scripts, but it doesn’t work if there is no numeric value. Same for all kerning groups, I tried adding smart filter but didn’t get any conditions that could work.

Thank you in advance

+1 for Find/Replace in metrics keys. Just renamed all 1000+ glyphs in a Burmese font and now all the metrics keys are borked. Is there any way to do the same with glyph names in classes and features? Like just ‘Replace Absolutely Everywhere’ in one go?

The double equal signs indicate that the metrics key is on the layer and not on the glyph. can you run this script in the macro panel:

g = Font.glyphs["yacute.ss04"]
print(g.leftMetricsKey, g.layers[0].leftMetricsKey)

There is a script in the @mekkablue repo that can search/replace metrics keys.

Thanks Georg, it works fine to visualize them :slightly_smiling_face:, but what I would like to do is convert all those metrics key on the layer to metrics key on the glyphs. In many cases some formulas from Fontlab don’t even work properly, especially those that have additions or subtractions.

What did it print?

It print:

(None, u'==y.ss04')

I was thinking it could be implemented on a smart filter like «Has formulas» (yes/no) or Metrics keys finder (is/is not) and a text field to input the type of symbol (=/+/-/*/@/÷/|/).

In the past I have used Harbor Type’s Rename Glyphs and Update Features script found here However, I can’t recall whether or not it did the whole job correctly in one go.

Then you could write a script like this:

for g in Font.glyphs:
	layer = g.layers[0]
	if g.leftMetricsKey is None and layer.leftMetricsKey is not None:
		g.leftMetricsKey = layer.leftMetricsKey[1:]
		layer.leftMetricsKey = None
	if g.rightMetricsKey is None and layer.rightMetricsKey is not None:
		g.rightMetricsKey = layer.rightMetricsKey[1:]
		layer.rightMetricsKey = None
1 Like

Many thanks Georg!

Thank you. I tried in G2 and G3, but the script isn’t doing anything at all unfortunately.

Oh, that’s a shame. it really is quite useful.

It works in both Glyphs 2 and 3 for me. Here’s the file I have. Rename Glyphs and Update (1.8 KB)

I get a report in the Macro Panel when I run it.

1 Like

Thanks for trying to help. Unfortunately although the macro panel is telling me it’s renamed glyphs in the classes and features, it hasn’t done that or renamed the actual glyphs: