mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[CIDFontType2] Map characters missing in toUnicode to the private use area (bug 1028735 and issue 4881)
This commit is contained in:
parent
c5f4051a75
commit
a7c786775d
4 changed files with 22 additions and 5 deletions
|
@ -2473,6 +2473,7 @@ var Font = (function FontClosure() {
|
||||||
var toUnicode = properties.toUnicode;
|
var toUnicode = properties.toUnicode;
|
||||||
var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
|
var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
|
||||||
var isIdentityUnicode = properties.isIdentityUnicode;
|
var isIdentityUnicode = properties.isIdentityUnicode;
|
||||||
|
var isCidFontType2 = (properties.type === 'CIDFontType2');
|
||||||
var newMap = Object.create(null);
|
var newMap = Object.create(null);
|
||||||
var toFontChar = [];
|
var toFontChar = [];
|
||||||
var usedFontCharCodes = [];
|
var usedFontCharCodes = [];
|
||||||
|
@ -2483,11 +2484,17 @@ var Font = (function FontClosure() {
|
||||||
var fontCharCode = originalCharCode;
|
var fontCharCode = originalCharCode;
|
||||||
// First try to map the value to a unicode position if a non identity map
|
// First try to map the value to a unicode position if a non identity map
|
||||||
// was created.
|
// was created.
|
||||||
if (!isIdentityUnicode && toUnicode[originalCharCode] !== undefined) {
|
if (!isIdentityUnicode) {
|
||||||
var unicode = toUnicode[fontCharCode];
|
if (toUnicode[originalCharCode] !== undefined) {
|
||||||
// TODO: Try to map ligatures to the correct spot.
|
var unicode = toUnicode[fontCharCode];
|
||||||
if (unicode.length === 1) {
|
// TODO: Try to map ligatures to the correct spot.
|
||||||
fontCharCode = unicode.charCodeAt(0);
|
if (unicode.length === 1) {
|
||||||
|
fontCharCode = unicode.charCodeAt(0);
|
||||||
|
}
|
||||||
|
} else if (isCidFontType2) {
|
||||||
|
// For CIDFontType2, move characters not present in toUnicode
|
||||||
|
// to the private use area (fixes bug 1028735 and issue 4881).
|
||||||
|
fontCharCode = nextAvailableFontCharCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Try to move control characters, special characters and already mapped
|
// Try to move control characters, special characters and already mapped
|
||||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -56,6 +56,7 @@
|
||||||
!bug903856.pdf
|
!bug903856.pdf
|
||||||
!bug850854.pdf
|
!bug850854.pdf
|
||||||
!bug866395.pdf
|
!bug866395.pdf
|
||||||
|
!bug1028735.pdf
|
||||||
!basicapi.pdf
|
!basicapi.pdf
|
||||||
!mixedfonts.pdf
|
!mixedfonts.pdf
|
||||||
!shading_extend.pdf
|
!shading_extend.pdf
|
||||||
|
|
BIN
test/pdfs/bug1028735.pdf
Normal file
BIN
test/pdfs/bug1028735.pdf
Normal file
Binary file not shown.
|
@ -176,6 +176,15 @@
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "bug1028735",
|
||||||
|
"file": "pdfs/bug1028735.pdf",
|
||||||
|
"md5": "5d1a2a87d176ff3b24e66af3cb2365be",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": false,
|
||||||
|
"firstPage": 1,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue1512",
|
{ "id": "issue1512",
|
||||||
"file": "pdfs/issue1512.pdf",
|
"file": "pdfs/issue1512.pdf",
|
||||||
"md5": "41a19fe03d522346ee3baa732403fca4",
|
"md5": "41a19fe03d522346ee3baa732403fca4",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue