t1Lib: add 'kind' argument to T1Font constructor
fixes issue introduced with last commit
b1fd6fbbcd
t1Lib_test.py::test_parse_lwfn was relying on 'path' being None.
This commit is contained in:
parent
b1fd6fbbcd
commit
c5c161c055
@ -49,8 +49,17 @@ class T1Font(object):
|
||||
Type 1 fonts.
|
||||
"""
|
||||
|
||||
def __init__(self, path, encoding="ascii"):
|
||||
self.data, _ = read(path)
|
||||
def __init__(self, path, encoding="ascii", kind=None):
|
||||
if kind is None:
|
||||
self.data, _ = read(path)
|
||||
elif kind == "LWFN":
|
||||
self.data = readLWFN(path)
|
||||
elif kind == "PFB":
|
||||
self.data = readPFB(path)
|
||||
elif kind == "OTHER":
|
||||
self.data = readOther(path)
|
||||
else:
|
||||
raise ValueError(kind)
|
||||
self.encoding = encoding
|
||||
|
||||
def saveAs(self, path, type, dohex=False):
|
||||
|
@ -67,8 +67,7 @@ class T1FontTest(unittest.TestCase):
|
||||
|
||||
def test_parse_lwfn(self):
|
||||
# the extended attrs are lost on git so we can't auto-detect 'LWFN'
|
||||
font = t1Lib.T1Font()
|
||||
font.data = t1Lib.readLWFN(LWFN)
|
||||
font = t1Lib.T1Font(LWFN, kind="LWFN")
|
||||
font.parse()
|
||||
self.assertEqual(font['FontName'], 'TestT1-Regular')
|
||||
self.assertTrue('Subrs' in font['Private'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user