don't test for os.name, as the mac stuff now all works under darwin/posix as well

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@279 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
jvr 2002-07-12 19:20:19 +00:00
parent 366823498c
commit 22433b1f52

View File

@ -25,7 +25,15 @@ import string
import re import re
import os import os
if os.name == 'mac':
try:
import macfs
except ImportError:
haveMacSupport = 0
else:
haveMacSupport = 1
if haveMacSupport:
try: try:
from Carbon import Res from Carbon import Res
except ImportError: except ImportError:
@ -85,7 +93,7 @@ class T1Font:
def read(path): def read(path):
"""reads any Type 1 font file, returns raw data""" """reads any Type 1 font file, returns raw data"""
normpath = string.lower(path) normpath = string.lower(path)
if os.name == 'mac': if haveMacSupport:
fss = macfs.FSSpec(path) fss = macfs.FSSpec(path)
creator, type = fss.GetCreatorType() creator, type = fss.GetCreatorType()
if type == 'LWFN': if type == 'LWFN':
@ -234,7 +242,7 @@ def writePFB(path, data):
f.write(chr(128) + chr(3)) f.write(chr(128) + chr(3))
finally: finally:
f.close() f.close()
if os.name == 'mac': if haveMacSupport:
fss = macfs.FSSpec(path) fss = macfs.FSSpec(path)
fss.SetCreatorType('mdos', 'BINA') fss.SetCreatorType('mdos', 'BINA')
@ -257,7 +265,7 @@ def writeOther(path, data, dohex = 0):
f.write(chunk) f.write(chunk)
finally: finally:
f.close() f.close()
if os.name == 'mac': if haveMacSupport:
fss = macfs.FSSpec(path) fss = macfs.FSSpec(path)
fss.SetCreatorType('R*ch', 'TEXT') # BBEdit text file fss.SetCreatorType('R*ch', 'TEXT') # BBEdit text file