At the expense of some speed, find the end of an excrypted portion

more acurately. This fixes an obscure problem with Fog 4 fonts.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@175 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
jvr 2001-11-28 12:22:15 +00:00
parent c2b05ccf8c
commit 90290b7bd9

View File

@ -300,11 +300,18 @@ def findEncryptedChunks(data):
eBegin = string.find(data, EEXECBEGIN)
if eBegin < 0:
break
eBegin = eBegin + len(EEXECBEGIN) + 1
eEnd = string.find(data, EEXECEND, eBegin)
if eEnd < 0:
raise error, "can't find end of eexec part"
chunks.append((0, data[:eBegin + len(EEXECBEGIN) + 1]))
chunks.append((1, data[eBegin + len(EEXECBEGIN) + 1:eEnd]))
cypherText = data[eBegin:eEnd + 2]
plainText, R = eexec.decrypt(cypherText, 55665)
eEndLocal = string.find(plainText, EEXECINTERNALEND)
if eEndLocal < 0:
raise error, "can't find end of eexec part"
eEnd = eBegin + eEndLocal + len(EEXECINTERNALEND) + 1
chunks.append((0, data[:eBegin]))
chunks.append((1, data[eBegin:eEnd]))
data = data[eEnd:]
chunks.append((0, data))
return chunks