summaryrefslogtreecommitdiff
path: root/scripts/lib/fontbuild/decomposeGlyph.py
diff options
context:
space:
mode:
authorJames Godfrey-Kittle <jamesgk@google.com>2015-02-02 14:37:29 -0800
committerJames Godfrey-Kittle <jamesgk@google.com>2015-04-16 12:16:28 -0700
commitc58f90961ecf481184a10321149183c595d83bbc (patch)
tree75d6e5f76201a57ddfb458ddf7f3d0dd947b5f13 /scripts/lib/fontbuild/decomposeGlyph.py
parent9b9f8fd919a47a53dae5a972d4f35bbc54112b8f (diff)
Add decompose glyph function
Diffstat (limited to 'scripts/lib/fontbuild/decomposeGlyph.py')
-rw-r--r--scripts/lib/fontbuild/decomposeGlyph.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/lib/fontbuild/decomposeGlyph.py b/scripts/lib/fontbuild/decomposeGlyph.py
index 16f9a3d..a098968 100644
--- a/scripts/lib/fontbuild/decomposeGlyph.py
+++ b/scripts/lib/fontbuild/decomposeGlyph.py
@@ -1,3 +1,12 @@
def decomposeGlyph(glyph):
- #TODO(jamesgk@google.com)
- pass
+ """Moves the components of a glyph to its outline."""
+
+ font = glyph.getParent()
+ for component in glyph.components:
+ componentGlyph = font[component.baseGlyph]
+ for contour in componentGlyph:
+ contour = contour.copy()
+ contour.move(component.offset)
+ contour.scale(component.scale)
+ glyph.appendContour(contour)
+ glyph.clear(contours=False, anchors=False, guides=False)