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

16
pdf.js
View File

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