From 1637a0f676c9e51140607770b5cf6bab1eb11fc5 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Thu, 15 Jul 2021 16:17:48 +0100 Subject: [PATCH] Sanity check before translating --- Lib/ufo2ft/filters/optimizeAnchors.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/ufo2ft/filters/optimizeAnchors.py b/Lib/ufo2ft/filters/optimizeAnchors.py index 773216b8d..af7395713 100644 --- a/Lib/ufo2ft/filters/optimizeAnchors.py +++ b/Lib/ufo2ft/filters/optimizeAnchors.py @@ -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)