summaryrefslogtreecommitdiff
path: root/scripts/lib
diff options
context:
space:
mode:
authorJames Godfrey-Kittle <jamesgk@google.com>2015-05-07 17:58:04 -0700
committerjamesgk <jamesgk19@gmail.com>2015-05-07 18:01:14 -0700
commit864f8783ed56c729971f85801f1a1199ff83f1b6 (patch)
treec9da212f2dd67617fd538dee642f666010a80d3c /scripts/lib
parent0ffd3c7a0d399fdc7fd5a1b89aff75b5438043e7 (diff)
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.
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/fontbuild/generateGlyph.py9
1 files changed, 8 insertions, 1 deletions
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: