align glyphs on 4-byte boundaries, seems the current recommendation by MS

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@300 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
jvr 2002-09-05 19:46:41 +00:00
parent 223b3588e3
commit ff6a25cdb9

View File

@ -225,10 +225,11 @@ class Glyph:
data = data + self.compileCoordinates()
# From the spec: "Note that the local offsets should be word-aligned"
# From a later MS spec: "Note that the local offsets should be long-aligned"
# For now, I'll stick to word-alignment.
if len(data) % 2:
# if the length of the data is odd, append a null byte
data = data + "\0"
# Let's be modern and align on 4-byte boundaries.
if len(data) % 4:
# add pad bytes
nPadBytes = 4 - (len(data) % 4)
data = data + "\0" * nPadBytes
return data
def toXML(self, writer, ttFont):