Fix regression on i9.pdf

This commit is contained in:
Vivien Nicolas 2011-09-05 14:35:03 +02:00
parent cd930d9248
commit b1a5ab6d0f
2 changed files with 22 additions and 16 deletions

View File

@ -9,6 +9,10 @@ var isWorker = (typeof window == 'undefined');
*/
var kMaxWaitForFontFace = 1000;
// Unicode Private Use Area
var kCmapGlyphOffset = 0xE000;
/**
* Hold a map of decoded fonts and of the standard fourteen Type1
* fonts and their acronyms.
@ -797,9 +801,6 @@ var Font = (function Font() {
encoding: null,
checkAndRepair: function font_checkAndRepair(name, font, properties) {
// offset glyphs to the Unicode Private Use Area
var kCmapGlyphOffset = 0xE000;
function readTableEntry(file) {
var tag = file.getBytes(4);
tag = String.fromCharCode(tag[0]) +
@ -879,16 +880,23 @@ var Font = (function Font() {
var index = font.getByte();
if (index) {
deltas.push(index);
glyphs.push({ unicode: j });
var code = encoding[index];
for (var glyph in properties.glyphs) {
if (properties.glyphs[glyph] == code)
break;
}
glyphs.push({ glyph: glyph, unicode: j });
}
}
if (properties.firstChar < 0x20) {
var code = 0;
for (var j = 0; j < glyphs.length; j++) {
var glyph = glyphs[j];
glyphs[j].unicode += 0x1F;
properties.glyphs[glyph.glyph] = encoding[++code] = glyph.unicode;
var code = glyph.unicode + kCmapGlyphOffset;
properties.glyphs[glyph.glyph] = encoding[glyph.unicode] = code;
glyph.unicode = code;
}
}
@ -1458,7 +1466,7 @@ var Type1Parser = function() {
charstring.push('drop');
// If the flex mechanism is not used in a font program, Adobe
// state that that entries 0, 1 and 2 can simply be replace by
// states that entries 0, 1 and 2 can simply be replaced by
// {}, which means that we can simply ignore them.
if (index < 3) {
continue;
@ -2235,7 +2243,6 @@ var Type2CFF = (function() {
var nominalWidth = privDict['nominalWidthX'];
var charstrings = [];
var kCmapGlyphOffset = 0xE000;
var differences = properties.differences;
var index = 0;
for (var i = 1; i < charsets.length; i++) {

1
pdf.js
View File

@ -4304,7 +4304,6 @@ var PartialEvaluator = (function() {
var index = GlyphsUnicode[glyph] || i;
glyphsMap[glyph] = encodingMap[i] = index;
var kCmapGlyphOffset = 0xE000;
if (index <= 0x1f || (index >= 127 && index <= 255))
glyphsMap[glyph] = encodingMap[i] += kCmapGlyphOffset;