vcl/source/gdi/pdfwriter_impl.cxx | 5 ++--- vcl/source/pdf/ResourceDict.cxx | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-)
New commits: commit 6c51710969003c0b97e4739d515fe5734798b92d Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Thu Jun 29 11:15:20 2023 +0000 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Fri Jun 30 09:50:15 2023 +0200 tdf#156084: Fix PDF export of bitmap color fonts A regression from the commit below caused the resources dictionary of the Type 3 font to be omitted making the images inaccessible: commit 845fbfcce9091e541bab657163b026aad8648261 Author: Khaled Hosny <kha...@libreoffice.org> Date: Thu Jun 15 06:27:38 2023 +0300 Don’t add empty Fonts dictionary to Type 3 font resources Change-Id: I479ca328bd1b1228ba722678d3d9686c8456b350 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153780 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4ccbdc20bdde..2f83c5cb6ef8 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2756,7 +2756,7 @@ bool PDFWriterImpl::emitType3Font(const vcl::font::PhysicalFontFace* pFace, } // write font dict - sal_Int32 nFontDict = -1; + sal_Int32 nFontDict = 0; if (!aUsedFonts.empty()) { nFontDict = createObject(); @@ -2811,8 +2811,7 @@ bool PDFWriterImpl::emitType3Font(const vcl::font::PhysicalFontFace* pFace, // write resources dict aLine.setLength(0); aLine.append(OString::number(nResources) + " 0 obj\n"); - if (!aUsedFonts.empty()) - aResourceDict.append(aLine, nFontDict); + aResourceDict.append(aLine, nFontDict); aLine.append("endobj\n\n"); if (!updateObject(nResources)) return false; diff --git a/vcl/source/pdf/ResourceDict.cxx b/vcl/source/pdf/ResourceDict.cxx index 3490da30b899..f4647cb38335 100644 --- a/vcl/source/pdf/ResourceDict.cxx +++ b/vcl/source/pdf/ResourceDict.cxx @@ -42,9 +42,9 @@ void appendResourceMap(OStringBuffer& rBuf, const char* pPrefix, void ResourceDict::append(OStringBuffer& rBuf, sal_Int32 nFontDictObject) { - rBuf.append("<</Font "); - rBuf.append(nFontDictObject); - rBuf.append(" 0 R\n"); + rBuf.append("<<\n"); + if (nFontDictObject) + rBuf.append("/Font " + OString::number(nFontDictObject) + " 0 R\n"); appendResourceMap(rBuf, "XObject", m_aXObjects); appendResourceMap(rBuf, "ExtGState", m_aExtGStates); appendResourceMap(rBuf, "Shading", m_aShadings);