ttList-module problem

Mehta, Anish Anish.Mehta at enst-bretagne.fr
Tue Apr 29 05:44:26 EDT 2003


Hello !

I am having some problem in understanding this code. Firstly i am not 
finding TTFont which is being imported with the command

from fontTools.ttLib import TTFont

I have searched in the ttLib directory but i am unable to find TTFont so 
that i can read about it. As far as i am getting is that this module is 
taking input and then some information about      tags( ? ) and then 
printing out the format in the form of checksum, length and offset. 
Please elaborate this a bit more.

def ttList(input, output, options):
        ttf = TTFont(input)
        reader = ttf.reader
        tags = reader.keys()
        tags.sort()
        print 'Listing table info for "%s":' % input
        format = "    %4s  %10s  %7s  %7s"
        print format % ("tag ", "  checksum", " length", " offset")
        print format % ("----", "----------", "-------", "-------")
        for tag in tags:
                entry = reader.tables[tag]
                checksum = "0x" + hex(entry.checkSum)[2:].zfill(8)
                print format % (tag, checksum, entry.length, entry.offset)
        print
        ttf.close()


I'll be waiting for your response.

Thanks in advance.

Regards,

Anish MEHTA






More information about the Python-list mailing list