fontTools.ttLib.sfnt
index
/home/mcfletch/pylive/fontTools/ttLib/sfnt.py

ttLib/sfnt.py -- low-level module to deal with the sfnt file format.
 
Defines two public classes:
        SFNTReader
        SFNTWriter
 
(Normally you don't have to use these classes explicitly; they are 
used automatically by ttLib.TTFont.)
 
The reading and writing of sfnt files is separated in two distinct 
classes, since whenever to number of tables changes or whenever
a table's length chages you need to rewrite the whole file anyway.

 
Modules
       
numpy
os
sstruct
struct
sys

 
Classes
       
SFNTDirectoryEntry
SFNTReader
SFNTWriter

 
class SFNTDirectoryEntry
     Methods defined here:
__repr__(self)
fromFile(self, file)
fromString(self, str)
toString(self)

 
class SFNTReader
     Methods defined here:
__delitem__(self, tag)
__getitem__(self, tag)
Fetch the raw table data.
__init__(self, file, checkChecksums=1)
close(self)
has_key(self, tag)
keys(self)

 
class SFNTWriter
     Methods defined here:
__init__(self, file, numTables, sfntVersion='\x00\x01\x00\x00')
__setitem__(self, tag, data)
Write raw table data to disk.
calcMasterChecksum(self, directory)
close(self)
All tables must have been written to disk. Now write the
directory.

 
Functions
       
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
result.
 
If the data length is not a multiple of four, it assumes
it is to be padded with null byte.
getSearchRange(n)
Calculate searchRange, entrySelector, rangeShift for the
sfnt directory. 'n' is the number of tables.
maxPowerOfTwo(x)
Return the highest exponent of two, so that
(2 ** exponent) <= x

 
Data
        __file__ = '/home/mcfletch/pylive/fontTools/ttLib/sfnt.pyc'
__name__ = 'fontTools.ttLib.sfnt'
__package__ = 'fontTools.ttLib'
sfntDirectoryEntryFormat = '\n\t\t> # big endian\n\t\ttag: 4s\n\t\tcheckSum: l\n\t\toffset: l\n\t\tlength: l\n'
sfntDirectoryEntrySize = 16
sfntDirectoryFormat = '\n\t\t> # big endian\n\t\tsfntVersion: 4s\n\t\tnumTabl...\trangeShift: H # numTables*16-searchRange\n'
sfntDirectorySize = 12