diff options
author | James Godfrey-Kittle <jamesgk@google.com> | 2015-02-02 14:37:29 -0800 |
---|---|---|
committer | James Godfrey-Kittle <jamesgk@google.com> | 2015-04-16 12:16:28 -0700 |
commit | c58f90961ecf481184a10321149183c595d83bbc (patch) | |
tree | 75d6e5f76201a57ddfb458ddf7f3d0dd947b5f13 /scripts | |
parent | 9b9f8fd919a47a53dae5a972d4f35bbc54112b8f (diff) |
Add decompose glyph function
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/fontbuild/Build.py | 1 | ||||
-rw-r--r-- | scripts/lib/fontbuild/decomposeGlyph.py | 13 |
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) |