Take into account the final space if any in the TJ command

The final space was just ignored and that led to wrongly position
the next chunk of text.
This commit is contained in:
Calixte Denizet 2023-05-23 17:09:23 +02:00
parent 094fb3c783
commit a76a69e1ed
2 changed files with 10 additions and 6 deletions

View File

@ -3074,7 +3074,7 @@ class PartialEvaluator {
const spaceFactor = const spaceFactor =
((textState.font.vertical ? 1 : -1) * textState.fontSize) / 1000; ((textState.font.vertical ? 1 : -1) * textState.fontSize) / 1000;
const elements = args[0]; const elements = args[0];
for (let i = 0, ii = elements.length; i < ii - 1; i++) { for (let i = 0, ii = elements.length; i < ii; i++) {
const item = elements[i]; const item = elements[i];
if (typeof item === "string") { if (typeof item === "string") {
showSpacedTextBuffer.push(item); showSpacedTextBuffer.push(item);
@ -3096,11 +3096,6 @@ class PartialEvaluator {
} }
} }
const item = elements.at(-1);
if (typeof item === "string") {
showSpacedTextBuffer.push(item);
}
if (showSpacedTextBuffer.length > 0) { if (showSpacedTextBuffer.length > 0) {
const str = showSpacedTextBuffer.join(""); const str = showSpacedTextBuffer.join("");
showSpacedTextBuffer.length = 0; showSpacedTextBuffer.length = 0;

View File

@ -265,6 +265,15 @@
"type": "eq", "type": "eq",
"about": "Fonts referenced only by name and not by an object identifier." "about": "Fonts referenced only by name and not by an object identifier."
}, },
{ "id": "bug946506-text",
"file": "pdfs/bug946506.pdf",
"md5": "c28911b5c31bdc337c2ce404c5971cfc",
"rounds": 1,
"link": false,
"firstPage": 1,
"lastPage": 1,
"type": "text"
},
{ "id": "bug931481", { "id": "bug931481",
"file": "pdfs/bug931481.pdf", "file": "pdfs/bug931481.pdf",
"md5": "547de872cbb2ecc653ae83d5be7e5be9", "md5": "547de872cbb2ecc653ae83d5be7e5be9",