summaryrefslogtreecommitdiff
path: root/scripts/lib/fontbuild
diff options
context:
space:
mode:
authorJames Godfrey-Kittle <jamesgk@google.com>2015-04-30 17:20:51 -0700
committerjamesgk <jamesgk19@gmail.com>2015-04-30 17:20:51 -0700
commit4f1d343e24e7ae61d0f1eb1eb71da6825316baab (patch)
treec5f3bfa08965f970d0708ac7874bacdec4fc0513 /scripts/lib/fontbuild
parentc3f509e3e5d94c768e0735ac999939b4e9360702 (diff)
Set unicode values of generated glyphs earlier.
This is necessary for correctly adding anchors in the immediately following code.
Diffstat (limited to 'scripts/lib/fontbuild')
-rw-r--r--scripts/lib/fontbuild/generateGlyph.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/lib/fontbuild/generateGlyph.py b/scripts/lib/fontbuild/generateGlyph.py
index ccfeef1..7de9c13 100644
--- a/scripts/lib/fontbuild/generateGlyph.py
+++ b/scripts/lib/fontbuild/generateGlyph.py
@@ -65,6 +65,7 @@ def generateGlyph(f,gname,glyphList={}):
for componentName in baseName.split("_"):
g.appendComponent(componentName, (g.width, 0))
g.width += f[componentName].width
+ setUnicodeValue(g, glyphList)
else:
if not f.has_key(glyphName):
@@ -75,6 +76,7 @@ def generateGlyph(f,gname,glyphList={}):
"anchor not found in glyph '%s'" % (gname, e, baseName))
return
g = f[glyphName]
+ setUnicodeValue(g, glyphList)
copyMarkAnchors(f, g, baseName, offset[1] + offset[0])
if offset[0] != 0 or offset[1] != 0:
g.width += offset[1] + offset[0]
@@ -85,6 +87,9 @@ def generateGlyph(f,gname,glyphList={}):
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)
+
+def setUnicodeValue(glyph, glyphList):
+ """Try to ensure glyph has a unicode value -- used by FDK to make OTFs."""
+
+ if glyph.name in glyphList:
+ glyph.unicode = int(glyphList[glyph.name], 16)