Is there a quick way to cross-check the LSB and RSB of Duplexed weights?

I’m working on a font with duplexed weights and looking for a faster way to find glyphs whose LSB/RSB don’t match in duplexed weights. Rather than going through them individually.

Try running this in Macro panel (change MASTERNAME to your duplexed master names):
It’ll open the non-matching glyphs in a new tab.

font = Glyphs.font
master1 = font.fontMasterForName_('MASTERNAME')
master2 = font.fontMasterForName_('MASTERNAME')

newTabLayers = []

for glyph in font.glyphs:
	layer1 = glyph.layerForId_( )
	layer2 = glyph.layerForId_( )
	if layer1.LSB != layer2.LSB or layer1.RSB != layer2.RSB:
		newTabLayers.extend([ layer1, layer2 ])

font.newTab( newTabLayers )

Why the SBs? Duplexed usually means the widths are the same. Or what are you trying to achieve?

Taking a different approach of optimising the character shape width in weights and keeping the overall Glyph width same by optimising the SBs in the weights.

Alexs, thanks a ton for this :pray:
It is working and gonna save a lot of time for me.

I still don’t understand why you are focused on SBs instead of the glyph width.

If you want to work with glyph width instead, try this:

differing_layers = []
for glyph in Font.glyphs:
   for master in Font.masters[1:]:
   compare_layer = glyph.layers[]
       if glyph.layers[0].width != compare_layer.width:

Didn’t test as I’m writing from mobile, but this should print a tab with all layers that don’t have the same width as the first master layer for each glyph.

1 Like

For duplex fonts the width is usually more important (at least that is what the name usual mean).

You might try the “Link Metrics With First Master” custom parameter in all but the first master.