Don't blindly trust toUnicode when building toFontChar for non-standard fonts without a font file (issue 4934)
This commit is contained in:
parent
13efe84d37
commit
158790981c
@ -2150,7 +2150,7 @@ var Glyph = (function GlyphClosure() {
|
|||||||
*/
|
*/
|
||||||
var Font = (function FontClosure() {
|
var Font = (function FontClosure() {
|
||||||
function Font(name, file, properties) {
|
function Font(name, file, properties) {
|
||||||
var charCode;
|
var charCode, glyphName;
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.loadedName = properties.loadedName;
|
this.loadedName = properties.loadedName;
|
||||||
@ -2249,13 +2249,20 @@ var Font = (function FontClosure() {
|
|||||||
} else if (isStandardFont) {
|
} else if (isStandardFont) {
|
||||||
this.toFontChar = [];
|
this.toFontChar = [];
|
||||||
for (charCode in properties.defaultEncoding) {
|
for (charCode in properties.defaultEncoding) {
|
||||||
var glyphName = properties.differences[charCode] ||
|
glyphName = (properties.differences[charCode] ||
|
||||||
properties.defaultEncoding[charCode];
|
properties.defaultEncoding[charCode]);
|
||||||
this.toFontChar[charCode] = GlyphsUnicode[glyphName];
|
this.toFontChar[charCode] = GlyphsUnicode[glyphName];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
var unicodeCharCode, notCidFont = (type.indexOf('CIDFontType') === -1);
|
||||||
for (charCode in this.toUnicode) {
|
for (charCode in this.toUnicode) {
|
||||||
this.toFontChar[charCode] = this.toUnicode[charCode].charCodeAt(0);
|
unicodeCharCode = this.toUnicode[charCode].charCodeAt(0);
|
||||||
|
if (notCidFont) {
|
||||||
|
glyphName = (properties.differences[charCode] ||
|
||||||
|
properties.defaultEncoding[charCode]);
|
||||||
|
unicodeCharCode = (GlyphsUnicode[glyphName] || unicodeCharCode);
|
||||||
|
}
|
||||||
|
this.toFontChar[charCode] = unicodeCharCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.loadedName = fontName.split('-')[0];
|
this.loadedName = fontName.split('-')[0];
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -66,6 +66,7 @@
|
|||||||
!noembed-sjis.pdf
|
!noembed-sjis.pdf
|
||||||
!vertical.pdf
|
!vertical.pdf
|
||||||
!bug878026.pdf
|
!bug878026.pdf
|
||||||
|
!issue4934.pdf
|
||||||
!issue4650.pdf
|
!issue4650.pdf
|
||||||
!issue3025.pdf
|
!issue3025.pdf
|
||||||
!issue2099-1.pdf
|
!issue2099-1.pdf
|
||||||
|
BIN
test/pdfs/issue4934.pdf
Normal file
BIN
test/pdfs/issue4934.pdf
Normal file
Binary file not shown.
@ -436,6 +436,15 @@
|
|||||||
"lastPage": 1,
|
"lastPage": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue4934",
|
||||||
|
"file": "pdfs/issue4934.pdf",
|
||||||
|
"md5": "6099da44f677702ae65a648b51a2226d",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": false,
|
||||||
|
"firstPage": 1,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "txt2pdf",
|
{ "id": "txt2pdf",
|
||||||
"file": "pdfs/txt2pdf.pdf",
|
"file": "pdfs/txt2pdf.pdf",
|
||||||
"md5": "02cefa0f5e8d96313bb05163b2f88c8c",
|
"md5": "02cefa0f5e8d96313bb05163b2f88c8c",
|
||||||
|
Loading…
Reference in New Issue
Block a user