diff --git a/src/core/evaluator.js b/src/core/evaluator.js index d72cba2dd..2932523fd 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1366,10 +1366,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { if (!font.vertical) { textChunk.lastAdvanceWidth = width; - textChunk.width += width * textChunk.textAdvanceScale; + textChunk.width += width; } else { textChunk.lastAdvanceHeight = height; - textChunk.height += Math.abs(height * textChunk.textAdvanceScale); + textChunk.height += Math.abs(height); } return textChunk; @@ -1393,6 +1393,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { if (!textContentItem.initialized) { return; } + + // Do final text scaling + textContentItem.width *= textContentItem.textAdvanceScale; + textContentItem.height *= textContentItem.textAdvanceScale; textContent.items.push(runBidiTransform(textContentItem)); textContentItem.initialized = false; @@ -1545,10 +1549,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { advance = items[j] * textState.fontSize / 1000; var breakTextRun = false; if (textState.font.vertical) { - offset = advance * - (textState.textHScale * textState.textMatrix[2] + - textState.textMatrix[3]); - textState.translateTextMatrix(0, advance); + offset = advance; + textState.translateTextMatrix(0, offset); breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; if (!breakTextRun) { @@ -1557,10 +1559,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { } } else { advance = -advance; - offset = advance * ( - textState.textHScale * textState.textMatrix[0] + - textState.textMatrix[1]); - textState.translateTextMatrix(advance, 0); + offset = advance * textState.textHScale; + textState.translateTextMatrix(offset, 0); breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; if (!breakTextRun) { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index aa088e3d4..c4abf5721 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -267,3 +267,4 @@ !annotation-choice-widget.pdf !zero_descent.pdf !operator-in-TJ-array.pdf +!issue7878.pdf diff --git a/test/pdfs/issue7878.pdf b/test/pdfs/issue7878.pdf new file mode 100644 index 000000000..13fcbbfb4 Binary files /dev/null and b/test/pdfs/issue7878.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 5d669044e..938d9a539 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -3324,5 +3324,12 @@ "link": false, "rounds": 1, "type": "text" + }, + { "id": "issue7878", + "file": "pdfs/issue7878.pdf", + "md5": "59194e30037e8c09ae846ddd0ace4c81", + "link": false, + "rounds": 1, + "type": "text" } ]