improved support for writing to (in memory) streams
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@119 4cde692c-a291-49d1-8350-778aa11640f8
diff --git a/Lib/fontTools/ttLib/sfnt.py b/Lib/fontTools/ttLib/sfnt.py
index 4a4a7e7..da3f37e 100644
--- a/Lib/fontTools/ttLib/sfnt.py
+++ b/Lib/fontTools/ttLib/sfnt.py
@@ -105,7 +105,7 @@
entry.checkSum = calcchecksum(data)
self.tables[tag] = entry
- def close(self):
+ def close(self, closeStream=1):
"""All tables must have been written to disk. Now write the
directory.
"""
@@ -123,7 +123,8 @@
self.calcmasterchecksum(directory)
self.file.seek(0)
self.file.write(directory)
- self.file.close()
+ if closeStream:
+ self.file.close()
def calcmasterchecksum(self, directory):
# calculate checkSumAdjustment