Merge branch 'master' of https://github.com/andreasgal/pdf.js.git into issue-600
This commit is contained in:
commit
b36e8fee5b
5
fonts.js
5
fonts.js
@ -2550,7 +2550,7 @@ var Type2CFF = (function type2CFF() {
|
|||||||
var defaultWidth = privateDict['defaultWidthX'];
|
var defaultWidth = privateDict['defaultWidthX'];
|
||||||
var charstrings = [];
|
var charstrings = [];
|
||||||
var differences = properties.differences;
|
var differences = properties.differences;
|
||||||
var index = 0;
|
var index = properties.firstChar || 0;
|
||||||
for (var i = 1; i < charsets.length; i++) {
|
for (var i = 1; i < charsets.length; i++) {
|
||||||
var code = -1;
|
var code = -1;
|
||||||
var glyph = charsets[i];
|
var glyph = charsets[i];
|
||||||
@ -2562,7 +2562,8 @@ var Type2CFF = (function type2CFF() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapping = properties.glyphs[glyph] || {};
|
var mapping =
|
||||||
|
properties.glyphs[glyph] || properties.glyphs[index] || {};
|
||||||
if (code == -1)
|
if (code == -1)
|
||||||
index = code = mapping.unicode || index;
|
index = code = mapping.unicode || index;
|
||||||
|
|
||||||
|
11
pdf.js
11
pdf.js
@ -3260,7 +3260,7 @@ var XRef = (function xRefXRef() {
|
|||||||
var stream = this.stream;
|
var stream = this.stream;
|
||||||
stream.pos = 0;
|
stream.pos = 0;
|
||||||
var buffer = stream.getBytes();
|
var buffer = stream.getBytes();
|
||||||
var position = 0, length = buffer.length;
|
var position = stream.start, length = buffer.length;
|
||||||
var trailers = [], xrefStms = [];
|
var trailers = [], xrefStms = [];
|
||||||
var state = 0;
|
var state = 0;
|
||||||
var currentToken;
|
var currentToken;
|
||||||
@ -3311,6 +3311,7 @@ var XRef = (function xRefXRef() {
|
|||||||
this.readXRef(xrefStms[i]);
|
this.readXRef(xrefStms[i]);
|
||||||
}
|
}
|
||||||
// finding main trailer
|
// finding main trailer
|
||||||
|
var dict;
|
||||||
for (var i = 0; i < trailers.length; ++i) {
|
for (var i = 0; i < trailers.length; ++i) {
|
||||||
stream.pos = trailers[i];
|
stream.pos = trailers[i];
|
||||||
var parser = new Parser(new Lexer(stream), true);
|
var parser = new Parser(new Lexer(stream), true);
|
||||||
@ -3318,13 +3319,15 @@ var XRef = (function xRefXRef() {
|
|||||||
if (!isCmd(obj, 'trailer'))
|
if (!isCmd(obj, 'trailer'))
|
||||||
continue;
|
continue;
|
||||||
// read the trailer dictionary
|
// read the trailer dictionary
|
||||||
var dict;
|
|
||||||
if (!isDict(dict = parser.getObj()))
|
if (!isDict(dict = parser.getObj()))
|
||||||
continue;
|
continue;
|
||||||
// taking the first one with 'ID'
|
// taking the first one with 'ID'
|
||||||
if (dict.has('ID'))
|
if (dict.has('ID'))
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
// no tailer with 'ID', taking last one (if exists)
|
||||||
|
if (dict)
|
||||||
|
return dict;
|
||||||
// nothing helps
|
// nothing helps
|
||||||
error('Invalid PDF structure');
|
error('Invalid PDF structure');
|
||||||
return null;
|
return null;
|
||||||
@ -4595,7 +4598,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var glyph = differences[i];
|
var glyph = differences[i];
|
||||||
var replaceGlyph = true;
|
var replaceGlyph = true;
|
||||||
if (!glyph) {
|
if (!glyph) {
|
||||||
glyph = baseEncoding[i];
|
glyph = baseEncoding[i] || i;
|
||||||
replaceGlyph = false;
|
replaceGlyph = false;
|
||||||
}
|
}
|
||||||
var index = GlyphsUnicode[glyph] || i;
|
var index = GlyphsUnicode[glyph] || i;
|
||||||
@ -4605,7 +4608,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
width: isNum(width) ? width : properties.defaultWidth
|
width: isNum(width) ? width : properties.defaultWidth
|
||||||
};
|
};
|
||||||
|
|
||||||
if (glyph && (replaceGlyph || !glyphs[glyph]))
|
if (replaceGlyph || !glyphs[glyph])
|
||||||
glyphs[glyph] = map[i];
|
glyphs[glyph] = map[i];
|
||||||
|
|
||||||
// If there is no file, the character mapping can't be modified
|
// If there is no file, the character mapping can't be modified
|
||||||
|
1
test/pdfs/usmanm-bad.pdf.link
Normal file
1
test/pdfs/usmanm-bad.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://www.mit.edu/~6.033/writing-samples/usmanm_dp1.pdf
|
@ -174,6 +174,12 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
},
|
},
|
||||||
|
{ "id": "usmanm-bad",
|
||||||
|
"file": "pdfs/usmanm-bad.pdf",
|
||||||
|
"link": true,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "vesta-bad",
|
{ "id": "vesta-bad",
|
||||||
"file": "pdfs/vesta.pdf",
|
"file": "pdfs/vesta.pdf",
|
||||||
"link": true,
|
"link": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user