예제 #1
0
 def checksumTables(self):
     # Check the checksums for all tables
     for t in self.tables:
         table = self.get_chunk(t['offset'], t['length'])
         checksum = calcChecksum(table)
         if t['tag'] == 'head':
             adjustment = unpack('>l', table[8:8 + 4])[0]
             checksum = add32(checksum, -adjustment)
         xchecksum = t['checksum']
         if xchecksum != checksum:
             raise TTFError(
                 'TTF file "%s": invalid checksum %s table: %s (expected %s)'
                 % (self.filename, hex32(checksum), t['tag'],
                    hex32(xchecksum)))
예제 #2
0
 def checksumFile(self):
     # Check the checksums for the whole file
     checksum = calcChecksum(self._ttf_data)
     if 0xB1B0AFBA != checksum:
         raise TTFError(
             'TTF file "%s": invalid checksum %s (expected 0xB1B0AFBA) len: %d &3: %d'
             % (self.filename, hex32(checksum), len(self._ttf_data),
                (len(self._ttf_data) & 3)))
예제 #3
0
파일: ttfonts.py 프로젝트: CometHale/lphw
 def checksumFile(self):
     # Check the checksums for the whole file
     checksum = calcChecksum(self._ttf_data)
     if 0xB1B0AFBA!=checksum:
         raise TTFError('TTF file "%s": invalid checksum %s (expected 0xB1B0AFBA) len: %d &3: %d' % (self.filename,hex32(checksum),len(self._ttf_data),(len(self._ttf_data)&3)))
예제 #4
0
파일: ttfonts.py 프로젝트: CometHale/lphw
 def checksumTables(self):
     # Check the checksums for all tables
     for t in self.tables:
         table = self.get_chunk(t['offset'], t['length'])
         checksum = calcChecksum(table)
         if t['tag'] == 'head':
             adjustment = unpack('>l', table[8:8+4])[0]
             checksum = add32(checksum, -adjustment)
         xchecksum = t['checksum']
         if xchecksum != checksum:
             raise TTFError('TTF file "%s": invalid checksum %s table: %s (expected %s)' % (self.filename,hex32(checksum),t['tag'],hex32(xchecksum)))