diff --git a/src/fonts.js b/src/fonts.js index 1a4366c19..f83d1e80d 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -1785,6 +1785,12 @@ var Font = (function Font() { } properties.hasShortCmap = hasShortCmap; + // remove glyph references outside range of avaialable glyphs + for (var i = 0, ii = ids.length; i < ii; i++) { + if (ids[i] >= numGlyphs) + ids[i] = 0; + } + createGlyphNameMap(glyphs, ids, properties); this.glyphNameMap = properties.glyphNameMap; @@ -2102,9 +2108,9 @@ var Font = (function Font() { break; case 'Type1': var glyphName = this.differences[charcode] || this.encoding[charcode]; + if (!isNum(width)) + width = this.widths[glyphName]; if (this.noUnicodeAdaptation) { - if (!isNum(width)) - width = this.widths[glyphName]; unicode = GlyphsUnicode[glyphName] || charcode; break; } diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index dd0dceced..d3caa968a 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -18,3 +18,4 @@ !cmykjpeg.pdf !issue840.pdf !scan-bad.pdf +!freeculture.pdf diff --git a/test/pdfs/bpl13210.pdf.link b/test/pdfs/bpl13210.pdf.link new file mode 100644 index 000000000..7cde56a22 --- /dev/null +++ b/test/pdfs/bpl13210.pdf.link @@ -0,0 +1 @@ +http://h20000.www2.hp.com/bc/docs/support/SupportManual/bpl13210/bpl13210.pdf diff --git a/test/pdfs/freeculture.pdf b/test/pdfs/freeculture.pdf new file mode 100644 index 000000000..8b27e9355 Binary files /dev/null and b/test/pdfs/freeculture.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index ca09d14bc..5cf266c63 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -87,6 +87,13 @@ "rounds": 1, "type": "eq" }, + { "id": "freeculture", + "file": "pdfs/freeculture.pdf", + "md5": "dcdf3a8268e6a18938a42d5149efcfca", + "rounds": 1, + "pageLimit": 5, + "type": "eq" + }, { "id": "wnv_chinese-pdf", "file": "pdfs/wnv_chinese.pdf", "md5": "db682638e68391125e8982d3c984841e", @@ -302,6 +309,14 @@ "rounds": 1, "type": "eq" }, + { "id": "bpl13210", + "file": "pdfs/bpl13210.pdf", + "md5": "8a08512baa9fa95378d9ad4b995947c7", + "link": true, + "pageLimit": 5, + "rounds": 1, + "type": "eq" + }, { "id": "tutorial", "file": "pdfs/tutorial.pdf", "md5": "6e122f618c27f3aa9a689423e3be6b8d", diff --git a/web/viewer.html b/web/viewer.html index ffd4327a7..53ca2a247 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -27,9 +27,9 @@ - - + +