diff options
author | James Godfrey-Kittle <jamesgk@google.com> | 2015-04-22 17:10:27 -0700 |
---|---|---|
committer | jamesgk <jamesgk19@gmail.com> | 2015-04-22 17:10:27 -0700 |
commit | af4e18491e9e1e3013034d0ae5510c188df7ae0c (patch) | |
tree | b967b3bf523f640ff45d94cccd93c5e7a4d76c2b /scripts/lib | |
parent | dd4b6563cb396b47333fd7bf1d8934d67f6d6474 (diff) |
Clean up anchor addition code, include comments.
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/fontbuild/mix.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/lib/fontbuild/mix.py b/scripts/lib/fontbuild/mix.py index 1944258..bd396ed 100644 --- a/scripts/lib/fontbuild/mix.py +++ b/scripts/lib/fontbuild/mix.py @@ -254,14 +254,26 @@ class Master: for overlayGlyph in overlayFont: font.insertGlyph(overlayGlyph) + # work around a bug with vfb2ufo in which anchors are dropped from + # glyphs containing components and no contours. "anchorPath" should + # point to the output of src/v2/get_dropped_anchors.py if anchorPath: - anchorData = json.loads(open(anchorPath).read()) + anchorData = json.load(open(anchorPath)) for glyphName, anchors in anchorData.items(): - if not self.font.has_key(glyphName): + + # another bug: some entire glyphs are dropped during conversion. + # example: gbar_uni1ABE + try: + glyph = self.font[glyphName] + except KeyError: continue - glyph = self.font[glyphName] + + # another bug: some glyphs are decomposed during conversion, in + # which case they unexpectedly don't drop anchors. + # examples: uni04BA, Gbar (partially decomposed) if glyph.anchors: continue + for name, (x, y) in anchors.items(): glyph.appendAnchor(str(name), (x, y)) |