Merge with upstream

This commit is contained in:
Vivien Nicolas 2011-07-20 15:18:44 +02:00
parent 3cc9912acd
commit 6311977fee
2 changed files with 20 additions and 13 deletions

View File

@ -532,18 +532,6 @@ var Font = (function Font() {
ranges.push([start, end]);
}
// Removes duplicate ranges
/*
for (var i = ranges.length - 1; i > 0; i--) {
var range = ranges[i];
var prevRange = ranges[i - 1];
if (range[0] <= prevRange[1]) {
range[0] = prevRange[0] - 2;
ranges.splice(i - 1, 1);
}
}
*/
return ranges;
};
@ -840,6 +828,21 @@ var Font = (function Font() {
glyphs.push({ unicode : j });
}
}
var rewrite = false;
for (var code in encoding) {
if (code < 0x20 && encoding[code])
rewrite = true;
if (rewrite)
encoding[code] = parseInt(code) + 0x1F;
}
if (rewrite) {
for (var j = 0; j < glyphs.length; j++) {
glyphs[j].unicode += 0x1F;
}
}
cmap.data = createCMapTable(glyphs, deltas);
} else if (format == 6 && numRecords == 1 && !encoding.empty) {
// Format 0 alone is not allowed by the sanitizer so let's rewrite

6
pdf.js
View File

@ -3733,7 +3733,11 @@ var PartialEvaluator = (function() {
var index = 0;
for (var j = 0; j < differences.length; j++) {
var data = differences[j];
IsNum(data) ? index = data : encodingMap[index++] = data;
if (subType.name == 'TrueType') {
IsNum(data) ? index = data : encodingMap[index++] = j;
} else {
IsNum(data) ? index = data : encodingMap[index++] = GlyphsUnicode[data.name];
}
}
// Get the font charset if any