don't barf if there are no subroutines

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@102 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
Just 2000-03-28 10:37:25 +00:00
parent 1c1d059219
commit 8ab68261d8

View File

@ -1,7 +1,7 @@
"""cffLib.py -- read/write tools for Adobe CFF fonts.""" """cffLib.py -- read/write tools for Adobe CFF fonts."""
# #
# $Id: cffLib.py,v 1.5 2000-01-19 20:44:33 Just Exp $ # $Id: cffLib.py,v 1.6 2000-03-28 10:37:25 Just Exp $
# #
import struct, sstruct import struct, sstruct
@ -289,9 +289,12 @@ class PrivateDict:
# get local subrs # get local subrs
#print "YYY Private.Subrs:", self.Subrs #print "YYY Private.Subrs:", self.Subrs
chunk = data[self.Subrs:] if hasattr(self, "Subrs"):
localSubrs, restdata = readINDEX(chunk) chunk = data[self.Subrs:]
self.Subrs = map(psCharStrings.T2CharString, localSubrs) localSubrs, restdata = readINDEX(chunk)
self.Subrs = map(psCharStrings.T2CharString, localSubrs)
else:
self.Subrs = []
def toXML(self, xmlWriter): def toXML(self, xmlWriter):
xmlWriter.newline() xmlWriter.newline()
@ -347,6 +350,7 @@ def readINDEX(data):
data = data[(count+1) * offSize:] data = data[(count+1) * offSize:]
prev = offsets[0] prev = offsets[0]
stuff = [] stuff = []
next = offsets[0]
for next in offsets[1:]: for next in offsets[1:]:
chunk = data[prev-1:next-1] chunk = data[prev-1:next-1]
assert len(chunk) == next - prev assert len(chunk) == next - prev