vcl/source/gdi/pdfwriter_impl.cxx |    5 ++---
 vcl/source/pdf/ResourceDict.cxx   |    6 +++---
 2 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 8cc9af311e480837e0b20b7fc240c975543ff46d
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Thu Jun 29 11:15:20 2023 +0000
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Sat Jul 1 08:40:29 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>
    (cherry picked from commit f49a70942ab1f9c20a3605b13f772526d06cf9a6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153761

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 968a2249551c..c3844bcc8e86 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2755,7 +2755,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();
@@ -2810,8 +2810,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);

Reply via email to