fixed buglet that caused the last table in the font not to be padded to a 4-byte boundary (the spec is a little vague about this, but I believe it's needed, also, Suitcase may complain...)
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@562 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
parent
ba31c60465
commit
c63ac64007
@ -107,9 +107,12 @@ class SFNTWriter:
|
|||||||
self.nextTableOffset = self.nextTableOffset + ((len(data) + 3) & ~3)
|
self.nextTableOffset = self.nextTableOffset + ((len(data) + 3) & ~3)
|
||||||
self.file.seek(entry.offset)
|
self.file.seek(entry.offset)
|
||||||
self.file.write(data)
|
self.file.write(data)
|
||||||
self.file.seek(self.nextTableOffset)
|
# Add NUL bytes to pad the table data to a 4-byte boundary.
|
||||||
# make sure we're actually where we want to be. (XXX old cStringIO bug)
|
# Don't depend on f.seek() as we need to add the padding even if no
|
||||||
|
# subsequent write follows (seek is lazy), ie. after the final table
|
||||||
|
# in the font.
|
||||||
self.file.write('\0' * (self.nextTableOffset - self.file.tell()))
|
self.file.write('\0' * (self.nextTableOffset - self.file.tell()))
|
||||||
|
assert self.nextTableOffset == self.file.tell()
|
||||||
|
|
||||||
if tag == 'head':
|
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:])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user