From 864f8783ed56c729971f85801f1a1199ff83f1b6 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Thu, 7 May 2015 17:58:04 -0700 Subject: Correctly shift composite glyphs with offsets. Ideally we could call RGlyph.move(offset, anchors=False), but we have to bring back "shiftGlyphMembers" from the original toolchain because RGlyph.move does not work as documented. --- scripts/lib/fontbuild/generateGlyph.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/lib/fontbuild/generateGlyph.py b/scripts/lib/fontbuild/generateGlyph.py index ce381ec..4d1323f 100644 --- a/scripts/lib/fontbuild/generateGlyph.py +++ b/scripts/lib/fontbuild/generateGlyph.py @@ -58,6 +58,13 @@ def copyMarkAnchors(f, g, srcname, width): # g.appendAnchor(anchor.name, (anchor.x + width, anchor.y)) +def shiftGlyphMembers(g, x): + for contour in g.contours: + contour.move((x, 0)) + for component in g.components: + component.move((x, 0)) + + def generateGlyph(f,gname,glyphList={}): glyphName, baseName, accentNames, offset = parseComposite(gname) @@ -81,7 +88,7 @@ def generateGlyph(f,gname,glyphList={}): copyMarkAnchors(f, g, baseName, offset[1] + offset[0]) if offset[0] != 0 or offset[1] != 0: g.width += offset[1] + offset[0] - g.move((offset[0], 0)) + shiftGlyphMembers(g, offset[0]) if len(accentNames) > 0: alignComponentsToAnchors(f, glyphName, baseName, accentNames) else: -- cgit v1.2.3