Merge pull request #419 from vingtetun/master

Fix for issue #418
This commit is contained in:
Chris Jones 2011-08-31 16:26:06 -07:00
commit b7fefb42ce
2 changed files with 19 additions and 9 deletions

View File

@ -2207,25 +2207,29 @@ var Type2CFF = (function() {
var nominalWidth = privDict['nominalWidthX'];
var charstrings = [];
var kCmapGlyphOffset = 0xE000;
var differences = properties.differences;
var index = 0;
var kCmapGlyphOffset = 0xE000;
for (var i = 1; i < charsets.length; i++) {
var code = -1;
var glyph = charsets[i];
for (var j = index; j < differences.length; j++) {
if (differences[j]) {
index = j;
code = differences.indexOf(glyph);
break;
}
}
var code = differences.indexOf(glyph);
if (code == -1)
code = properties.glyphs[glyph] || index;
index = code = properties.glyphs[glyph] || index;
var width = widths[code] || defaultWidth;
properties.encoding[index] = index + kCmapGlyphOffset;
charstrings.push({unicode: code + kCmapGlyphOffset, width: width, gid: i});
charstrings.push({
unicode: code + kCmapGlyphOffset,
width: width, gid: i
});
index++;
}

16
pdf.js
View File

@ -55,11 +55,17 @@ function backtrace() {
}
function shadow(obj, prop, value) {
Object.defineProperty(obj, prop, { value: value,
enumerable: true,
configurable: true,
writable: false });
return value;
try {
Object.defineProperty(obj, prop, { value: value,
enumerable: true,
configurable: true,
writable: false });
} catch(e) {
obj.__defineGetter__(prop, function() {
return value;
});
}
return value;
}
function bytesToString(bytes) {