From e014eabf404f2d7789cb93e9208c9fdb2313b316 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Wed, 28 Jan 2015 10:14:19 -0800 Subject: Handle composite glyph rules with underscores --- scripts/lib/fontbuild/generateGlyph.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'scripts/lib/fontbuild') diff --git a/scripts/lib/fontbuild/generateGlyph.py b/scripts/lib/fontbuild/generateGlyph.py index 2b29ada..4f9f026 100644 --- a/scripts/lib/fontbuild/generateGlyph.py +++ b/scripts/lib/fontbuild/generateGlyph.py @@ -17,18 +17,15 @@ def parseComposite(composite): def generateGlyph(f,gname): - if gname.find("_") != -1: - - #TODO(jamesgk@google.com) handle underscores - return - - generateString = gname - g = f.generateGlyph(generateString) - if f.FindGlyph(g.name) == -1: - f.glyphs.append(g) - return g + glyphName, baseName, accentNames, offset = parseComposite(gname) + if baseName.find("_") != -1: + g = f.newGlyph(glyphName) + lastWidth = 0 + for componentName in baseName.split("_"): + g.appendComponent(componentName, (lastWidth, 0)) + lastWidth = f[componentName].width + g.width += lastWidth else: - glyphName, baseName, accentNames, offset = parseComposite(gname) if not f.has_key(glyphName): try: f.compileGlyph(glyphName, baseName, accentNames) -- cgit v1.2.3