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 bfa4c9ac0ab4..721ffb1e31f1 100644 --- a/configure.ac +++ b/configure.ac @@ -12942,6 +12942,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 dcfa29eb836e..95a3580898f5 100644 --- a/include/vcl/embeddedfontsmanager.hxx +++ b/include/vcl/embeddedfontsmanager.hxx @@ -13,7 +13,6 @@ #include -#include #include #include #include @@ -118,7 +117,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 @@ -131,7 +129,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 089c0621f535..0209b358e8a8 100644 --- a/svx/source/inc/svdpdf.hxx +++ b/svx/source/inc/svdpdf.hxx @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -173,8 +172,6 @@ class ImpSdrPdfImport final void DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport, int nPageIndex); -#if HAVE_FEATURE_PDFIMPORT - void CollectFonts(); sal_Int64 getPrefix() const { return reinterpret_cast(this); } @@ -185,8 +182,6 @@ class ImpSdrPdfImport final std::u16string_view fontFileName, const std::vector& toUnicodeData); -#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 ed25fc3a0c39..0e2e61a78111 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -19,7 +19,6 @@ #include -#include #include #include #include @@ -118,9 +117,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools: mnPageCount = mpPdfDocument->getPageCount(); -#if HAVE_FEATURE_PDFIMPORT CollectFonts(); -#endif // Same as SdModule mpVD = VclPtr::Create(); @@ -141,8 +138,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools: ImpSdrPdfImport::~ImpSdrPdfImport() = default; -#if HAVE_FEATURE_PDFIMPORT - namespace { OUString GetPostScriptName(const OUString& rBaseFontName) @@ -359,8 +354,6 @@ void ImpSdrPdfImport::CollectFonts() } } -#endif - void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport, int nPageIndex) { @@ -938,8 +931,6 @@ void ImpSdrPdfImport::ImportForm(std::unique_ptr con maCurrentMatrix = aOldMatrix; } -#if HAVE_FEATURE_PDFIMPORT - static bool extractEntry(std::string_view line, std::string_view key, OString& ret) { std::string_view result; @@ -1724,8 +1715,6 @@ EmbeddedFontInfo ImpSdrPdfImport::convertToOTF(sal_Int64 prefix, SubSetInfo& rSu return EmbeddedFontInfo(); } -#endif - void ImpSdrPdfImport::ImportText(std::unique_ptr const& pPageObject, std::unique_ptr const& pTextPage, int /*nPageObjectIndex*/) diff --git a/vcl/source/gdi/embeddedfontsafdko.cxx b/vcl/source/gdi/embeddedfontsafdko.cxx index c067c6e2d10f..a6db3f3fe070 100644 --- a/vcl/source/gdi/embeddedfontsafdko.cxx +++ b/vcl/source/gdi/embeddedfontsafdko.cxx @@ -17,11 +17,12 @@ #include -#if HAVE_FEATURE_PDFIMPORT - #include #include #include + +#if HAVE_FEATURE_AFDKO + #include "afdko.hxx" static bool convertTx(txCtx h) @@ -62,10 +63,12 @@ static bool convertTx(txCtx h) return true; } +#endif // 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 @@ -89,11 +92,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 @@ -116,12 +125,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>& fonts) { +#if HAVE_FEATURE_AFDKO OUString cidFontInfoPath, destFilePath; if (osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(cidFontInfoUrl, cidFontInfoPath) @@ -192,8 +207,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) @@ -207,12 +229,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 @@ -267,8 +291,14 @@ bool EmbeddedFontsManager::makeotf(const OUString& srcFontUrl, const OUString& d nullptr, nullptr, 0, 0, 0, 0, 0, -1, -1, 0, nullptr); return true; +#else + (void)srcFontUrl; + (void)destFileUrl; + (void)fontMenuNameDBUrl; + (void)charMapUrl; + (void)featuresUrl; + return false; +#endif } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */