Merge pull request #13970 from Snuffleupagus/issue-13316
Fallback to the /ToUnicode map for TrueType fonts with (3, 1) and (1, 0) cmap-tables (issue 13316)
This commit is contained in:
commit
258cf1decc
@ -2651,6 +2651,25 @@ class Font {
|
|||||||
unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
|
unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unicodeOrCharCode === undefined) {
|
||||||
|
// Not a valid glyph name, fallback to using the /ToUnicode map
|
||||||
|
// when no post-table exists (fixes issue13316_reduced.pdf).
|
||||||
|
if (
|
||||||
|
!properties.glyphNames &&
|
||||||
|
properties.hasIncludedToUnicodeMap &&
|
||||||
|
!(this.toUnicode instanceof IdentityToUnicodeMap)
|
||||||
|
) {
|
||||||
|
const unicode = this.toUnicode.get(charCode);
|
||||||
|
if (unicode) {
|
||||||
|
unicodeOrCharCode = unicode.codePointAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unicodeOrCharCode === undefined) {
|
||||||
|
continue; // No valid glyph mapping found.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < cmapMappingsLength; ++i) {
|
for (let i = 0; i < cmapMappingsLength; ++i) {
|
||||||
if (cmapMappings[i].charCode !== unicodeOrCharCode) {
|
if (cmapMappings[i].charCode !== unicodeOrCharCode) {
|
||||||
continue;
|
continue;
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -240,6 +240,7 @@
|
|||||||
!issue4304.pdf
|
!issue4304.pdf
|
||||||
!issue4379.pdf
|
!issue4379.pdf
|
||||||
!issue4550.pdf
|
!issue4550.pdf
|
||||||
|
!issue13316_reduced.pdf
|
||||||
!issue4575.pdf
|
!issue4575.pdf
|
||||||
!bug1011159.pdf
|
!bug1011159.pdf
|
||||||
!issue5734.pdf
|
!issue5734.pdf
|
||||||
|
BIN
test/pdfs/issue13316_reduced.pdf
Normal file
BIN
test/pdfs/issue13316_reduced.pdf
Normal file
Binary file not shown.
@ -4321,6 +4321,12 @@
|
|||||||
"lastPage": 4,
|
"lastPage": 4,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue13316",
|
||||||
|
"file": "pdfs/issue13316_reduced.pdf",
|
||||||
|
"md5": "f5821891cee29d8de8b65e1efd6f4ceb",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue10519",
|
{ "id": "issue10519",
|
||||||
"file": "pdfs/issue10519_reduced.pdf",
|
"file": "pdfs/issue10519_reduced.pdf",
|
||||||
"md5": "8a2dae43c0ef47b0734bedaaa24f8c09",
|
"md5": "8a2dae43c0ef47b0734bedaaa24f8c09",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user