diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 227b9401a..baf86e720 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1510,17 +1510,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { textContentItem.str.length = 0; } - function isIdenticalSetFont(name, size) { - return (textState.font && - name === textState.fontName && size === textState.fontSize); - } - - function handleBeginText() { - flushTextContentItem(); - textState.textMatrix = IDENTITY_MATRIX.slice(); - textState.textLineMatrix = IDENTITY_MATRIX.slice(); - } - function enqueueChunk() { let length = textContent.items.length; if (length > 0) { @@ -1546,7 +1535,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { task.ensureNotTerminated(); timeSlotManager.reset(); var stop, operation = {}, args = []; - let pendingBeginText = false; while (!(stop = timeSlotManager.check())) { // The arguments parsed by read() are not used beyond this loop, so // we can reuse the same array on every iteration, thus avoiding @@ -1557,30 +1545,16 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { break; } textState = stateManager.state; - var fn = operation.fn | 0; + var fn = operation.fn; args = operation.args; var advance, diff; - if (pendingBeginText) { - if (fn === OPS.setFont) { - const fontNameArg = args[0].name, fontSizeArg = args[1]; - // For multiple identical Tf (setFont) commands, first check if - // the following command is Tm (setTextMatrix) before continuing. - if (isIdenticalSetFont(fontNameArg, fontSizeArg)) { - continue; - } - } - if (fn !== OPS.setTextMatrix) { - handleBeginText(); - } - pendingBeginText = false; - } - - switch (fn) { + switch (fn | 0) { case OPS.setFont: // Optimization to ignore multiple identical Tf commands. var fontNameArg = args[0].name, fontSizeArg = args[1]; - if (isIdenticalSetFont(fontNameArg, fontSizeArg)) { + if (textState.font && fontNameArg === textState.fontName && + fontSizeArg === textState.fontSize) { break; } @@ -1668,15 +1642,9 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { textState.wordSpacing = args[0]; break; case OPS.beginText: - // Optimization to attempt to combine separate BT/ET sequences, - // by checking the next operator(s) before flushing text content - // and resetting the text/textLine matrices (see above). - if (combineTextItems) { - pendingBeginText = true; - break; - } - - handleBeginText(); + flushTextContentItem(); + textState.textMatrix = IDENTITY_MATRIX.slice(); + textState.textLineMatrix = IDENTITY_MATRIX.slice(); break; case OPS.showSpacedText: var items = args[0]; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 1d1e66114..eb8915e35 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -72,7 +72,6 @@ !issue9458.pdf !issue9915_reduced.pdf !issue9940.pdf -!issue9984.pdf !bad-PageLabels.pdf !decodeACSuccessive.pdf !filled-background.pdf diff --git a/test/pdfs/issue9984.pdf b/test/pdfs/issue9984.pdf deleted file mode 100644 index 21ba81606..000000000 Binary files a/test/pdfs/issue9984.pdf and /dev/null differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 81cd4e2c0..2a0551496 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1359,13 +1359,6 @@ "link": false, "type": "eq" }, - { "id": "issue9984-text", - "file": "pdfs/issue9984.pdf", - "md5": "41be5f1b43f61892978cfc57c74ccf4c", - "rounds": 1, - "link": false, - "type": "text" - }, { "id": "issue8570", "file": "pdfs/issue8570.pdf", "md5": "0355731adb72df233eaa10464dcc8c51",