change how saveXML with splitTable=True works: it no longer creates a directory, and outputs a small file that references the individual table files
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@212 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
parent
b1ad7eb139
commit
0f29303474
@ -42,7 +42,7 @@ Dumping 'prep' table...
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# $Id: __init__.py,v 1.23 2002-05-10 19:03:34 jvr Exp $
|
# $Id: __init__.py,v 1.24 2002-05-11 21:18:12 jvr Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -193,20 +193,25 @@ class TTFont:
|
|||||||
writer.newline()
|
writer.newline()
|
||||||
writer.newline()
|
writer.newline()
|
||||||
else:
|
else:
|
||||||
# 'fileOrPath' must now be a path (pointing to a directory)
|
# 'fileOrPath' must now be a path
|
||||||
if not os.path.exists(fileOrPath):
|
path, ext = os.path.splitext(fileOrPath)
|
||||||
os.mkdir(fileOrPath)
|
fileNameTemplate = path + ".%s" + ext
|
||||||
fileNameTemplate = os.path.join(fileOrPath,
|
collection = xmlWriter.XMLWriter(fileOrPath)
|
||||||
os.path.basename(fileOrPath)) + ".%s.ttx"
|
collection.begintag("ttFont", sfntVersion=`self.sfntVersion`[1:-1],
|
||||||
|
ttLibVersion=version)
|
||||||
|
collection.newline()
|
||||||
|
|
||||||
for i in range(numTables):
|
for i in range(numTables):
|
||||||
tag = tables[i]
|
tag = tables[i]
|
||||||
|
xmltag = tag2xmltag(tag)
|
||||||
if splitTables:
|
if splitTables:
|
||||||
writer = xmlWriter.XMLWriter(fileNameTemplate % tag2identifier(tag))
|
tablePath = fileNameTemplate % tag2identifier(tag)
|
||||||
writer.begintag("ttFont", sfntVersion=`self.sfntVersion`[1:-1],
|
writer = xmlWriter.XMLWriter(tablePath)
|
||||||
ttLibVersion=version)
|
writer.begintag("ttFont", ttLibVersion=version)
|
||||||
writer.newline()
|
writer.newline()
|
||||||
writer.newline()
|
writer.newline()
|
||||||
|
collection.simpletag(xmltag, src=os.path.basename(tablePath))
|
||||||
|
collection.newline()
|
||||||
table = self[tag]
|
table = self[tag]
|
||||||
report = "Dumping '%s' table..." % tag
|
report = "Dumping '%s' table..." % tag
|
||||||
if progress:
|
if progress:
|
||||||
@ -215,7 +220,6 @@ class TTFont:
|
|||||||
debugmsg(report)
|
debugmsg(report)
|
||||||
else:
|
else:
|
||||||
print report
|
print report
|
||||||
xmltag = tag2xmltag(tag)
|
|
||||||
if hasattr(table, "ERROR"):
|
if hasattr(table, "ERROR"):
|
||||||
writer.begintag(xmltag, ERROR="decompilation error")
|
writer.begintag(xmltag, ERROR="decompilation error")
|
||||||
else:
|
else:
|
||||||
@ -238,6 +242,10 @@ class TTFont:
|
|||||||
writer.endtag("ttFont")
|
writer.endtag("ttFont")
|
||||||
writer.newline()
|
writer.newline()
|
||||||
writer.close()
|
writer.close()
|
||||||
|
else:
|
||||||
|
collection.endtag("ttFont")
|
||||||
|
collection.newline()
|
||||||
|
collection.close()
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
debugmsg("Done dumping TTX")
|
debugmsg("Done dumping TTX")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user