summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/fontbuild/Build.py1
-rw-r--r--scripts/lib/fontbuild/decomposeGlyph.py13
2 files changed, 11 insertions, 3 deletions
diff --git a/scripts/lib/fontbuild/Build.py b/scripts/lib/fontbuild/Build.py
index c4e8450..94c2031 100644
--- a/scripts/lib/fontbuild/Build.py
+++ b/scripts/lib/fontbuild/Build.py
@@ -135,7 +135,6 @@ class FontProject:
for gname in self.decompose:
if f.has_key(gname):
decomposeGlyph(f[gname])
- decomposeGlyph(f[gname])
setNamesRF(f, n, foundry=self.config.get('main', 'foundry'),
version=self.config.get('main', 'version'))
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)