summaryrefslogtreecommitdiff
path: root/scripts/lib/fontbuild/generateGlyph.py
diff options
context:
space:
mode:
authorJames Godfrey-Kittle <jamesgk@google.com>2015-02-21 13:13:38 -0800
committerJames Godfrey-Kittle <jamesgk@google.com>2015-04-16 12:16:30 -0700
commit30193f337af2d2a1668658e2c5c456b1abd2586a (patch)
tree68e0840d6497d38989baac00f800f1407849610f /scripts/lib/fontbuild/generateGlyph.py
parenta9399ccfa784268eece38fa946bf9f531f2db306 (diff)
Set unicode values for generated glyphs.
This is necessary for the FDK to include these new glyphs in the output OTF's cmap.
Diffstat (limited to 'scripts/lib/fontbuild/generateGlyph.py')
-rw-r--r--scripts/lib/fontbuild/generateGlyph.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/lib/fontbuild/generateGlyph.py b/scripts/lib/fontbuild/generateGlyph.py
index 0bf25a1..4794fd8 100644
--- a/scripts/lib/fontbuild/generateGlyph.py
+++ b/scripts/lib/fontbuild/generateGlyph.py
@@ -16,13 +16,15 @@ def parseComposite(composite):
return (glyphName, baseName, accentNames, offset)
-def generateGlyph(f,gname):
+def generateGlyph(f,gname,glyphList={}):
glyphName, baseName, accentNames, offset = parseComposite(gname)
+
if baseName.find("_") != -1:
g = f.newGlyph(glyphName)
for componentName in baseName.split("_"):
g.appendComponent(componentName, (g.width, 0))
g.width += f[componentName].width
+
else:
if not f.has_key(glyphName):
try:
@@ -40,3 +42,7 @@ def generateGlyph(f,gname):
else:
print ("Existing glyph '%s' found in font, ignoring composition "
"rule '%s'" % (glyphName, gname))
+
+ # try to ensure every glyph has a unicode value -- used by FDK to make OTFs
+ if glyphName in glyphList:
+ f[glyphName].unicode = int(glyphList[glyphName], 16)