diff options
author | Khaled Hosny <khaled@libreoffice.org> | 2023-07-04 15:49:35 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-07-08 20:35:25 +0200 |
commit | 19ca32ed1ee22274a38b217f1d86109d217acdaf (patch) | |
tree | 1787b320745f1a5d7d2772e5b3d15df4ed013293 /vcl | |
parent | 26edf2d398f4e70665a2dedf6b317efa27ad303f (diff) |
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 c1dcffceb14cd35c7168ba2108b2f2e9aa875b56)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153997
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b00c2d439fdb..24b081ebb8ef 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2675,6 +2675,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]; @@ -2755,9 +2759,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"); |