updated OpenResFile() to FSpOpenResFile() and CreateResFile() to
FSpCreateResFile() for carbon compatiblilty. git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@138 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
parent
64892f5a34
commit
e9601bf9e1
@ -124,9 +124,9 @@ HEXLINELENGTH = 80
|
|||||||
|
|
||||||
def readLWFN(path):
|
def readLWFN(path):
|
||||||
"""reads an LWFN font file, returns raw data"""
|
"""reads an LWFN font file, returns raw data"""
|
||||||
resref = Res.OpenResFile(path)
|
resRef = Res.FSpOpenResFile(path, 1) # read-only
|
||||||
try:
|
try:
|
||||||
Res.UseResFile(resref)
|
Res.UseResFile(resRef)
|
||||||
n = Res.Count1Resources('POST')
|
n = Res.Count1Resources('POST')
|
||||||
data = []
|
data = []
|
||||||
for i in range(501, 501 + n):
|
for i in range(501, 501 + n):
|
||||||
@ -147,7 +147,7 @@ def readLWFN(path):
|
|||||||
else:
|
else:
|
||||||
raise error, 'bad chunk code: ' + `code`
|
raise error, 'bad chunk code: ' + `code`
|
||||||
finally:
|
finally:
|
||||||
Res.CloseResFile(resref)
|
Res.CloseResFile(resRef)
|
||||||
data = string.join(data, '')
|
data = string.join(data, '')
|
||||||
assertType1(data)
|
assertType1(data)
|
||||||
return data
|
return data
|
||||||
@ -195,12 +195,10 @@ def readOther(path):
|
|||||||
# file writing tools
|
# file writing tools
|
||||||
|
|
||||||
def writeLWFN(path, data):
|
def writeLWFN(path, data):
|
||||||
Res.CreateResFile(path)
|
Res.FSpCreateResFile(path, "just", "LWFN", 0)
|
||||||
fss = macfs.FSSpec(path)
|
resRef = Res.FSpOpenResFile(path, 2) # write-only
|
||||||
fss.SetCreatorType('just', 'LWFN')
|
|
||||||
resref = Res.OpenResFile(path)
|
|
||||||
try:
|
try:
|
||||||
Res.UseResFile(resref)
|
Res.UseResFile(resRef)
|
||||||
resID = 501
|
resID = 501
|
||||||
chunks = findEncryptedChunks(data)
|
chunks = findEncryptedChunks(data)
|
||||||
for isEncrypted, chunk in chunks:
|
for isEncrypted, chunk in chunks:
|
||||||
@ -216,7 +214,7 @@ def writeLWFN(path, data):
|
|||||||
res = Res.Resource(chr(5) + '\0')
|
res = Res.Resource(chr(5) + '\0')
|
||||||
res.AddResource('POST', resID, '')
|
res.AddResource('POST', resID, '')
|
||||||
finally:
|
finally:
|
||||||
Res.CloseResFile(resref)
|
Res.CloseResFile(resRef)
|
||||||
|
|
||||||
def writePFB(path, data):
|
def writePFB(path, data):
|
||||||
chunks = findEncryptedChunks(data)
|
chunks = findEncryptedChunks(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user