Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: third_party/ots/tools/ttf-checksum.py

Issue 797183002: Revert of Updating OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/ots/third_party/brotli.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/ots/tools/ttf-checksum.py
diff --git a/third_party/ots/tools/ttf-checksum.py b/third_party/ots/tools/ttf-checksum.py
deleted file mode 100644
index 802e3cc27ece12d9deeb7e62eb3c9842364339f1..0000000000000000000000000000000000000000
--- a/third_party/ots/tools/ttf-checksum.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import struct
-import sys
-
-def readU32(contents, offset):
- wordBytes = contents[offset:offset + 4]
- return struct.unpack('>I', wordBytes)[0]
-
-def readU16(contents, offset):
- wordBytes = contents[offset:offset + 2]
- return struct.unpack('>H', wordBytes)[0]
-
-def checkChecksum(infile):
- contents = infile.read()
- if len(contents) % 4:
- print 'File length is not a multiple of 4'
-
- sum = 0
- for offset in range(0, len(contents), 4):
- sum += readU32(contents, offset)
- while sum >= 2**32:
- sum -= 2**32
- print 'Sum of whole file: %x' % sum
-
- numTables = readU16(contents, 4)
-
- for offset in range(12, 12 + numTables * 16, 16):
- tag = contents[offset:offset + 4]
- chksum = readU32(contents, offset + 4)
- toffset = readU32(contents, offset + 8)
- tlength = readU32(contents, offset + 12)
-
- sum = 0
- for offset2 in range(toffset, toffset + tlength, 4):
- sum += readU32(contents, offset2)
- while sum >= 2**32:
- sum -= 2**32
- if sum != chksum:
- print 'Bad chksum: %s' % tag
-
-if __name__ == '__main__':
- if len(sys.argv) != 2:
- print 'Usage: %s <ttf filename>' % sys.argv[0]
- else:
- checkChecksum(file(sys.argv[1], 'r'))
« no previous file with comments | « third_party/ots/third_party/brotli.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698