Skip to content

Instantly share code, notes, and snippets.

@raphlinus
Created December 7, 2019 20:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphlinus/c31c92af12aab5aa62a975d0cf4c7c2a to your computer and use it in GitHub Desktop.
Save raphlinus/c31c92af12aab5aa62a975d0cf4c7c2a to your computer and use it in GitHub Desktop.
Script to decompose components with mismatched 2x2 matrix
# Script to decompose components with mismatched 2x2 matrix
# See https://github.com/googlefonts/fontmake/issues/595
for glyph in Glyphs.font.glyphs:
#print glyph
xforms = []
mismatch = []
for (i, layer) in enumerate(glyph.layers):
for (j, component) in enumerate(layer.components):
if i == 0:
xforms.append(component.transform)
else:
if xforms[j][:4] != component.transform[:4]:
if j not in mismatch:
mismatch.append(j)
if mismatch:
print glyph.name, mismatch
mismatch.reverse()
for layer in glyph.layers:
for j in mismatch:
layer.components[j].decompose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment