renamed several items to use camelCase


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@220 4cde692c-a291-49d1-8350-778aa11640f8
diff --git a/Lib/fontTools/ttLib/__init__.py b/Lib/fontTools/ttLib/__init__.py
index bc4274c..de3c8f8 100644
--- a/Lib/fontTools/ttLib/__init__.py
+++ b/Lib/fontTools/ttLib/__init__.py
@@ -42,7 +42,7 @@
 """
 
 #
-# $Id: __init__.py,v 1.24 2002-05-11 21:18:12 jvr Exp $
+# $Id: __init__.py,v 1.25 2002-05-12 17:14:50 jvr Exp $
 #
 
 import os
@@ -62,7 +62,7 @@
 	"""
 	
 	def __init__(self, file=None, res_name_or_index=None, 
-			sfntVersion="\000\001\000\000", checkchecksums=0, 
+			sfntVersion="\000\001\000\000", checkChecksums=0, 
 			verbose=0, recalcBBoxes=1):
 		
 		"""The constructor can be called with a few different arguments.
@@ -75,7 +75,7 @@
 		or a suitcase. (If it's a suitcase, only the first 'sfnt' resource
 		will be read!)
 		
-		The 'checkchecksums' argument is used to specify how sfnt
+		The 'checkChecksums' argument is used to specify how sfnt
 		checksums are treated upon reading a file from disk:
 			0: don't check (default)
 			1: check, print warnings if a wrong checksum is found (default)
@@ -121,7 +121,7 @@
 				file = open(file, "rb")
 		else:
 			pass # assume "file" is a readable file object
-		self.reader = sfnt.SFNTReader(file, checkchecksums)
+		self.reader = sfnt.SFNTReader(file, checkChecksums)
 		self.sfntVersion = self.reader.sfntVersion
 	
 	def close(self):
diff --git a/Lib/fontTools/ttLib/sfnt.py b/Lib/fontTools/ttLib/sfnt.py
index fbdf80a..66f4753 100644
--- a/Lib/fontTools/ttLib/sfnt.py
+++ b/Lib/fontTools/ttLib/sfnt.py
@@ -18,9 +18,9 @@
 
 class SFNTReader:
 	
-	def __init__(self, file, checkchecksums=1):
+	def __init__(self, file, checkChecksums=1):
 		self.file = file
-		self.checkchecksums = checkchecksums
+		self.checkChecksums = checkChecksums
 		data = self.file.read(sfntDirectorySize)
 		if len(data) <> sfntDirectorySize:
 			from fontTools import ttLib
@@ -32,7 +32,7 @@
 		self.tables = {}
 		for i in range(self.numTables):
 			entry = SFNTDirectoryEntry()
-			entry.fromfile(self.file)
+			entry.fromFile(self.file)
 			if entry.length > 0:
 				self.tables[entry.tag] = entry
 			else:
@@ -53,13 +53,13 @@
 		entry = self.tables[tag]
 		self.file.seek(entry.offset)
 		data = self.file.read(entry.length)
-		if self.checkchecksums:
+		if self.checkChecksums:
 			if tag == 'head':
 				# Beh: we have to special-case the 'head' table.
-				checksum = calcchecksum(data[:8] + '\0\0\0\0' + data[12:])
+				checksum = calcChecksum(data[:8] + '\0\0\0\0' + data[12:])
 			else:
-				checksum = calcchecksum(data)
-			if self.checkchecksums > 1:
+				checksum = calcChecksum(data)
+			if self.checkChecksums > 1:
 				# Be obnoxious, and barf when it's wrong
 				assert checksum == entry.checksum, "bad checksum for '%s' table" % tag
 			elif checksum <> entry.checkSum:
@@ -80,7 +80,7 @@
 		self.file = file
 		self.numTables = numTables
 		self.sfntVersion = sfntVersion
-		self.searchRange, self.entrySelector, self.rangeShift = getsearchrange(numTables)
+		self.searchRange, self.entrySelector, self.rangeShift = getSearchRange(numTables)
 		self.nextTableOffset = sfntDirectorySize + numTables * sfntDirectoryEntrySize
 		# clear out directory area
 		self.file.seek(self.nextTableOffset)
@@ -110,9 +110,9 @@
 		self.file.write('\0' * (self.nextTableOffset - self.file.tell()))
 		
 		if tag == 'head':
-			entry.checkSum = calcchecksum(data[:8] + '\0\0\0\0' + data[12:])
+			entry.checkSum = calcChecksum(data[:8] + '\0\0\0\0' + data[12:])
 		else:
-			entry.checkSum = calcchecksum(data)
+			entry.checkSum = calcChecksum(data)
 		self.tables[tag] = entry
 	
 	def close(self, closeStream=1):
@@ -129,14 +129,14 @@
 		
 		self.file.seek(sfntDirectorySize)
 		for tag, entry in tables:
-			directory = directory + entry.tostring()
-		self.calcmasterchecksum(directory)
+			directory = directory + entry.toString()
+		self.calcMasterChecksum(directory)
 		self.file.seek(0)
 		self.file.write(directory)
 		if closeStream:
 			self.file.close()
 	
-	def calcmasterchecksum(self, directory):
+	def calcMasterChecksum(self, directory):
 		# calculate checkSumAdjustment
 		tags = self.tables.keys()
 		checksums = Numeric.zeros(len(tags)+1)
@@ -146,7 +146,7 @@
 		directory_end = sfntDirectorySize + len(self.tables) * sfntDirectoryEntrySize
 		assert directory_end == len(directory)
 		
-		checksums[-1] = calcchecksum(directory)
+		checksums[-1] = calcChecksum(directory)
 		checksum = Numeric.add.reduce(checksums)
 		# BiboAfba!
 		checksumadjustment = Numeric.array(0xb1b0afba) - checksum
@@ -180,14 +180,14 @@
 
 class SFNTDirectoryEntry:
 	
-	def fromfile(self, file):
+	def fromFile(self, file):
 		sstruct.unpack(sfntDirectoryEntryFormat, 
 				file.read(sfntDirectoryEntrySize), self)
 	
-	def fromstring(self, str):
+	def fromString(self, str):
 		sstruct.unpack(sfntDirectoryEntryFormat, str, self)
 	
-	def tostring(self):
+	def toString(self):
 		return sstruct.pack(sfntDirectoryEntryFormat, self)
 	
 	def __repr__(self):
@@ -197,7 +197,7 @@
 			return "<SFNTDirectoryEntry at %x>" % id(self)
 
 
-def calcchecksum(data, start=0):
+def calcChecksum(data, start=0):
 	"""Calculate the checksum for an arbitrary block of data.
 	Optionally takes a 'start' argument, which allows you to
 	calculate a checksum in chunks by feeding it a previous
