config_host/config_features.h.in      |    6 +++++
 configure.ac                          |    1 
 include/vcl/embeddedfontsmanager.hxx  |    3 --
 svx/source/inc/svdpdf.hxx             |    5 ----
 svx/source/svdraw/svdpdf.cxx          |   11 ---------
 vcl/source/gdi/embeddedfontsafdko.cxx |   38 ++++++++++++++++++++++++++++++----
 6 files changed, 41 insertions(+), 23 deletions(-)

New commits:
commit ce5a0395fb1c6fc030732d4063b96641adb3ee44
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Oct 17 12:17:50 2025 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Oct 31 08:27:30 2025 +0100

    configure afdko as a feature
    
    Change-Id: I9282f02e29f59c585f557075da03bbf4b631dcae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192702
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193135
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in
index 0faa67c64dbd..453594095017 100644
--- a/config_host/config_features.h.in
+++ b/config_host/config_features.h.in
@@ -7,6 +7,12 @@
 #ifndef CONFIG_FEATURES_H
 #define CONFIG_FEATURES_H
 
+/* AFDKO - Whether to have functionality to convert and merge
+ * embedded fonts of documents
+ */
+
+#define HAVE_FEATURE_AFDKO 0
+
 /* AVMEDIA - Whether to have functionality to display and manipulate
  * embedded AV media in documents
  */
diff --git a/configure.ac b/configure.ac
index d0f72d737ae7..d93612e1fe93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12843,6 +12843,7 @@ if test "$ENABLE_PDFIUM" = "TRUE"; then
     # which doesn't currently have --with-system support
     if test "$ENABLE_PDFIMPORT" = "TRUE"; then
         BUILD_TYPE="$BUILD_TYPE AFDKO"
+        AC_DEFINE(HAVE_FEATURE_AFDKO)
     fi
 fi
 AC_SUBST(SYSTEM_OPENJPEG2)
diff --git a/include/vcl/embeddedfontsmanager.hxx 
b/include/vcl/embeddedfontsmanager.hxx
index 069aaca80585..c502146631fa 100644
--- a/include/vcl/embeddedfontsmanager.hxx
+++ b/include/vcl/embeddedfontsmanager.hxx
@@ -13,7 +13,6 @@
 
 #include <com/sun/star/uno/Reference.hxx>
 
-#include <config_features.h>
 #include <rtl/ustring.hxx>
 #include <tools/fontenum.hxx>
 #include <tools/long.hxx>
@@ -127,7 +126,6 @@ public:
 
     static OUString getFileUrlForTemporaryFont(std::u16string_view name, 
std::u16string_view suffix);
 
-#if HAVE_FEATURE_PDFIMPORT
     // write text dump
     static bool tx_dump(const OUString& srcFontUrl, const OUString& 
destFileUrl);
     // write Type 1 font
@@ -140,7 +138,6 @@ public:
     static bool makeotf(const OUString& srcFontUrl, const OUString& 
destFileUrl,
                         const OUString& fontMenuNameDBUrl, const OUString& 
charMapUrl,
                         const OUString& featuresUrl);
-#endif
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/inc/svdpdf.hxx b/svx/source/inc/svdpdf.hxx
index ab354ee28c5c..a82b66dd8e6f 100644
--- a/svx/source/inc/svdpdf.hxx
+++ b/svx/source/inc/svdpdf.hxx
@@ -25,7 +25,6 @@
 #include <memory>
 #include <map>
 
-#include <config_features.h>
 #include <tools/fract.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/graph.hxx>
@@ -173,8 +172,6 @@ class ImpSdrPdfImport final
 
     void DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport, 
int nPageIndex);
 
-#if HAVE_FEATURE_PDFIMPORT
-
     static ImportedFontMap CollectFonts(sal_Int64 nPrefix, 
vcl::pdf::PDFiumDocument& rPdfDocument);
 
     sal_Int64 getPrefix() const { return reinterpret_cast<sal_Int64>(this); }
@@ -186,8 +183,6 @@ class ImpSdrPdfImport final
                                          const std::vector<uint8_t>& 
toUnicodeData,
                                          const vcl::pdf::PDFiumFont& font);
 
-#endif
-
     // Copy assignment is forbidden and not implemented.
     ImpSdrPdfImport(const ImpSdrPdfImport&) = delete;
     ImpSdrPdfImport& operator=(const ImpSdrPdfImport&) = delete;
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 6e6fbf4dea38..86b1172ca741 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -19,7 +19,6 @@
 
 #include <svdpdf.hxx>
 
-#include <config_features.h>
 #include <tools/UnitConversion.hxx>
 #include <vcl/canvastools.hxx>
 #include <vcl/embeddedfontsmanager.hxx>
@@ -121,7 +120,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, 
SdrLayerID nLay, const tools:
 
     mnPageCount = mpPdfDocument->getPageCount();
 
-#if HAVE_FEATURE_PDFIMPORT
     const std::shared_ptr<GfxLink> xGrfLink = rGraphic.GetSharedGfxLink();
     if (xGrfLink)
         mxImportedFonts = xGrfLink->getImportedFonts();
@@ -132,7 +130,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, 
SdrLayerID nLay, const tools:
         if (xGrfLink)
             xGrfLink->setImportedFonts(mxImportedFonts);
     }
-#endif
 
     // Same as SdModule
     mpVD = VclPtr<VirtualDevice>::Create();
@@ -149,8 +146,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, 
SdrLayerID nLay, const tools:
 
 ImpSdrPdfImport::~ImpSdrPdfImport() = default;
 
-#if HAVE_FEATURE_PDFIMPORT
-
 namespace
 {
 OUString GetPostScriptName(const OUString& rBaseFontName)
@@ -381,8 +376,6 @@ ImportedFontMap ImpSdrPdfImport::CollectFonts(sal_Int64 
nPrefix,
     return aImportedFonts;
 }
 
-#endif
-
 void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* 
pActionsToReport,
                                 int nPageIndex)
 {
@@ -826,8 +819,6 @@ void 
ImpSdrPdfImport::ImportForm(std::unique_ptr<vcl::pdf::PDFiumPageObject> con
     maCurrentMatrix = aOldMatrix;
 }
 
-#if HAVE_FEATURE_PDFIMPORT
-
 static bool extractEntry(std::string_view line, std::string_view key, OString& 
ret)
 {
     std::string_view result;
@@ -1706,8 +1697,6 @@ EmbeddedFontInfo ImpSdrPdfImport::convertToOTF(sal_Int64 
prefix, SubSetInfo& rSu
     return EmbeddedFontInfo();
 }
 
-#endif
-
 // There isn't, as far as I know, a way to stroke with a pattern at the moment,
 // so extract some sensible color if this is a stroke pattern
 Color ImpSdrPdfImport::getStrokeColor(
diff --git a/vcl/source/gdi/embeddedfontsafdko.cxx 
b/vcl/source/gdi/embeddedfontsafdko.cxx
index 02cd0d6de05a..f6fcfbfd3180 100644
--- a/vcl/source/gdi/embeddedfontsafdko.cxx
+++ b/vcl/source/gdi/embeddedfontsafdko.cxx
@@ -17,11 +17,12 @@
 
 #include <config_features.h>
 
-#if HAVE_FEATURE_PDFIMPORT
-
 #include <osl/file.hxx>
 #include <rtl/strbuf.hxx>
 #include <vcl/embeddedfontsmanager.hxx>
+
+#if HAVE_FEATURE_AFDKO
+
 #include "afdko.hxx"
 
 #define SUPERVERBOSE 0
@@ -64,6 +65,7 @@ static bool convertTx(txCtx h)
 
     return true;
 }
+#endif
 
 static void suppressDebugMessagess(txCtx h)
 {
@@ -85,6 +87,7 @@ static void suppressDebugMessagess(txCtx h)
 // System afdko could be used by calling: tx -dump src dest here
 bool EmbeddedFontsManager::tx_dump(const OUString& srcFontUrl, const OUString& 
destFileUrl)
 {
+#if HAVE_FEATURE_AFDKO
     OUString srcFontPath, destFilePath;
     if (osl::FileBase::E_None != 
osl::FileBase::getSystemPathFromFileURL(srcFontUrl, srcFontPath)
         || osl::FileBase::E_None
@@ -109,11 +112,17 @@ bool EmbeddedFontsManager::tx_dump(const OUString& 
srcFontUrl, const OUString& d
     bool result = convertTx(h);
     txFree(h);
     return result;
+#else
+    (void)srcFontUrl;
+    (void)destFileUrl;
+    return false;
+#endif
 }
 
 // System afdko could be used by calling: tx -t1 src dest here
 bool EmbeddedFontsManager::tx_t1(const OUString& srcFontUrl, const OUString& 
destFileUrl)
 {
+#if HAVE_FEATURE_AFDKO
     OUString srcFontPath, destFilePath;
     if (osl::FileBase::E_None != 
osl::FileBase::getSystemPathFromFileURL(srcFontUrl, srcFontPath)
         || osl::FileBase::E_None
@@ -137,12 +146,18 @@ bool EmbeddedFontsManager::tx_t1(const OUString& 
srcFontUrl, const OUString& des
     bool result = convertTx(h);
     txFree(h);
     return result;
+#else
+    (void)srcFontUrl;
+    (void)destFileUrl;
+    return false;
+#endif
 }
 
 // System afdko could be used by calling: mergefonts -cid cidfontinfo destfile 
[glyphaliasfile mergefontfile]+ here
 bool EmbeddedFontsManager::mergefonts(const OUString& cidFontInfoUrl, const 
OUString& destFileUrl,
                                       const std::vector<std::pair<OUString, 
OUString>>& fonts)
 {
+#if HAVE_FEATURE_AFDKO
     OUString cidFontInfoPath, destFilePath;
     if (osl::FileBase::E_None
             != osl::FileBase::getSystemPathFromFileURL(cidFontInfoUrl, 
cidFontInfoPath)
@@ -214,8 +229,15 @@ bool EmbeddedFontsManager::mergefonts(const OUString& 
cidFontInfoUrl, const OUSt
     rename(tmpdestfile.getStr(), destFilePathA.getStr());
 
     return result;
+#else
+    (void)cidFontInfoUrl;
+    (void)destFileUrl;
+    (void)fonts;
+    return false;
+#endif
 }
 
+#if HAVE_FEATURE_AFDKO
 static void* cb_memory(ctlMemoryCallbacks* /*cb*/, void* old, size_t size)
 {
     if (size == 0)
@@ -229,12 +251,14 @@ static void* cb_memory(ctlMemoryCallbacks* /*cb*/, void* 
old, size_t size)
 
     return malloc(size);
 }
+#endif
 
 // System afdko could be used by calling: makeotf[exe] -mf fontMenuNameDB -f 
srcFont -o destFile -ch charMap [-ff features]
 bool EmbeddedFontsManager::makeotf(const OUString& srcFontUrl, const OUString& 
destFileUrl,
                                    const OUString& fontMenuNameDBUrl, const 
OUString& charMapUrl,
                                    const OUString& featuresUrl)
 {
+#if HAVE_FEATURE_AFDKO
     OUString srcFontPath, destFilePath, charMapPath, fontMenuNameDBPath, 
featuresPath;
     if (osl::FileBase::E_None != 
osl::FileBase::getSystemPathFromFileURL(srcFontUrl, srcFontPath)
         || osl::FileBase::E_None
@@ -297,8 +321,14 @@ bool EmbeddedFontsManager::makeotf(const OUString& 
srcFontUrl, const OUString& d
               nullptr, nullptr, fontConvertFlags, 0, 0, 0, 0, -1, -1, 0, 
nullptr);
 
     return true;
-}
-
+#else
+    (void)srcFontUrl;
+    (void)destFileUrl;
+    (void)fontMenuNameDBUrl;
+    (void)charMapUrl;
+    (void)featuresUrl;
+    return false;
 #endif
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to