tdf#156151: Take PDF DPI into account when outputting Type 3 glyphs
We were always assuming the default 720 DPI, but this is not always true
when printing to file as the DPI would depend on printer settings in
this case.
Change-Id: I747f8e24f0942ecb94eb8acfc1dd9972d83ba0e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153978
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
(cherry picked from commit 4b05805df02eadd920e808c8f82dbfd1038b4be8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153996
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 432f25b..b565374 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2649,6 +2649,10 @@ bool PDFWriterImpl::emitType3Font(const vcl::font::PhysicalFontFace* pFace,
ResourceDict aResourceDict;
std::list<StreamRedirect> aOutputStreams;
// Scale for glyph outlines.
double fScaleX = GetDPIX() / 72.;
double fScaleY = GetDPIY() / 72.;
for (auto i = 1u; i < nGlyphs; i++)
{
auto nStream = pGlyphStreams[i];
@@ -2731,9 +2735,12 @@ bool PDFWriterImpl::emitType3Font(const vcl::font::PhysicalFontFace* pFace,
const auto& rOutline = rGlyph.getOutline();
if (rOutline.count())
{
// XXX I have no idea why this transformation matrix is needed.
aContents.append("q 10 0 0 10 0 ");
appendDouble(m_aPages.back().getHeight() * -10, aContents, 3);
aContents.append("q ");
appendDouble(fScaleX, aContents);
aContents.append(" 0 0 ");
appendDouble(fScaleY, aContents);
aContents.append(" 0 ");
appendDouble(m_aPages.back().getHeight() * -fScaleY, aContents, 3);
aContents.append(" cm\n");
m_aPages.back().appendPolyPolygon(rOutline, aContents);
aContents.append("f\n"