svx/source/svdraw/svdpdf.cxx          |   21 ++++++++++++++-------
 vcl/source/gdi/embeddedfontsafdko.cxx |   12 ++++++++++--
 2 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 4be916a1da2393651bb21226162be0c4873563ed
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Sep 30 13:48:16 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Oct 15 09:24:11 2025 +0200

    output equivalent commands for debugging
    
    Change-Id: I2f2eef16932a2dd8047a54597cb1e765c3daa29d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191682
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 6f34d8be53cca8e33304aad537da2649f7fb8d2e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192352
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/vcl/source/gdi/embeddedfontsafdko.cxx 
b/vcl/source/gdi/embeddedfontsafdko.cxx
index d97888324f47..36cc6447d274 100644
--- a/vcl/source/gdi/embeddedfontsafdko.cxx
+++ b/vcl/source/gdi/embeddedfontsafdko.cxx
@@ -19,8 +19,9 @@
 
 #if HAVE_FEATURE_PDFIMPORT
 
-#include <vcl/embeddedfontsmanager.hxx>
 #include <osl/file.hxx>
+#include <rtl/strbuf.hxx>
+#include <vcl/embeddedfontsmanager.hxx>
 #include "afdko.hxx"
 
 static bool convertTx(txCtx h)
@@ -150,11 +151,18 @@ bool EmbeddedFontsManager::mergefonts(const OUString& 
cidFontInfoUrl, const OUSt
         return false;
 
     OString cidFontInfoPathA(cidFontInfoPath.toUtf8());
+    OString destFilePathA(destFilePath.toUtf8());
+
+    OStringBuffer aBuffer;
+    for (const auto& path : paths)
+        aBuffer.append(" "_ostr + path);
+    SAL_INFO("vcl.fonts",
+             "mergefonts -cid " << cidFontInfoPathA << " " << destFilePathA << 
aBuffer.toString());
+
     readCIDFontInfo(h, const_cast<char*>(cidFontInfoPathA.getStr()));
 
     setMode(h, mode_cff);
 
-    OString destFilePathA(destFilePath.toUtf8());
     dstFileSetName(h, const_cast<char*>(destFilePathA.getStr()));
     h->cfw.flags |= CFW_CHECK_IF_GLYPHS_DIFFER;
     h->cfw.flags |= CFW_PRESERVE_GLYPH_ORDER;
commit 0424f6957bb8f7adbf321e6c0c5ac07eb296b6e8
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Sep 30 14:27:43 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Oct 15 09:24:00 2025 +0200

    replace the broken font name in the cidfontinfo as well
    
    Change-Id: Ie353a01928baff70ab574a7bc4fe1345435a5fb4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191684
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit 5e7127ee91eff3c83eecf67f1a6abe13bfe9ac0c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192351
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 711532b65c5b..9f83e31d9da1 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -1005,6 +1005,7 @@ static bool toPfaCID(SubSetInfo& rSubSetInfo, const 
OUString& fileUrl,
     OUString toMergedMapUrl = fileUrl + u".tomergedmap";
 
     OString version, Notice, FullName, FamilyName, CIDFontName, 
CIDFontVersion, srcFontType;
+    OString brokenFontName;
     FontName = postScriptName.toUtf8();
     std::map<sal_Int32, OString> glyphIndexToName;
 
@@ -1024,7 +1025,6 @@ static bool toPfaCID(SubSetInfo& rSubSetInfo, const 
OUString& fileUrl,
         return false;
     }
     SAL_INFO("sd.filter", "dump success");
-    bool bBrokenFontName(false);
     SvFileStream info(infoUrl, StreamMode::READ);
     OStringBuffer glyphBuffer;
     OString sLine;
@@ -1046,10 +1046,14 @@ static bool toPfaCID(SubSetInfo& rSubSetInfo, const 
OUString& fileUrl,
             continue;
         if (extractEntry(sLine, "FontName", FontName))
         {
-            bBrokenFontName = FontName != postScriptName.toUtf8();
-            SAL_WARN_IF(bBrokenFontName, "sd.filter",
-                        "expected that FontName of <" << FontName << "> 
matches PostScriptName of <"
-                                                      << postScriptName << 
">");
+            const bool bBrokenFontName = FontName != postScriptName.toUtf8();
+            if (bBrokenFontName)
+            {
+                SAL_WARN("sd.filter", "expected that FontName of <"
+                                          << FontName << "> matches 
PostScriptName of <"
+                                          << postScriptName << ">");
+                brokenFontName = FontName;
+            }
             continue;
         }
         if (extractEntry(sLine, "cid.CIDFontName", CIDFontName))
@@ -1109,6 +1113,9 @@ static bool toPfaCID(SubSetInfo& rSubSetInfo, const 
OUString& fileUrl,
     if (version.isEmpty())
         version = CIDFontVersion;
 
+    if (!brokenFontName.isEmpty())
+        FontName = postScriptName.toUtf8();
+
     // Always create cidFontInfo, we will need it if we need to merge fonts
     OString AdobeCopyright, Trademark;
     sal_Int32 nSplit = !Notice.isEmpty() ? Notice.lastIndexOf('.', 
Notice.getLength() - 1) : -1;
@@ -1173,8 +1180,8 @@ static bool toPfaCID(SubSetInfo& rSubSetInfo, const 
OUString& fileUrl,
         }
     }
 
-    if (bBrokenFontName)
-        rewriteBrokenFontName(FontName, CIDFontName, postScriptName.toUtf8(), 
pfaCIDUrl);
+    if (!brokenFontName.isEmpty())
+        rewriteBrokenFontName(brokenFontName, CIDFontName, FontName, 
pfaCIDUrl);
 
     return true;
 }

Reply via email to