Handle PDFStream as character map name in PDFCIDFont

pull/228/head
John Kesegich 2019-02-25 11:33:18 -06:00
parent b6a5848208
commit 8ab2e287be
1 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,7 @@ from . import settings
from .psparser import PSLiteral from .psparser import PSLiteral
from .psparser import literal_name from .psparser import literal_name
from .pdftypes import PDFException from .pdftypes import PDFException
from .pdftypes import PDFStream
from .pdftypes import resolve1 from .pdftypes import resolve1
from .pdftypes import int_value from .pdftypes import int_value
from .pdftypes import num_value from .pdftypes import num_value
@ -654,6 +655,17 @@ class PDFCIDFont(PDFFont):
if strict: if strict:
raise PDFFontError('Encoding is unspecified') raise PDFFontError('Encoding is unspecified')
name = 'unknown' name = 'unknown'
if type(name) is PDFStream:
if 'CMapName' in name:
name = name.get('CMapName').name
if name == 'DLIdent-H':
name = 'Identity-H'
elif name == 'DLIdent-V':
name = 'Identity-V'
else:
if strict:
raise PDFFontError('Encoding is unspecified')
name = 'unknown'
try: try:
self.cmap = CMapDB.get_cmap(name) self.cmap = CMapDB.get_cmap(name)
except CMapDB.CMapNotFound as e: except CMapDB.CMapNotFound as e: