2to3 equivalent to --fix=tuple_params
I hope I got this all right...
diff --git a/Lib/fontTools/afmLib.py b/Lib/fontTools/afmLib.py
index 0eafbb3..c1a79cf 100644
--- a/Lib/fontTools/afmLib.py
+++ b/Lib/fontTools/afmLib.py
@@ -224,8 +224,8 @@
# write char metrics
lines.append("StartCharMetrics " + repr(len(self._chars)))
- items = map(lambda (charname, (charnum, width, box)):
- (charnum, (charname, width, box)),
+ items = map(lambda charname_charnum_width_box:
+ (charname_charnum_width_box[1][0], (charname_charnum_width_box[0], charname_charnum_width_box[1][1], charname_charnum_width_box[1][2])),
self._chars.items())
def myCmp(a, b):
diff --git a/Lib/fontTools/cffLib.py b/Lib/fontTools/cffLib.py
index 130249e..3db9065 100644
--- a/Lib/fontTools/cffLib.py
+++ b/Lib/fontTools/cffLib.py
@@ -94,7 +94,7 @@
xmlWriter.newline()
xmlWriter.newline()
- def fromXML(self, (name, attrs, content)):
+ def fromXML(self, name, attrs, content):
if not hasattr(self, "GlobalSubrs"):
self.GlobalSubrs = GlobalSubrsIndex()
self.major = 1
@@ -113,14 +113,15 @@
for element in content:
if isinstance(element, basestring):
continue
- topDict.fromXML(element)
+ name, attrs, content = element
+ topDict.fromXML(name, attrs, content)
elif name == "GlobalSubrs":
for element in content:
if isinstance(element, basestring):
continue
name, attrs, content = element
subr = psCharStrings.T2CharString()
- subr.fromXML((name, attrs, content))
+ subr.fromXML(name, attrs, content)
self.GlobalSubrs.append(subr)
@@ -400,11 +401,11 @@
xmlWriter.endtag("CharString")
xmlWriter.newline()
- def fromXML(self, (name, attrs, content)):
+ def fromXML(self, name, attrs, content):
if name != "CharString":
return
subr = psCharStrings.T2CharString()
- subr.fromXML((name, attrs, content))
+ subr.fromXML(name, attrs, content)
self.append(subr)
def getItemAndSelector(self, index):
@@ -440,14 +441,15 @@
compilerClass = FDArrayIndexCompiler
- def fromXML(self, (name, attrs, content)):
+ def fromXML(self, name, attrs, content):
if name != "FontDict":
return
fontDict = FontDict()
for element in content:
if isinstance(element, basestring):
continue
- fontDict.fromXML(element)
+ name, attrs, content = element
+ fontDict.fromXML(name, attrs, content)
self.append(fontDict)
@@ -581,7 +583,7 @@
progress.increment(step / float(numGlyphs))
i = i + 1
- def fromXML(self, (name, attrs, content)):
+ def fromXML(self, name, attrs, content):
for element in content:
if isinstance(element, basestring):
continue
@@ -599,7 +601,7 @@
charString = psCharStrings.T2CharString(
private=private,
globalSubrs=self.globalSubrs)
- charString.fromXML((name, attrs, content))
+ charString.fromXML(name, attrs, content)
if fdID >= 0:
charString.fdSelectIndex = fdID
self[glyphName] = charString
@@ -668,7 +670,7 @@
def xmlWrite(self, xmlWriter, name, value, progress):
xmlWriter.simpletag(name, value=value)
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
return attrs["value"]
class Latin1Converter(SimpleConverter):
@@ -677,7 +679,7 @@
value = unicode(value, "latin-1").encode("utf-8")
xmlWriter.simpletag(name, value=value)
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
s = unicode(attrs["value"], "utf-8")
return s.encode("latin-1")
@@ -690,7 +692,7 @@
return value
class NumberConverter(SimpleConverter):
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
return parseNum(attrs["value"])
class ArrayConverter(SimpleConverter):
@@ -698,7 +700,7 @@
value = map(str, value)
xmlWriter.simpletag(name, value=" ".join(value))
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
values = attrs["value"].split()
return map(parseNum, values)
@@ -709,12 +711,13 @@
value.toXML(xmlWriter, progress)
xmlWriter.endtag(name)
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
ob = self.getClass()()
for element in content:
if isinstance(element, basestring):
continue
- ob.fromXML(element)
+ name, attrs, content = element
+ ob.fromXML(name, attrs, content)
return ob
class PrivateDictConverter(TableConverter):
@@ -757,7 +760,7 @@
return CharStrings(file, charset, globalSubrs, private, fdSelect, fdArray)
def write(self, parent, value):
return 0 # dummy value
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
if hasattr(parent, "ROS"):
# if it is a CID-keyed font, then the private Dict is extracted from the parent.FDArray
private, fdSelect, fdArray = None, parent.FDSelect, parent.FDArray
@@ -765,7 +768,7 @@
# if it is a name-keyed font, then the private dict is in the top dict, and there is no fdArray.
private, fdSelect, fdArray = parent.Private, None, None
charStrings = CharStrings(None, None, parent.GlobalSubrs, private, fdSelect, fdArray)
- charStrings.fromXML((name, attrs, content))
+ charStrings.fromXML(name, attrs, content)
return charStrings
class CharsetConverter:
@@ -807,7 +810,7 @@
##xmlWriter.simpletag("charset")
xmlWriter.comment("charset is dumped separately as the 'GlyphOrder' element")
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
if 0:
return safeEval(attrs["value"])
@@ -991,7 +994,7 @@
xmlWriter.endtag(name)
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
if "name" in attrs:
return attrs["name"]
encoding = [".notdef"] * 256
@@ -1096,12 +1099,13 @@
def write(self, parent, value):
return 0 # dummy value
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
fdArray = FDArrayIndex()
for element in content:
if isinstance(element, basestring):
continue
- fdArray.fromXML(element)
+ name, attrs, content = element
+ fdArray.fromXML(name, attrs, content)
return fdArray
@@ -1122,7 +1126,7 @@
xmlWriter.simpletag(name, [('format', value.format)])
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
format = safeEval(attrs["format"])
file = None
numGlyphs = None
@@ -1201,7 +1205,7 @@
('Supplement', supplement)])
xmlWriter.newline()
- def xmlRead(self, (name, attrs, content), parent):
+ def xmlRead(self, name, attrs, content, parent):
return (attrs['Registry'], attrs['Order'], safeEval(attrs['Supplement']))
@@ -1501,9 +1505,9 @@
conv = self.converters[name]
conv.xmlWrite(xmlWriter, name, value, progress)
- def fromXML(self, (name, attrs, content)):
+ def fromXML(self, name, attrs, content):
conv = self.converters[name]
- value = conv.xmlRead((name, attrs, content), self)
+ value = conv.xmlRead(name, attrs, content, self)
setattr(self, name, value)
diff --git a/Lib/fontTools/misc/arrayTools.py b/Lib/fontTools/misc/arrayTools.py
index 3f39e7e..2a3c225 100644
--- a/Lib/fontTools/misc/arrayTools.py
+++ b/Lib/fontTools/misc/arrayTools.py
@@ -16,13 +16,15 @@
ys = [y for x, y in array]
return min(xs), min(ys), max(xs), max(ys)
-def updateBounds(bounds, (x, y), min=min, max=max):
+def updateBounds(bounds, p, min=min, max=max):
"""Return the bounding recangle of rectangle bounds and point (x, y)."""
+ (x, y) = p
xMin, yMin, xMax, yMax = bounds
return min(xMin, x), min(yMin, y), max(xMax, x), max(yMax, y)
-def pointInRect((x, y), rect):
+def pointInRect(p, rect):
"""Return True when point (x, y) is inside rect."""
+ (x, y) = p
xMin, yMin, xMax, yMax = rect
return (xMin <= x <= xMax) and (yMin <= y <= yMax)
@@ -45,52 +47,62 @@
return [int(math.floor(i+0.5)) for i in array]
-def normRect((xMin, yMin, xMax, yMax)):
+def normRect(rect):
"""Normalize the rectangle so that the following holds:
xMin <= xMax and yMin <= yMax
"""
+ (xMin, yMin, xMax, yMax) = rect
return min(xMin, xMax), min(yMin, yMax), max(xMin, xMax), max(yMin, yMax)
-def scaleRect((xMin, yMin, xMax, yMax), x, y):
+def scaleRect(rect, x, y):
"""Scale the rectangle by x, y."""
+ (xMin, yMin, xMax, yMax) = rect
return xMin * x, yMin * y, xMax * x, yMax * y
-def offsetRect((xMin, yMin, xMax, yMax), dx, dy):
+def offsetRect(rect, dx, dy):
"""Offset the rectangle by dx, dy."""
+ (xMin, yMin, xMax, yMax) = rect
return xMin+dx, yMin+dy, xMax+dx, yMax+dy
-def insetRect((xMin, yMin, xMax, yMax), dx, dy):
+def insetRect(rect, dx, dy):
"""Inset the rectangle by dx, dy on all sides."""
+ (xMin, yMin, xMax, yMax) = rect
return xMin+dx, yMin+dy, xMax-dx, yMax-dy
-def sectRect((xMin1, yMin1, xMax1, yMax1), (xMin2, yMin2, xMax2, yMax2)):
+def sectRect(rect1, rect2):
"""Return a boolean and a rectangle. If the input rectangles intersect, return
True and the intersecting rectangle. Return False and (0, 0, 0, 0) if the input
rectangles don't intersect.
"""
+ (xMin1, yMin1, xMax1, yMax1) = rect1
+ (xMin2, yMin2, xMax2, yMax2) = rect2
xMin, yMin, xMax, yMax = (max(xMin1, xMin2), max(yMin1, yMin2),
min(xMax1, xMax2), min(yMax1, yMax2))
if xMin >= xMax or yMin >= yMax:
return 0, (0, 0, 0, 0)
return 1, (xMin, yMin, xMax, yMax)
-def unionRect((xMin1, yMin1, xMax1, yMax1), (xMin2, yMin2, xMax2, yMax2)):
+def unionRect(rect1, rect2):
"""Return the smallest rectangle in which both input rectangles are fully
enclosed. In other words, return the total bounding rectangle of both input
rectangles.
"""
+ (xMin1, yMin1, xMax1, yMax1) = rect1
+ (xMin2, yMin2, xMax2, yMax2) = rect2
xMin, yMin, xMax, yMax = (min(xMin1, xMin2), min(yMin1, yMin2),
max(xMax1, xMax2), max(yMax1, yMax2))
return (xMin, yMin, xMax, yMax)
-def rectCenter((xMin, yMin, xMax, yMax)):
+def rectCenter(rect0):
"""Return the center of the rectangle as an (x, y) coordinate."""
+ (xMin, yMin, xMax, yMax) = rect0
return (xMin+xMax)/2, (yMin+yMax)/2
-def intRect((xMin, yMin, xMax, yMax)):
+def intRect(rect1):
"""Return the rectangle, rounded off to integer values, but guaranteeing that
the resulting rectangle is NOT smaller than the original.
"""
+ (xMin, yMin, xMax, yMax) = rect1
import math
xMin = int(math.floor(xMin))
yMin = int(math.floor(yMin))
diff --git a/Lib/fontTools/misc/psCharStrings.py b/Lib/fontTools/misc/psCharStrings.py
index 2d4f0d8..f658327 100644
--- a/Lib/fontTools/misc/psCharStrings.py
+++ b/Lib/fontTools/misc/psCharStrings.py
@@ -385,7 +385,7 @@
else:
args.append(token)
- def fromXML(self, (name, attrs, content)):
+ def fromXML(self, name, attrs, content):
from fontTools.misc.textTools import binary2num, readHex
if attrs.get("raw"):
self.setBytecode(readHex(content))
diff --git a/Lib/fontTools/misc/transform.py b/Lib/fontTools/misc/transform.py
index 769475f..565aa3c 100644
--- a/Lib/fontTools/misc/transform.py
+++ b/Lib/fontTools/misc/transform.py
@@ -96,7 +96,7 @@
"""
self.__affine = xx, xy, yx, yy, dx, dy
- def transformPoint(self, (x, y)):
+ def transformPoint(self, p):
"""Transform a point.
Example:
@@ -105,6 +105,7 @@
>>> t.transformPoint((100, 100))
(250.0, 550.0)
"""
+ (x, y) = p
xx, xy, yx, yy, dx, dy = self.__affine
return (xx*x + yx*y + dx, xy*x + yy*y + dy)
diff --git a/Lib/fontTools/misc/xmlReader.py b/Lib/fontTools/misc/xmlReader.py
index 3251cc5..b2132ef 100644
--- a/Lib/fontTools/misc/xmlReader.py
+++ b/Lib/fontTools/misc/xmlReader.py
@@ -110,7 +110,8 @@
if self.stackSize == 1:
self.root = None
elif self.stackSize == 2:
- self.currentTable.fromXML(self.root, self.ttFont)
+ name, attrs, content = self.root
+ self.currentTable.fromXML(name, attrs, content, self.ttFont)
self.root = None
diff --git a/Lib/fontTools/pens/cocoaPen.py b/Lib/fontTools/pens/cocoaPen.py
index ef3bf03..67482b4 100644
--- a/Lib/fontTools/pens/cocoaPen.py
+++ b/Lib/fontTools/pens/cocoaPen.py
@@ -13,14 +13,14 @@
path = NSBezierPath.bezierPath()
self.path = path
- def _moveTo(self, (x, y)):
- self.path.moveToPoint_((x, y))
+ def _moveTo(self, p):
+ self.path.moveToPoint_(p)
- def _lineTo(self, (x, y)):
- self.path.lineToPoint_((x, y))
+ def _lineTo(self, p):
+ self.path.lineToPoint_(p)
- def _curveToOne(self, (x1, y1), (x2, y2), (x3, y3)):
- self.path.curveToPoint_controlPoint1_controlPoint2_((x3, y3), (x1, y1), (x2, y2))
+ def _curveToOne(self, p1, p2, p3):
+ self.path.curveToPoint_controlPoint1_controlPoint2_(p3, p1, p2)
def _closePath(self):
self.path.closePath()
diff --git a/Lib/fontTools/pens/reportLabPen.py b/Lib/fontTools/pens/reportLabPen.py
index 1c3fcf8..d30c905 100644
--- a/Lib/fontTools/pens/reportLabPen.py
+++ b/Lib/fontTools/pens/reportLabPen.py
@@ -12,13 +12,18 @@
path = Path()
self.path = path
- def _moveTo(self, (x,y)):
+ def _moveTo(self, p):
+ (x,y) = p
self.path.moveTo(x,y)
- def _lineTo(self, (x,y)):
+ def _lineTo(self, p):
+ (x,y) = p
self.path.lineTo(x,y)
- def _curveToOne(self, (x1,y1), (x2,y2), (x3,y3)):
+ def _curveToOne(self, p1, p2, p3):
+ (x1,y1) = p1
+ (x2,y2) = p2
+ (x3,y3) = p3
self.path.curveTo(x1, y1, x2, y2, x3, y3)
def _closePath(self):
diff --git a/Lib/fontTools/ttLib/__init__.py b/Lib/fontTools/ttLib/__init__.py
index d1d31f6..251fb30 100644
--- a/Lib/fontTools/ttLib/__init__.py
+++ b/Lib/fontTools/ttLib/__init__.py
@@ -761,7 +761,7 @@
writer.simpletag("GlyphID", id=i, name=glyphName)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "glyphOrder"):
self.glyphOrder = []
ttFont.setGlyphOrder(self.glyphOrder)
diff --git a/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py b/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py
index 71514e1..74013fa 100644
--- a/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py
+++ b/Lib/fontTools/ttLib/tables/BitmapGlyphMetrics.py
@@ -37,7 +37,7 @@
writer.endtag(self.__class__.__name__)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
metricNames = set(sstruct.getformat(self.__class__.binaryFormat)[1])
for element in content:
if type(element) != TupleType:
diff --git a/Lib/fontTools/ttLib/tables/C_F_F_.py b/Lib/fontTools/ttLib/tables/C_F_F_.py
index 53427b4..146aca5 100644
--- a/Lib/fontTools/ttLib/tables/C_F_F_.py
+++ b/Lib/fontTools/ttLib/tables/C_F_F_.py
@@ -41,8 +41,8 @@
def toXML(self, writer, otFont, progress=None):
self.cff.toXML(writer, progress)
- def fromXML(self, (name, attrs, content), otFont):
+ def fromXML(self, name, attrs, content, otFont):
if not hasattr(self, "cff"):
self.cff = cffLib.CFFFontSet()
- self.cff.fromXML((name, attrs, content))
+ self.cff.fromXML(name, attrs, content)
diff --git a/Lib/fontTools/ttLib/tables/C_O_L_R_.py b/Lib/fontTools/ttLib/tables/C_O_L_R_.py
index 0664c35..6a1bf0c 100644
--- a/Lib/fontTools/ttLib/tables/C_O_L_R_.py
+++ b/Lib/fontTools/ttLib/tables/C_O_L_R_.py
@@ -97,7 +97,7 @@
writer.endtag("ColorGlyph")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "ColorLayers"):
self.ColorLayers = {}
self.getGlyphName = ttFont.getGlyphName # for use in get/set item functions, for access by GID
@@ -111,7 +111,7 @@
if isinstance(element, StringType):
continue
layer = LayerRecord()
- layer.fromXML(element, ttFont)
+ layer.fromXML(element[0], element[1], element[2], ttFont)
layers.append (layer)
operator.setitem(self, glyphName, layers)
elif "value" in attrs:
@@ -149,7 +149,7 @@
writer.simpletag("layer", name=self.name, colorID=self.colorID)
writer.newline()
- def fromXML(self, (eltname, attrs, content), ttFont):
+ def fromXML(self, eltname, attrs, content, ttFont):
for (name, value) in attrs.items():
if name == "name":
if type(value) == IntType:
diff --git a/Lib/fontTools/ttLib/tables/C_P_A_L_.py b/Lib/fontTools/ttLib/tables/C_P_A_L_.py
index f510c2e..58f47bd 100644
--- a/Lib/fontTools/ttLib/tables/C_P_A_L_.py
+++ b/Lib/fontTools/ttLib/tables/C_P_A_L_.py
@@ -53,7 +53,7 @@
writer.endtag("palette")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "palettes"):
self.palettes = []
if name == "palette":
@@ -66,7 +66,7 @@
if isinstance(element, StringType):
continue
color = Color()
- color.fromXML(element, ttFont)
+ color.fromXML(element[0], element[1], element[2], ttFont)
palette.append (color)
self.palettes.append(palette)
elif "value" in attrs:
@@ -91,7 +91,7 @@
writer.simpletag("color", value=self.hex(), index=index)
writer.newline()
- def fromXML(self, (eltname, attrs, content), ttFont):
+ def fromXML(self, eltname, attrs, content, ttFont):
value = attrs["value"]
if value[0] == '#':
value = value[1:]
diff --git a/Lib/fontTools/ttLib/tables/D_S_I_G_.py b/Lib/fontTools/ttLib/tables/D_S_I_G_.py
index 7dfe3fd..17ce95e 100644
--- a/Lib/fontTools/ttLib/tables/D_S_I_G_.py
+++ b/Lib/fontTools/ttLib/tables/D_S_I_G_.py
@@ -80,7 +80,7 @@
sigrec.toXML(xmlWriter, ttFont)
xmlWriter.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "tableHeader":
self.signatureRecords = []
self.ulVersion = safeEval(attrs["version"])
@@ -89,7 +89,7 @@
return
if name == "SignatureRecord":
sigrec = SignatureRecord()
- sigrec.fromXML((name, attrs, content), ttFont)
+ sigrec.fromXML(name, attrs, content, ttFont)
self.signatureRecords.append(sigrec)
pem_spam = lambda l, spam = {
@@ -108,7 +108,7 @@
writer.write_noindent("-----END PKCS7-----\n")
writer.endtag(self.__class__.__name__)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.ulFormat = safeEval(attrs["format"])
self.usReserved1 = safeEval(attrs.get("reserved1", "0"))
self.usReserved2 = safeEval(attrs.get("reserved2", "0"))
diff --git a/Lib/fontTools/ttLib/tables/DefaultTable.py b/Lib/fontTools/ttLib/tables/DefaultTable.py
index 2578eb7..abdb1ca 100644
--- a/Lib/fontTools/ttLib/tables/DefaultTable.py
+++ b/Lib/fontTools/ttLib/tables/DefaultTable.py
@@ -26,7 +26,7 @@
writer.endtag("hexdata")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
from fontTools.misc.textTools import readHex
from fontTools import ttLib
if name != "hexdata":
diff --git a/Lib/fontTools/ttLib/tables/E_B_D_T_.py b/Lib/fontTools/ttLib/tables/E_B_D_T_.py
index 758e633..97b371d 100644
--- a/Lib/fontTools/ttLib/tables/E_B_D_T_.py
+++ b/Lib/fontTools/ttLib/tables/E_B_D_T_.py
@@ -145,7 +145,7 @@
writer.endtag('strikedata')
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == 'header':
self.version = safeEval(attrs['version'])
elif name == 'strikedata':
@@ -163,7 +163,7 @@
glyphName = attrs['name']
imageFormatClass = self.getImageFormatClass(imageFormat)
curGlyph = imageFormatClass(None, None)
- curGlyph.fromXML(element, ttFont)
+ curGlyph.fromXML(name, attrs, content, ttFont)
assert glyphName not in bitmapGlyphDict, "Duplicate glyphs with the same name '%s' in the same strike." % glyphName
bitmapGlyphDict[glyphName] = curGlyph
else:
@@ -187,7 +187,7 @@
writer.endtag('ebdtComponent')
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.name = attrs['name']
componentNames = set(sstruct.getformat(ebdtComponentFormat)[1][1:])
for element in content:
@@ -261,7 +261,7 @@
writer.endtag('rawimagedata')
writer.newline()
-def _readRawImageData(bitmapObject, (name, attrs, content), ttFont):
+def _readRawImageData(bitmapObject, name, attrs, content, ttFont):
bitmapObject.imageData = readHex(content)
def _writeRowImageData(strikeIndex, glyphName, bitmapObject, writer, ttFont):
@@ -279,7 +279,7 @@
writer.endtag('rowimagedata')
writer.newline()
-def _readRowImageData(bitmapObject, (name, attrs, content), ttFont):
+def _readRowImageData(bitmapObject, name, attrs, content, ttFont):
bitDepth = safeEval(attrs['bitDepth'])
metrics = SmallGlyphMetrics()
metrics.width = safeEval(attrs['width'])
@@ -316,7 +316,7 @@
writer.endtag('bitwiseimagedata')
writer.newline()
-def _readBitwiseImageData(bitmapObject, (name, attrs, content), ttFont):
+def _readBitwiseImageData(bitmapObject, name, attrs, content, ttFont):
bitDepth = safeEval(attrs['bitDepth'])
metrics = SmallGlyphMetrics()
metrics.width = safeEval(attrs['width'])
@@ -354,7 +354,7 @@
with open(fullPath, "wb") as file:
file.write(bitmapObject.imageData)
-def _readExtFileImageData(bitmapObject, (name, attrs, content), ttFont):
+def _readExtFileImageData(bitmapObject, name, attrs, content, ttFont):
fullPath = attrs['value']
with open(fullPath, "rb") as file:
bitmapObject.imageData = file.read()
@@ -412,8 +412,8 @@
writer.endtag(self.__class__.__name__)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
- self.readMetrics((name, attrs, content), ttFont)
+ def fromXML(self, name, attrs, content, ttFont):
+ self.readMetrics(name, attrs, content, ttFont)
for element in content:
if type(element) != TupleType:
continue
@@ -421,7 +421,7 @@
# Chop off 'imagedata' from the tag to get just the option.
option = name[:-len('imagedata')]
if option in self.__class__.xmlDataFunctions:
- self.readData(element, ttFont)
+ self.readData(name, attrs, content, ttFont)
# Some of the glyphs have the metrics. This allows for metrics to be
# added if the glyph format has them. Default behavior is to do nothing.
@@ -429,7 +429,7 @@
pass
# The opposite of write metrics.
- def readMetrics(self, (name, attrs, content), ttFont):
+ def readMetrics(self, name, attrs, content, ttFont):
pass
def writeData(self, strikeIndex, glyphName, writer, ttFont):
@@ -439,11 +439,11 @@
writeFunc = _writeRawImageData
writeFunc(strikeIndex, glyphName, self, writer, ttFont)
- def readData(self, (name, attrs, content), ttFont):
+ def readData(self, name, attrs, content, ttFont):
# Chop off 'imagedata' from the tag to get just the option.
option = name[:-len('imagedata')]
writeFunc, readFunc = self.__class__.xmlDataFunctions[option]
- readFunc(self, (name, attrs, content), ttFont)
+ readFunc(self, name, attrs, content, ttFont)
# A closure for creating a mixin for the two types of metrics handling.
@@ -462,14 +462,14 @@
def writeMetrics(self, writer, ttFont):
self.metrics.toXML(writer, ttFont)
- def readMetrics(self, (name, attrs, content), ttFont):
+ def readMetrics(self, name, attrs, content, ttFont):
for element in content:
if type(element) != TupleType:
continue
name, attrs, content = element
if name == curMetricsName:
self.metrics = metricsClass()
- self.metrics.fromXML(element, ttFont)
+ self.metrics.fromXML(name, attrs, content, ttFont)
elif name == oppositeMetricsName:
print "Warning: %s being ignored in format %d." % oppositeMetricsName, self.getFormat()
@@ -668,8 +668,8 @@
writer.endtag(self.__class__.__name__)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
- self.readMetrics((name, attrs, content), ttFont)
+ def fromXML(self, name, attrs, content, ttFont):
+ self.readMetrics(name, attrs, content, ttFont)
for element in content:
if type(element) != TupleType:
continue
@@ -679,10 +679,10 @@
for compElement in content:
if type(compElement) != TupleType:
continue
- name, attr, content = compElement
+ name, attrs, content = compElement
if name == 'ebdtComponent':
curComponent = EbdtComponent()
- curComponent.fromXML(compElement, ttFont)
+ curComponent.fromXML(name, attrs, content, ttFont)
self.componentArray.append(curComponent)
else:
print "Warning: '%s' being ignored in component array." % name
diff --git a/Lib/fontTools/ttLib/tables/E_B_L_C_.py b/Lib/fontTools/ttLib/tables/E_B_L_C_.py
index 89b8348..4d64275 100644
--- a/Lib/fontTools/ttLib/tables/E_B_L_C_.py
+++ b/Lib/fontTools/ttLib/tables/E_B_L_C_.py
@@ -206,7 +206,7 @@
for curIndex, curStrike in enumerate(self.strikes):
curStrike.toXML(curIndex, writer, ttFont)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == 'header':
self.version = safeEval(attrs['version'])
elif name == 'strike':
@@ -214,7 +214,7 @@
self.strikes = []
strikeIndex = safeEval(attrs['index'])
curStrike = Strike()
- curStrike.fromXML((name, attrs, content), ttFont, self)
+ curStrike.fromXML(name, attrs, content, ttFont, self)
# Grow the strike array to the appropriate size. The XML format
# allows for the strike index value to be out of order.
@@ -240,19 +240,19 @@
writer.endtag('strike')
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont, locator):
+ def fromXML(self, name, attrs, content, ttFont, locator):
for element in content:
if type(element) != TupleType:
continue
name, attrs, content = element
if name == 'bitmapSizeTable':
- self.bitmapSizeTable.fromXML(element, ttFont)
+ self.bitmapSizeTable.fromXML(name, attrs, content, ttFont)
elif name.startswith(_indexSubTableSubclassPrefix):
indexFormat = safeEval(name[len(_indexSubTableSubclassPrefix):])
indexFormatClass = locator.getIndexFormatClass(indexFormat)
indexSubTable = indexFormatClass(None, None)
indexSubTable.indexFormat = indexFormat
- indexSubTable.fromXML(element, ttFont)
+ indexSubTable.fromXML(name, attrs, content, ttFont)
self.indexSubTables.append(indexSubTable)
@@ -277,7 +277,7 @@
writer.endtag('bitmapSizeTable')
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
# Create a lookup for all the simple names that make sense to
# bitmap size table. Only read the information from these names.
dataNames = set(self._getXMLMetricNames())
@@ -289,7 +289,7 @@
direction = attrs['direction']
assert direction in ('hori', 'vert'), "SbitLineMetrics direction specified invalid."
metricObj = SbitLineMetrics()
- metricObj.fromXML(element, ttFont)
+ metricObj.fromXML(name, attrs, content, ttFont)
vars(self)[direction] = metricObj
elif name in dataNames:
vars(self)[name] = safeEval(attrs['value'])
@@ -308,7 +308,7 @@
writer.endtag('sbitLineMetrics')
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
metricNames = set(sstruct.getformat(sbitLineMetricsFormat)[1])
for element in content:
if type(element) != TupleType:
@@ -366,7 +366,7 @@
writer.endtag(self.__class__.__name__)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
# Read all the attributes. Even though the glyph indices are
# recalculated, they are still read in case there needs to
# be an immediate export of the data.
@@ -374,7 +374,7 @@
self.firstGlyphIndex = safeEval(attrs['firstGlyphIndex'])
self.lastGlyphIndex = safeEval(attrs['lastGlyphIndex'])
- self.readMetrics((name, attrs, content), ttFont)
+ self.readMetrics(name, attrs, content, ttFont)
self.names = []
for element in content:
@@ -391,7 +391,7 @@
pass
# A helper method that is the inverse of writeMetrics.
- def readMetrics(self, (name, attrs, content), ttFont):
+ def readMetrics(self, name, attrs, content, ttFont):
pass
# This method is for fixed glyph data sizes. There are formats where
@@ -408,7 +408,8 @@
def removeSkipGlyphs(self):
# Determines if a name, location pair is a valid data location.
# Skip glyphs are marked when the size is equal to zero.
- def isValidLocation((name, (startByte, endByte))):
+ def isValidLocation(args):
+ (name, (startByte, endByte)) = args
return startByte < endByte
# Remove all skip glyphs.
dataPairs = filter(isValidLocation, zip(self.names, self.locations))
@@ -491,7 +492,7 @@
writer.newline()
self.metrics.toXML(writer, ttFont)
- def readMetrics(self, (name, attrs, content), ttFont):
+ def readMetrics(self, name, attrs, content, ttFont):
for element in content:
if type(element) != TupleType:
continue
@@ -500,7 +501,7 @@
self.imageSize = safeEval(attrs['value'])
elif name == BigGlyphMetrics.__name__:
self.metrics = BigGlyphMetrics()
- self.metrics.fromXML(element, ttFont)
+ self.metrics.fromXML(name, attrs, content, ttFont)
elif name == SmallGlyphMetrics.__name__:
print "Warning: SmallGlyphMetrics being ignored in format %d." % self.indexFormat
diff --git a/Lib/fontTools/ttLib/tables/G_M_A_P_.py b/Lib/fontTools/ttLib/tables/G_M_A_P_.py
index 848fc6d..dba7ae4 100644
--- a/Lib/fontTools/ttLib/tables/G_M_A_P_.py
+++ b/Lib/fontTools/ttLib/tables/G_M_A_P_.py
@@ -51,7 +51,7 @@
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
value = attrs["value"]
if name == "GlyphletName":
self.name = value
@@ -117,7 +117,7 @@
for gmapRecord in self.gmapRecords:
gmapRecord.toXML(writer, ttFont)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "GMAPRecord":
if not hasattr(self, "gmapRecords"):
self.gmapRecords = []
@@ -126,7 +126,8 @@
for element in content:
if isinstance(element, StringType):
continue
- gmapRecord.fromXML(element, ttFont)
+ name, attrs, content = element
+ gmapRecord.fromXML(name, attrs, content, ttFont)
else:
value = attrs["value"]
if name == "PSFontName":
diff --git a/Lib/fontTools/ttLib/tables/G_P_K_G_.py b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
index 31f2c46..e6f2166 100644
--- a/Lib/fontTools/ttLib/tables/G_P_K_G_.py
+++ b/Lib/fontTools/ttLib/tables/G_P_K_G_.py
@@ -107,7 +107,7 @@
writer.endtag("glyphlets")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "GMAPs":
if not hasattr(self, "GMAPs"):
self.GMAPs = []
diff --git a/Lib/fontTools/ttLib/tables/L_T_S_H_.py b/Lib/fontTools/ttLib/tables/L_T_S_H_.py
index 4887124..23c3d7c 100644
--- a/Lib/fontTools/ttLib/tables/L_T_S_H_.py
+++ b/Lib/fontTools/ttLib/tables/L_T_S_H_.py
@@ -41,7 +41,7 @@
writer.simpletag("yPel", name=name, value=self.yPels[name])
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "yPels"):
self.yPels = {}
if name != "yPel":
diff --git a/Lib/fontTools/ttLib/tables/M_E_T_A_.py b/Lib/fontTools/ttLib/tables/M_E_T_A_.py
index fe09d61..d1a8d20 100644
--- a/Lib/fontTools/ttLib/tables/M_E_T_A_.py
+++ b/Lib/fontTools/ttLib/tables/M_E_T_A_.py
@@ -166,7 +166,7 @@
for glyphRec in self.glyphRecords:
glyphRec.toXML(writer, ttFont)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "GlyphRecord":
if not hasattr(self, "glyphRecords"):
self.glyphRecords = []
@@ -175,7 +175,8 @@
for element in content:
if isinstance(element, StringType):
continue
- glyphRec.fromXML(element, ttFont)
+ name, attrs, content = element
+ glyphRec.fromXML(name, attrs, content, ttFont)
glyphRec.offset = -1
glyphRec.nMetaEntry = len(glyphRec.stringRecs)
else:
@@ -207,14 +208,14 @@
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "StringRecord":
stringRec = StringRecord()
self.stringRecs.append(stringRec)
for element in content:
if isinstance(element, StringType):
continue
- stringRec.fromXML(element, ttFont)
+ stringRec.fromXML(name, attrs, content, ttFont)
stringRec.stringLen = len(stringRec.string)
else:
value = attrs["value"]
@@ -303,7 +304,7 @@
writer.endtag("StringRecord")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
value = attrs["value"]
if name == "string":
self.string = mapXMLToUTF8(value)
diff --git a/Lib/fontTools/ttLib/tables/O_S_2f_2.py b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
index a40e1e1..e47cb48 100644
--- a/Lib/fontTools/ttLib/tables/O_S_2f_2.py
+++ b/Lib/fontTools/ttLib/tables/O_S_2f_2.py
@@ -28,7 +28,7 @@
writer.simpletag(name, value=getattr(self, name))
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
setattr(self, name, safeEval(attrs["value"]))
@@ -170,12 +170,13 @@
writer.simpletag(name, value=value)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "panose":
self.panose = panose = Panose()
for element in content:
if type(element) == TupleType:
- panose.fromXML(element, ttFont)
+ name, attrs, content = element
+ panose.fromXML(name, attrs, content, ttFont)
elif name in ("ulUnicodeRange1", "ulUnicodeRange2",
"ulUnicodeRange3", "ulUnicodeRange4",
"ulCodePageRange1", "ulCodePageRange2",
diff --git a/Lib/fontTools/ttLib/tables/S_I_N_G_.py b/Lib/fontTools/ttLib/tables/S_I_N_G_.py
index 5415f27..af6cc46 100644
--- a/Lib/fontTools/ttLib/tables/S_I_N_G_.py
+++ b/Lib/fontTools/ttLib/tables/S_I_N_G_.py
@@ -90,7 +90,7 @@
writer.simpletag("baseGlyphName", value=self.baseGlyphName)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
value = attrs["value"]
if name in ["uniqueName", "METAMD5", "baseGlyphName"]:
setattr(self, name, value)
diff --git a/Lib/fontTools/ttLib/tables/S_V_G_.py b/Lib/fontTools/ttLib/tables/S_V_G_.py
index 1800d52..f41e7d3 100644
--- a/Lib/fontTools/ttLib/tables/S_V_G_.py
+++ b/Lib/fontTools/ttLib/tables/S_V_G_.py
@@ -290,7 +290,7 @@
writer.endtag("colorPalettes")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
import re
if name == "svgDoc":
if not hasattr(self, "docList"):
@@ -302,7 +302,7 @@
self.docList.append( [doc, startGID, endGID] )
elif name == "colorPalettes":
self.colorPalettes = ColorPalettes()
- self.colorPalettes.fromXML((name, attrs, content), ttFont)
+ self.colorPalettes.fromXML(name, attrs, content, ttFont)
if self.colorPalettes.numColorParams == 0:
self.colorPalettes = None
else:
@@ -325,7 +325,7 @@
self.numColorPalettes = None # USHORT
self.colorPaletteList = [] # list of ColorPalette records
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
for element in content:
if type(element) == type(""):
continue
@@ -349,7 +349,7 @@
self.uiNameID = None # USHORT. name table ID that describes user interface strings associated with this color palette.
self.paletteColors = [] # list of ColorRecords
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.uiNameID = int(attrs["uiNameID"])
for element in content:
if type(element) == type(""):
diff --git a/Lib/fontTools/ttLib/tables/T_S_I__0.py b/Lib/fontTools/ttLib/tables/T_S_I__0.py
index d06de64..c8d2526 100644
--- a/Lib/fontTools/ttLib/tables/T_S_I__0.py
+++ b/Lib/fontTools/ttLib/tables/T_S_I__0.py
@@ -3,7 +3,7 @@
tsi0Format = '>HHl'
-def fixlongs((glyphID, textLength, textOffset)):
+def fixlongs(glyphID, textLength, textOffset):
return int(glyphID), int(textLength), textOffset
@@ -16,7 +16,7 @@
indices = []
size = struct.calcsize(tsi0Format)
for i in range(numGlyphs + 5):
- glyphID, textLength, textOffset = fixlongs(struct.unpack(tsi0Format, data[:size]))
+ glyphID, textLength, textOffset = fixlongs(*struct.unpack(tsi0Format, data[:size]))
indices.append((glyphID, textLength, textOffset))
data = data[size:]
assert len(data) == 0
diff --git a/Lib/fontTools/ttLib/tables/T_S_I__1.py b/Lib/fontTools/ttLib/tables/T_S_I__1.py
index 03b15a1..53f02ba 100644
--- a/Lib/fontTools/ttLib/tables/T_S_I__1.py
+++ b/Lib/fontTools/ttLib/tables/T_S_I__1.py
@@ -106,7 +106,7 @@
writer.newline()
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "glyphPrograms"):
self.glyphPrograms = {}
self.extraPrograms = {}
diff --git a/Lib/fontTools/ttLib/tables/T_S_I__5.py b/Lib/fontTools/ttLib/tables/T_S_I__5.py
index 66e8d8b..f81d33e 100644
--- a/Lib/fontTools/ttLib/tables/T_S_I__5.py
+++ b/Lib/fontTools/ttLib/tables/T_S_I__5.py
@@ -34,7 +34,7 @@
writer.simpletag("glyphgroup", name=glyphName, value=self.glyphGrouping[glyphName])
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "glyphGrouping"):
self.glyphGrouping = {}
if name != "glyphgroup":
diff --git a/Lib/fontTools/ttLib/tables/V_O_R_G_.py b/Lib/fontTools/ttLib/tables/V_O_R_G_.py
index d2741a6..d71aed5 100644
--- a/Lib/fontTools/ttLib/tables/V_O_R_G_.py
+++ b/Lib/fontTools/ttLib/tables/V_O_R_G_.py
@@ -79,19 +79,17 @@
vOriginRec = VOriginRecord(entry[1], entry[2])
vOriginRec.toXML(writer, ttFont)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "VOriginRecords"):
self.VOriginRecords = {}
self.getGlyphName = ttFont.getGlyphName # for use in get/set item functions, for access by GID
if name == "VOriginRecord":
- for element in content:
- if isinstance(element, StringType):
- continue
vOriginRec = VOriginRecord()
for element in content:
if isinstance(element, StringType):
continue
- vOriginRec.fromXML(element, ttFont)
+ name, attrs, content = element
+ vOriginRec.fromXML(name, attrs, content, ttFont)
self.VOriginRecords[vOriginRec.glyphName] = vOriginRec.vOrigin
elif "value" in attrs:
value = safeEval(attrs["value"])
@@ -134,7 +132,7 @@
writer.endtag("VOriginRecord")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
value = attrs["value"]
if name == "glyphName":
setattr(self, name, value)
diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
index 918f89a..6996242 100644
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
@@ -78,7 +78,7 @@
for table in self.tables:
table.toXML(writer, ttFont)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "tableVersion":
self.tableVersion = safeEval(attrs["version"])
return
@@ -93,7 +93,7 @@
table = cmap_classes[format](format)
table.platformID = safeEval(attrs["platformID"])
table.platEncID = safeEval(attrs["platEncID"])
- table.fromXML((name, attrs, content), ttFont)
+ table.fromXML(name, attrs, content, ttFont)
self.tables.append(table)
@@ -203,7 +203,7 @@
assert len(data) == 262
return data
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.language = safeEval(attrs["language"])
if not hasattr(self, "cmap"):
self.cmap = {}
@@ -522,7 +522,7 @@
return data
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.language = safeEval(attrs["language"])
if not hasattr(self, "cmap"):
self.cmap = {}
@@ -814,7 +814,7 @@
segCountX2, searchRange, entrySelector, rangeShift)
return header + data
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.language = safeEval(attrs["language"])
if not hasattr(self, "cmap"):
self.cmap = {}
@@ -883,7 +883,7 @@
6, len(data) + 10, self.language, firstCode, len(codes))
return header + data
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.language = safeEval(attrs["language"])
if not hasattr(self, "cmap"):
self.cmap = {}
@@ -1022,7 +1022,7 @@
writer.endtag(self.__class__.__name__)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.format = safeEval(attrs["format"])
self.reserved = safeEval(attrs["reserved"])
self.length = safeEval(attrs["length"])
@@ -1178,7 +1178,7 @@
writer.endtag(self.__class__.__name__)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.format = safeEval(attrs["format"])
self.length = safeEval(attrs["length"])
self.numVarSelectorRecords = safeEval(attrs["numVarSelectorRecords"])
@@ -1286,7 +1286,7 @@
writer.endtag(cmapName)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.data = readHex(content)
self.cmap = {}
diff --git a/Lib/fontTools/ttLib/tables/_c_v_t.py b/Lib/fontTools/ttLib/tables/_c_v_t.py
index 2d401fb..ae5bbef 100644
--- a/Lib/fontTools/ttLib/tables/_c_v_t.py
+++ b/Lib/fontTools/ttLib/tables/_c_v_t.py
@@ -25,7 +25,7 @@
writer.simpletag("cv", value=value, index=i)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "values"):
self.values = array.array("h")
if name == "cv":
diff --git a/Lib/fontTools/ttLib/tables/_f_p_g_m.py b/Lib/fontTools/ttLib/tables/_f_p_g_m.py
index cd0e28d..2ef7403 100644
--- a/Lib/fontTools/ttLib/tables/_f_p_g_m.py
+++ b/Lib/fontTools/ttLib/tables/_f_p_g_m.py
@@ -16,9 +16,9 @@
self.program.toXML(writer, ttFont)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
program = ttProgram.Program()
- program.fromXML((name, attrs, content), ttFont)
+ program.fromXML(name, attrs, content, ttFont)
self.program = program
def __len__(self):
diff --git a/Lib/fontTools/ttLib/tables/_g_a_s_p.py b/Lib/fontTools/ttLib/tables/_g_a_s_p.py
index 84ec48a..0efbbd0 100644
--- a/Lib/fontTools/ttLib/tables/_g_a_s_p.py
+++ b/Lib/fontTools/ttLib/tables/_g_a_s_p.py
@@ -43,7 +43,7 @@
("rangeGaspBehavior", rangeGaspBehavior)])
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name != "gaspRange":
return
if not hasattr(self, "gaspRange"):
diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
index 965fd79..3394488 100644
--- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py
+++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py
@@ -109,7 +109,7 @@
writer.newline()
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name != "TTGlyph":
return
if not hasattr(self, "glyphs"):
@@ -126,7 +126,8 @@
for element in content:
if type(element) != TupleType:
continue
- glyph.fromXML(element, ttFont)
+ name, attrs, content = element
+ glyph.fromXML(name, attrs, content, ttFont)
if not ttFont.recalcBBoxes:
glyph.compact(self, 0)
@@ -281,7 +282,7 @@
writer.endtag("instructions")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "contour":
if self.numberOfContours < 0:
raise ttLib.TTLibError("can't mix composites and contours in glyph")
@@ -313,13 +314,14 @@
self.components = []
component = GlyphComponent()
self.components.append(component)
- component.fromXML((name, attrs, content), ttFont)
+ component.fromXML(name, attrs, content, ttFont)
elif name == "instructions":
self.program = ttProgram.Program()
for element in content:
if type(element) != TupleType:
continue
- self.program.fromXML(element, ttFont)
+ name, attrs, content = element
+ self.program.fromXML(name, attrs, content, ttFont)
def getCompositeMaxpValues(self, glyfTable, maxComponentDepth=1):
assert self.isComposite()
@@ -862,7 +864,7 @@
writer.simpletag("component", attrs)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.glyphName = attrs["glyphName"]
if "firstPt" in attrs:
self.firstPt = safeEval(attrs["firstPt"])
@@ -926,8 +928,8 @@
def __repr__(self):
return 'GlyphCoordinates(['+','.join(str(c) for c in self)+'])'
- def append(self, (x,y)):
- self._a.extend((x,y))
+ def append(self, p):
+ self._a.extend(tuple(p))
def extend(self, iterable):
for x,y in iterable:
@@ -951,7 +953,8 @@
a[2*i ] = dx
a[2*i+1] = dy
- def translate(self, (x,y)):
+ def translate(self, p):
+ (x,y) = p
a = self._a
for i in range(len(a) / 2):
a[2*i ] += x
diff --git a/Lib/fontTools/ttLib/tables/_h_d_m_x.py b/Lib/fontTools/ttLib/tables/_h_d_m_x.py
index 4e35ccd..617daf9 100644
--- a/Lib/fontTools/ttLib/tables/_h_d_m_x.py
+++ b/Lib/fontTools/ttLib/tables/_h_d_m_x.py
@@ -74,7 +74,7 @@
writer.endtag("hdmxData")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name != "hdmxData":
return
content = string.join(content, "")
diff --git a/Lib/fontTools/ttLib/tables/_h_e_a_d.py b/Lib/fontTools/ttLib/tables/_h_e_a_d.py
index e4730bf..bf79ada 100644
--- a/Lib/fontTools/ttLib/tables/_h_e_a_d.py
+++ b/Lib/fontTools/ttLib/tables/_h_e_a_d.py
@@ -76,7 +76,7 @@
writer.simpletag(name, value=value)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
value = attrs["value"]
if name in ("created", "modified"):
value = parse_date(value) - mac_epoch_diff
diff --git a/Lib/fontTools/ttLib/tables/_h_h_e_a.py b/Lib/fontTools/ttLib/tables/_h_h_e_a.py
index 33e935c..e53f55d 100644
--- a/Lib/fontTools/ttLib/tables/_h_h_e_a.py
+++ b/Lib/fontTools/ttLib/tables/_h_h_e_a.py
@@ -86,6 +86,6 @@
writer.simpletag(name, value=value)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
setattr(self, name, safeEval(attrs["value"]))
diff --git a/Lib/fontTools/ttLib/tables/_h_m_t_x.py b/Lib/fontTools/ttLib/tables/_h_m_t_x.py
index 2e635a3..a750789 100644
--- a/Lib/fontTools/ttLib/tables/_h_m_t_x.py
+++ b/Lib/fontTools/ttLib/tables/_h_m_t_x.py
@@ -83,7 +83,7 @@
])
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if not hasattr(self, "metrics"):
self.metrics = {}
if name == "mtx":
@@ -93,6 +93,6 @@
def __getitem__(self, glyphName):
return self.metrics[glyphName]
- def __setitem__(self, glyphName, (advance, sb)):
- self.metrics[glyphName] = advance, sb
+ def __setitem__(self, glyphName, advance_sb_pair):
+ self.metrics[glyphName] = tuple(advance_sb_pair)
diff --git a/Lib/fontTools/ttLib/tables/_k_e_r_n.py b/Lib/fontTools/ttLib/tables/_k_e_r_n.py
index ef8c455..f38e9bf 100644
--- a/Lib/fontTools/ttLib/tables/_k_e_r_n.py
+++ b/Lib/fontTools/ttLib/tables/_k_e_r_n.py
@@ -66,7 +66,7 @@
for subtable in self.kernTables:
subtable.toXML(writer, ttFont)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "version":
self.version = safeEval(attrs["value"])
return
@@ -80,7 +80,7 @@
else:
subtable = kern_classes[format]()
self.kernTables.append(subtable)
- subtable.fromXML((name, attrs, content), ttFont)
+ subtable.fromXML(name, attrs, content, ttFont)
class KernTable_format_0:
@@ -143,7 +143,7 @@
writer.endtag("kernsubtable")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.coverage = safeEval(attrs["coverage"])
self.version = safeEval(attrs["format"])
if not hasattr(self, "kernTable"):
@@ -185,7 +185,7 @@
writer.endtag("kernsubtable")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.decompile(readHex(content), ttFont)
@@ -209,7 +209,7 @@
writer.endtag("kernsubtable")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.decompile(readHex(content), ttFont)
diff --git a/Lib/fontTools/ttLib/tables/_m_a_x_p.py b/Lib/fontTools/ttLib/tables/_m_a_x_p.py
index 509188a..5d3bfc8 100644
--- a/Lib/fontTools/ttLib/tables/_m_a_x_p.py
+++ b/Lib/fontTools/ttLib/tables/_m_a_x_p.py
@@ -136,7 +136,7 @@
writer.simpletag(name, value=value)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
setattr(self, name, safeEval(attrs["value"]))
diff --git a/Lib/fontTools/ttLib/tables/_n_a_m_e.py b/Lib/fontTools/ttLib/tables/_n_a_m_e.py
index e9bf47e..e289533 100644
--- a/Lib/fontTools/ttLib/tables/_n_a_m_e.py
+++ b/Lib/fontTools/ttLib/tables/_n_a_m_e.py
@@ -70,14 +70,14 @@
for name in self.names:
name.toXML(writer, ttFont)
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name != "namerecord":
return # ignore unknown tags
if not hasattr(self, "names"):
self.names = []
name = NameRecord()
self.names.append(name)
- name.fromXML((name, attrs, content), ttFont)
+ name.fromXML(name, attrs, content, ttFont)
def getName(self, nameID, platformID, platEncID, langID=None):
for namerecord in self.names:
@@ -118,7 +118,7 @@
writer.endtag("namerecord")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
self.nameID = safeEval(attrs["nameID"])
self.platformID = safeEval(attrs["platformID"])
self.platEncID = safeEval(attrs["platEncID"])
diff --git a/Lib/fontTools/ttLib/tables/_p_o_s_t.py b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
index 185dd9c..9cfd7c7 100644
--- a/Lib/fontTools/ttLib/tables/_p_o_s_t.py
+++ b/Lib/fontTools/ttLib/tables/_p_o_s_t.py
@@ -189,7 +189,7 @@
writer.endtag("hexdata")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name not in ("psNames", "extraNames", "hexdata"):
setattr(self, name, safeEval(attrs["value"]))
elif name == "psNames":
diff --git a/Lib/fontTools/ttLib/tables/_v_h_e_a.py b/Lib/fontTools/ttLib/tables/_v_h_e_a.py
index b131f9f..883fe95 100644
--- a/Lib/fontTools/ttLib/tables/_v_h_e_a.py
+++ b/Lib/fontTools/ttLib/tables/_v_h_e_a.py
@@ -73,6 +73,6 @@
writer.simpletag(name, value=value)
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
setattr(self, name, safeEval(attrs["value"]))
diff --git a/Lib/fontTools/ttLib/tables/asciiTable.py b/Lib/fontTools/ttLib/tables/asciiTable.py
index 623f53d..e3a38e1 100644
--- a/Lib/fontTools/ttLib/tables/asciiTable.py
+++ b/Lib/fontTools/ttLib/tables/asciiTable.py
@@ -16,7 +16,7 @@
writer.endtag("source")
writer.newline()
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
lines = string.split(string.replace(string.join(content, ""), "\r", "\n"), "\n")
self.data = string.join(lines[1:-1], "\r")
diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py
index cf99408..3d80ad8 100644
--- a/Lib/fontTools/ttLib/tables/otBase.py
+++ b/Lib/fontTools/ttLib/tables/otBase.py
@@ -86,12 +86,12 @@
def toXML(self, writer, font):
self.table.toXML2(writer, font)
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
from . import otTables
if not hasattr(self, "table"):
tableClass = getattr(otTables, self.tableTag)
self.table = tableClass()
- self.table.fromXML((name, attrs, content), font)
+ self.table.fromXML(name, attrs, content, font)
class OTTableReader(object):
@@ -659,7 +659,7 @@
value = getattr(self, conv.name)
conv.xmlWrite(xmlWriter, font, value, conv.name, [])
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
try:
conv = self.getConverterByName(name)
except KeyError:
@@ -824,7 +824,7 @@
xmlWriter.simpletag(valueName, simpleItems)
xmlWriter.newline()
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
from . import otTables
for k, v in attrs.items():
setattr(self, k, int(v))
@@ -836,7 +836,8 @@
for elem2 in content:
if type(elem2) != TupleType:
continue
- value.fromXML(elem2, font)
+ name2, attrs2, content2 = elem2
+ value.fromXML(name2, attrs2, content2, font)
setattr(self, name, value)
def __cmp__(self, other):
diff --git a/Lib/fontTools/ttLib/tables/otConverters.py b/Lib/fontTools/ttLib/tables/otConverters.py
index eb83214..73cd16e 100644
--- a/Lib/fontTools/ttLib/tables/otConverters.py
+++ b/Lib/fontTools/ttLib/tables/otConverters.py
@@ -200,7 +200,7 @@
for element in content:
if type(element) == TupleType:
name, attrs, content = element
- table.fromXML((name, attrs, content), font)
+ table.fromXML(name, attrs, content, font)
else:
pass
return table
@@ -300,7 +300,7 @@
def xmlRead(self, attrs, content, font):
from .otBase import ValueRecord
value = ValueRecord()
- value.fromXML((None, attrs, content), font)
+ value.fromXML(None, attrs, content, font)
return value
diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py
index 01a45df..557940a 100644
--- a/Lib/fontTools/ttLib/tables/otTables.py
+++ b/Lib/fontTools/ttLib/tables/otTables.py
@@ -120,7 +120,7 @@
xmlWriter.simpletag("Glyph", value=glyphName)
xmlWriter.newline()
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
glyphs = getattr(self, "glyphs", None)
if glyphs is None:
glyphs = []
@@ -200,7 +200,7 @@
[("in", inGlyph), ("out", outGlyph)])
xmlWriter.newline()
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
mapping = getattr(self, "mapping", None)
if mapping is None:
mapping = {}
@@ -279,7 +279,7 @@
xmlWriter.simpletag("ClassDef", [("glyph", glyphName), ("class", cls)])
xmlWriter.newline()
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
classDefs = getattr(self, "classDefs", None)
if classDefs is None:
classDefs = {}
@@ -340,7 +340,7 @@
xmlWriter.endtag("AlternateSet")
xmlWriter.newline()
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
alternates = getattr(self, "alternates", None)
if alternates is None:
alternates = {}
@@ -408,7 +408,7 @@
xmlWriter.endtag("LigatureSet")
xmlWriter.newline()
- def fromXML(self, (name, attrs, content), font):
+ def fromXML(self, name, attrs, content, font):
ligatures = getattr(self, "ligatures", None)
if ligatures is None:
ligatures = {}
diff --git a/Lib/fontTools/ttLib/tables/ttProgram.py b/Lib/fontTools/ttLib/tables/ttProgram.py
index a8c041a..e6f79ab 100644
--- a/Lib/fontTools/ttLib/tables/ttProgram.py
+++ b/Lib/fontTools/ttLib/tables/ttProgram.py
@@ -256,7 +256,7 @@
writer.dumphex(self.getBytecode())
writer.endtag("bytecode")
- def fromXML(self, (name, attrs, content), ttFont):
+ def fromXML(self, name, attrs, content, ttFont):
if name == "assembly":
self.fromAssembly(string.join(content, ""))
self._assemble()