Philippe Guglielmetti 2017-02-06 15:56:54 +01:00
commit 3427dcaf20
3 changed files with 7 additions and 5 deletions

View File

@ -640,8 +640,8 @@ class PDFCIDFont(PDFFont):
raise PDFFontError('BaseFont is missing')
self.basefont = 'unknown'
self.cidsysteminfo = dict_value(spec.get('CIDSystemInfo', {}))
self.cidcoding = '%s-%s' % (self.cidsysteminfo.get('Registry', b'unknown').decode("latin1"),
self.cidsysteminfo.get('Ordering', b'unknown').decode("latin1"))
self.cidcoding = '%s-%s' % (resolve1(self.cidsysteminfo.get('Registry', b'unknown')).decode("latin1"),
resolve1(self.cidsysteminfo.get('Ordering', b'unknown')).decode("latin1"))
try:
name = literal_name(spec['Encoding'])
except KeyError:

View File

@ -1,4 +1,4 @@
STRICT = True
STRICT = False
try:
from django.conf import settings

View File

@ -211,7 +211,7 @@ def choplist(n, seq):
# nunpack
def nunpack(s, default=0):
"""Unpacks 1 to 4 byte integers (big endian)."""
"""Unpacks 1 to 4 or 8 byte integers (big endian)."""
l = len(s)
if not l:
return default
@ -223,6 +223,8 @@ def nunpack(s, default=0):
return struct.unpack('>L', b'\x00'+s)[0]
elif l == 4:
return struct.unpack('>L', s)[0]
elif l == 8:
return struct.unpack('>Q', s)[0]
else:
raise TypeError('invalid length: %d' % l)
@ -269,7 +271,7 @@ def decode_text(s):
if s.startswith(b'\xfe\xff'):
return six.text_type(s[2:], 'utf-16be', 'ignore')
else:
return ''.join(PDFDocEncoding[ord(c)] for c in s)
return ''.join(PDFDocEncoding[c] for c in s)
# enc