-
Notifications
You must be signed in to change notification settings - Fork 952
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always try to get CMap, even if name is not recognized (#438)
* Add trying to get cmap from pickle file. And cleaning up a bit. * Don't use keyword argument for dict.get * Add docs * Make _get_cmap_name static * Add test * Add CHANGELOG.md * Remove identity mappings from IDENTITY_ENCODER because that's now the default if the key is not in there * Add CJK characters to expected output of simple3.pdf * Fix line length * Add comment
- Loading branch information
1 parent
3cebf5e
commit 4f65242
Showing
4 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from nose.tools import assert_equal, assert_greater | ||
|
||
from pdfminer.pdffont import PDFCIDFont | ||
from pdfminer.pdfinterp import PDFResourceManager | ||
from pdfminer.psparser import PSLiteral | ||
|
||
|
||
def test_get_cmap_from_pickle(): | ||
"""Test if cmap file is read from pdfminer/cmap | ||
Regression test for https://github.com/pdfminer/pdfminer.six/issues/391 | ||
""" | ||
cmap_name = 'UniGB-UCS2-H' | ||
spec = {'Encoding': PSLiteral(cmap_name)} | ||
resource_manager = PDFResourceManager() | ||
font = PDFCIDFont(resource_manager, spec) | ||
|
||
cmap = font.get_cmap_from_spec(spec, False) | ||
|
||
assert_equal(cmap.attrs.get('CMapName'), cmap_name) | ||
assert_greater(len(cmap.code2cid), 0) |