Skip to content

Instantly share code, notes, and snippets.

@raphlinus
Created December 7, 2019 20:01
Show Gist options
  • Select an option

  • Save raphlinus/c31c92af12aab5aa62a975d0cf4c7c2a to your computer and use it in GitHub Desktop.

Select an option

Save raphlinus/c31c92af12aab5aa62a975d0cf4c7c2a to your computer and use it in GitHub Desktop.

Revisions

  1. raphlinus created this gist Dec 7, 2019.
    20 changes: 20 additions & 0 deletions decompose_var.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    # 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()