1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Ignore .notdef in the differences array when building a fallback toUnicode map in PartialEvaluator_buildToUnicode (issue 5256)

Fixes 5256.
This commit is contained in:
Jonas Jenwald 2016-06-27 13:51:11 +02:00
parent e908b71309
commit bdd58ab1d2
4 changed files with 17 additions and 3 deletions

View file

@ -1750,7 +1750,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// the differences array only contains adobe standard or symbol set names,
// in pratice it seems better to always try to create a toUnicode
// map based of the default encoding.
var toUnicode, charcode;
var toUnicode, charcode, glyphName;
if (!properties.composite /* is simple font */) {
toUnicode = [];
var encoding = properties.defaultEncoding.slice();
@ -1758,12 +1758,18 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// Merge in the differences array.
var differences = properties.differences;
for (charcode in differences) {
encoding[charcode] = differences[charcode];
glyphName = differences[charcode];
if (glyphName === '.notdef') {
// Skip .notdef to prevent rendering errors, e.g. boxes appearing
// where there should be spaces (fixes issue5256.pdf).
continue;
}
encoding[charcode] = glyphName;
}
var glyphsUnicodeMap = getGlyphsUnicode();
for (charcode in encoding) {
// a) Map the character code to a character name.
var glyphName = encoding[charcode];
glyphName = encoding[charcode];
// b) Look up the character name in the Adobe Glyph List (see the
// Bibliography) to obtain the corresponding Unicode value.
if (glyphName === '') {