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 <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2025-10-20 15:05:34 +02:00
parent 10b7bed6f3
commit 2595f031fa
6 changed files with 41 additions and 23 deletions
+6
View File
@@ -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
*/
+1
View File
@@ -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)
-3
View File
@@ -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>
@@ -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: */
-5
View File
@@ -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
void CollectFonts();
sal_Int64 getPrefix() const { return reinterpret_cast<sal_Int64>(this); }
@@ -185,8 +182,6 @@ class ImpSdrPdfImport final
std::u16string_view fontFileName,
const std::vector<uint8_t>& toUnicodeData);
#endif
// Copy assignment is forbidden and not implemented.
ImpSdrPdfImport(const ImpSdrPdfImport&) = delete;
ImpSdrPdfImport& operator=(const ImpSdrPdfImport&) = delete;
-11
View File
@@ -19,7 +19,6 @@
#include <svdpdf.hxx>
#include <config_features.h>
#include <tools/UnitConversion.hxx>
#include <vcl/embeddedfontsmanager.hxx>
#include <vcl/graph.hxx>
@@ -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<VirtualDevice>::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<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;
@@ -1724,8 +1715,6 @@ EmbeddedFontInfo ImpSdrPdfImport::convertToOTF(sal_Int64 prefix, SubSetInfo& rSu
return EmbeddedFontInfo();
}
#endif
void ImpSdrPdfImport::ImportText(std::unique_ptr<vcl::pdf::PDFiumPageObject> const& pPageObject,
std::unique_ptr<vcl::pdf::PDFiumTextPage> const& pTextPage,
int /*nPageObjectIndex*/)
+34 -4
View File
@@ -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"
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<std::pair<OUString, OUString>>& 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: */