converted usage of Numeric to numpy
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@537 4cde692c-a291-49d1-8350-778aa11640f8
diff --git a/Lib/fontTools/ttLib/sfnt.py b/Lib/fontTools/ttLib/sfnt.py
index cc1a022..0094ecb 100644
--- a/Lib/fontTools/ttLib/sfnt.py
+++ b/Lib/fontTools/ttLib/sfnt.py
@@ -14,7 +14,7 @@
import sys
import struct, sstruct
-import Numeric
+import numpy
import os
@@ -143,7 +143,7 @@
def calcMasterChecksum(self, directory):
# calculate checkSumAdjustment
tags = self.tables.keys()
- checksums = Numeric.zeros(len(tags)+1)
+ checksums = numpy.zeros(len(tags)+1)
for i in range(len(tags)):
checksums[i] = self.tables[tags[i]].checkSum
@@ -151,10 +151,10 @@
assert directory_end == len(directory)
checksums[-1] = calcChecksum(directory)
- checksum = Numeric.add.reduce(checksums)
+ checksum = numpy.add.reduce(checksums)
# BiboAfba!
- checksumadjustment = Numeric.array(0xb1b0afbaL - 0x100000000L,
- Numeric.Int32) - checksum
+ checksumadjustment = numpy.array(0xb1b0afbaL - 0x100000000L,
+ numpy.int32) - checksum
# write the checksum to the file
self.file.seek(self.tables['head'].offset + 8)
self.file.write(struct.pack(">l", checksumadjustment))
@@ -215,10 +215,10 @@
remainder = len(data) % 4
if remainder:
data = data + '\0' * (4-remainder)
- a = Numeric.fromstring(struct.pack(">l", start) + data, Numeric.Int32)
+ a = numpy.fromstring(struct.pack(">l", start) + data, numpy.int32)
if sys.byteorder <> "big":
- a = a.byteswapped()
- return Numeric.add.reduce(a)
+ a = a.byteswap()
+ return numpy.add.reduce(a)
def maxPowerOfTwo(x):