Skip to content

Commit

Permalink
Sanity check before translating
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Jul 16, 2021
1 parent afb06e4 commit 1637a0f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Lib/ufo2ft/filters/optimizeAnchors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ def filter(self, glyph):
# We're a base!
return False

# More sanity checks: skip over spacing marks
if glyph.width != 0:
return False
# Also skip over marks which are deliberately positioned over the
# previous glyphs
if glyph.getBounds().xMax < 0:
return False

# We are a mark glyph with (at least) one attachment point.
theanchor = glyph.anchors[0]
self.context.matrix = Identity.translate(-theanchor.x, -theanchor.y)
Expand Down

0 comments on commit 1637a0f

Please sign in to comment.