diff --git a/src/core/evaluator.js b/src/core/evaluator.js index c6401c399..d72cba2dd 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1997,14 +1997,14 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { widths = dict.get('W'); if (widths) { for (i = 0, ii = widths.length; i < ii; i++) { - start = widths[i++]; + start = xref.fetchIfRef(widths[i++]); code = xref.fetchIfRef(widths[i]); if (isArray(code)) { for (j = 0, jj = code.length; j < jj; j++) { - glyphsWidths[start++] = code[j]; + glyphsWidths[start++] = xref.fetchIfRef(code[j]); } } else { - var width = widths[++i]; + var width = xref.fetchIfRef(widths[++i]); for (j = start; j <= code; j++) { glyphsWidths[j] = width; } @@ -2013,19 +2013,27 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { } if (properties.vertical) { - var vmetrics = (dict.get('DW2') || [880, -1000]); + var vmetrics = dict.getArray('DW2') || [880, -1000]; defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; vmetrics = dict.get('W2'); if (vmetrics) { for (i = 0, ii = vmetrics.length; i < ii; i++) { - start = vmetrics[i++]; + start = xref.fetchIfRef(vmetrics[i++]); code = xref.fetchIfRef(vmetrics[i]); if (isArray(code)) { for (j = 0, jj = code.length; j < jj; j++) { - glyphsVMetrics[start++] = [code[j++], code[j++], code[j]]; + glyphsVMetrics[start++] = [ + xref.fetchIfRef(code[j++]), + xref.fetchIfRef(code[j++]), + xref.fetchIfRef(code[j]) + ]; } } else { - var vmetric = [vmetrics[++i], vmetrics[++i], vmetrics[++i]]; + var vmetric = [ + xref.fetchIfRef(vmetrics[++i]), + xref.fetchIfRef(vmetrics[++i]), + xref.fetchIfRef(vmetrics[++i]) + ]; for (j = start; j <= code; j++) { glyphsVMetrics[j] = vmetric; } @@ -2039,7 +2047,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { if (widths) { j = firstChar; for (i = 0, ii = widths.length; i < ii; i++) { - glyphsWidths[j++] = widths[i]; + glyphsWidths[j++] = xref.fetchIfRef(widths[i]); } defaultWidth = (parseFloat(descriptor.get('MissingWidth')) || 0); } else { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index ccc130acb..aa088e3d4 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -42,6 +42,7 @@ !issue7598.pdf !issue7665.pdf !issue7835.pdf +!issue7855.pdf !bad-PageLabels.pdf !filled-background.pdf !ArabicCIDTrueType.pdf diff --git a/test/pdfs/issue7855.pdf b/test/pdfs/issue7855.pdf new file mode 100644 index 000000000..ee2963f94 Binary files /dev/null and b/test/pdfs/issue7855.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 9643dbd03..5d669044e 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1853,6 +1853,13 @@ "rounds": 1, "type": "eq" }, + { "id": "issue7855", + "file": "pdfs/issue7855.pdf", + "md5": "290d4d5da041ffbcb1ea5d3b0ed8ee91", + "rounds": 1, + "link": false, + "type": "eq" + }, { "id": "issue6068", "file": "pdfs/issue6068.pdf", "md5": "bbcedb94776b40352729c16940a5b2bd",