@@ -216,7 +216,7 @@
 	return Numeric.add.reduce(a)
 
 
-def maxpoweroftwo(x):
+def maxPowerOfTwo(x):
 	"""Return the highest exponent of two, so that
 	(2 ** exponent) <= x
 	"""
@@ -227,13 +227,13 @@
 	return max(exponent - 1, 0)
 
 
-def getsearchrange(n):
+def getSearchRange(n):
 	"""Calculate searchRange, entrySelector, rangeShift for the
 	sfnt directory. 'n' is the number of tables.
 	"""
 	# This stuff needs to be stored in the file, because?
 	import math
-	exponent = maxpoweroftwo(n)
+	exponent = maxPowerOfTwo(n)
 	searchRange = (2 ** exponent) * 16
 	entrySelector = exponent
 	rangeShift = n * 16 - searchRange
diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
index 285d36f..79c1fff 100644
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
@@ -227,7 +227,7 @@
 		self.cmap = cmap
 	
 	def compile(self, ttFont):
-		from fontTools.ttLib.sfnt import maxpoweroftwo
+		from fontTools.ttLib.sfnt import maxPowerOfTwo
 		
 		codes = self.cmap.items()
 		codes.sort()
@@ -270,7 +270,7 @@
 		# Insane. 
 		segCount = len(endCode)
 		segCountX2 = segCount * 2
-		maxexponent = maxpoweroftwo(segCount)
+		maxexponent = maxPowerOfTwo(segCount)
 		searchRange = 2 * (2 ** maxexponent)
 		entrySelector = maxexponent
 		rangeShift = 2 * segCount - searchRange
diff --git a/Lib/fontTools/ttLib/tables/_k_e_r_n.py b/Lib/fontTools/ttLib/tables/_k_e_r_n.py
index ccb6e29..2521dd5 100644
--- a/Lib/fontTools/ttLib/tables/_k_e_r_n.py
+++ b/Lib/fontTools/ttLib/tables/_k_e_r_n.py
@@ -96,7 +96,7 @@
 	
 	def compile(self, ttFont):
 		nPairs = len(self.kernTable)
-		entrySelector = sfnt.maxpoweroftwo(nPairs)
+		entrySelector = sfnt.maxPowerOfTwo(nPairs)
 		searchRange = (2 ** entrySelector) * 6
 		rangeShift = (nPairs - (2 ** entrySelector)) * 6
 		data = struct.pack(">HHHH", nPairs, searchRange, entrySelector, rangeShift)