Created
December 7, 2019 20:01
-
-
Save raphlinus/c31c92af12aab5aa62a975d0cf4c7c2a to your computer and use it in GitHub Desktop.
Script to decompose components with mismatched 2x2 matrix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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