use ".ttx" extension instead of ".xml". TTX is not the name of the format, not the app...

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@61 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
Just 2000-01-17 18:58:46 +00:00
parent 9b79e52328
commit 9682b4198b
3 changed files with 14 additions and 13 deletions

View File

@ -1,7 +1,8 @@
"""ttLib -- a package for dealing with TrueType fonts.
"""fontTools.ttLib -- a package for dealing with TrueType fonts.
This package offers translators to convert TrueType fonts to Python
objects and vice versa, and additionally from Python to XML and vice versa.
objects and vice versa, and additionally from Python to TTX (an XML-based
text format) and vice versa.
Example interactive session:
@ -15,7 +16,7 @@ Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
'B&H\000'
>>> tt['head'].unitsPerEm
2048
>>> tt.saveXML("afont.xml")
>>> tt.saveXML("afont.ttx")
Dumping 'LTSH' table...
Dumping 'OS/2' table...
Dumping 'VDMX' table...
@ -33,7 +34,7 @@ Dumping 'name' table...
Dumping 'post' table...
Dumping 'prep' table...
>>> tt2 = ttLib.TTFont()
>>> tt2.importXML("afont.xml")
>>> tt2.importXML("afont.ttx")
>>> tt2['maxp'].numGlyphs
242
>>>
@ -41,7 +42,7 @@ Dumping 'prep' table...
"""
#
# $Id: __init__.py,v 1.11 2000-01-05 20:43:36 Just Exp $
# $Id: __init__.py,v 1.12 2000-01-17 18:57:15 Just Exp $
#
__version__ = "1.0a6"
@ -91,7 +92,7 @@ class TTFont:
2) maxp font bounding box
3) hhea min/max values
(1) is needed for certain kinds of CJK fonts (ask Werner Lemberg ;-).
Additionally, upon importing an XML file, this option cause glyphs
Additionally, upon importing an TTX file, this option cause glyphs
to be compiled right away. This should reduce memory consumption
greatly, and therefore should have some impact on the time needed
to parse/compile large fonts.
@ -163,7 +164,7 @@ class TTFont:
def saveXML(self, fileOrPath, progress=None,
tables=None, skipTables=None, splitTables=0):
"""Export the font as an XML-based text file, or as a series of text
"""Export the font as TTX (an XML-based text file), or as a series of text
files when splitTables is true. In the latter case, the 'fileOrPath'
argument should be a path to a directory.
The 'tables' argument must either be false (dump all tables) or a
@ -192,7 +193,7 @@ class TTFont:
if not os.path.exists(fileOrPath):
os.mkdir(fileOrPath)
fileNameTemplate = os.path.join(fileOrPath,
os.path.basename(fileOrPath)) + ".%s.xml"
os.path.basename(fileOrPath)) + ".%s.ttx"
for i in range(numTables):
tag = tables[i]
@ -236,10 +237,10 @@ class TTFont:
writer.newline()
writer.close()
if self.verbose:
debugmsg("Done dumping XML")
debugmsg("Done dumping TTX")
def importXML(self, file, progress=None):
"""Import an XML-based text file, so as to recreate
"""Import an TTX file (an XML-based text format), so as to recreate
a font object.
"""
import xmlImport, stat

View File

@ -80,7 +80,7 @@ class table_F_O_O_(DefaultTable.DefaultTable): # converter for table 'FOO '
# Again, 'ttFont' is there so you can access other tables.
# Same warning applies.
If you want to support XML import/export as well, you need to provide two
If you want to support TTX import/export as well, you need to provide two
additional methods:
def toXML(self, writer, ttFont):

View File

@ -112,7 +112,7 @@ class TableBrowser:
self.ttFont.save(path, 1)
def saveXML(self):
path = putfile("Save font as XML text file:", self.filename, ".xml")
path = putfile("Save font as XML text file:", self.filename, ".ttx")
if path:
W.SetCursor('watch')
pb = macUtils.ProgressBar("Saving %s as XMLŠ" % self.filename)
@ -300,7 +300,7 @@ class GlyphViewer(W.Widget):
Qd.DisposeRgn(savergn)
extensions = [".suit", ".xml", ".TTF", ".ttf"]
extensions = [".suit", ".xml", ".ttx", ".TTF", ".ttf"]
def putfile(prompt, filename, newextension):
for ext in extensions: