Merge pull request #11553 from tamuratak/svg_texthscale

Fix the horizontal scaling of texts with SVG backend. #10988
This commit is contained in:
Tim van der Meij 2020-03-15 13:25:08 +01:00 committed by GitHub
commit 4dc1058ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -823,7 +823,7 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// might actually map to a different glyph. // might actually map to a different glyph.
continue; continue;
} }
current.xcoords.push(current.x + x * textHScale); current.xcoords.push(current.x + x);
current.tspan.textContent += character; current.tspan.textContent += character;
x += charWidth; x += charWidth;
} }
@ -892,7 +892,7 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
current.txtElement.setAttributeNS( current.txtElement.setAttributeNS(
null, null,
"transform", "transform",
`${pm(textMatrix)} scale(1, -1)` `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`
); );
current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve"); current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve");
current.txtElement.appendChild(current.tspan); current.txtElement.appendChild(current.tspan);