scribus: upgrade 1.5.7 -> 1.5.8 / fix build with poppler >= 22.2.0

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2022-03-03 22:41:25 +01:00
parent 9fa64202bf
commit b3ce9dc66f
4 changed files with 138 additions and 80 deletions

View File

@@ -0,0 +1,132 @@
From 85c0dff3422fa3c26fbc2e8d8561f597ec24bd92 Mon Sep 17 00:00:00 2001
From: Jean Ghali <jghali@libertysurf.fr>
Date: Wed, 2 Feb 2022 23:12:52 +0000
Subject: [PATCH] #16734: Build break with poppler 22.2.0
git-svn-id: svn://scribus.net/trunk/Scribus@24884 11d20701-8431-0410-a711-e3c959e3b870
Upstream-Status: Accepted
---
scribus/plugins/import/pdf/slaoutput.cpp | 47 +++++++++++++++++++-----
1 file changed, 37 insertions(+), 10 deletions(-)
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index 5894bf2ad6..3650c96f52 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -7,6 +7,11 @@ for which a new license (GPL+exception) is in place.
#include "slaoutput.h"
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+#include <memory>
+#include <optional>
+#endif
+
#include <poppler/GlobalParams.h>
#include <poppler/poppler-config.h>
#include <poppler/FileSpec.h>
@@ -3027,18 +3032,24 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties)
void SlaOutputDev::updateFont(GfxState *state)
{
GfxFont *gfxFont;
- GfxFontLoc *fontLoc;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ std::optional<GfxFontLoc> fontLoc;
+ const GooString * fileName = nullptr;
+ std::unique_ptr<FoFiTrueType> ff;
+#else
+ GfxFontLoc * fontLoc = nullptr;
+ GooString * fileName = nullptr;
+ FoFiTrueType * ff = nullptr;
+#endif
GfxFontType fontType;
SlaOutFontFileID *id;
SplashFontFile *fontFile;
SplashFontSrc *fontsrc = nullptr;
- FoFiTrueType *ff;
Object refObj, strObj;
- GooString *fileName;
- char *tmpBuf;
+ char *tmpBuf = nullptr;
int tmpBufLen = 0;
- int *codeToGID;
- const double *textMat;
+ int *codeToGID = nullptr;
+ const double *textMat = nullptr;
double m11, m12, m21, m22, fontSize;
SplashCoord mat[4];
int n = 0;
@@ -3046,9 +3057,6 @@ void SlaOutputDev::updateFont(GfxState *state)
SplashCoord matrix[6];
m_font = nullptr;
- fileName = nullptr;
- tmpBuf = nullptr;
- fontLoc = nullptr;
gfxFont = state->getFont();
if (!gfxFont)
@@ -3083,7 +3091,11 @@ void SlaOutputDev::updateFont(GfxState *state)
}
else
{ // gfxFontLocExternal
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ fileName = fontLoc->pathAsGooString();
+#else
fileName = fontLoc->path;
+#endif
fontType = fontLoc->fontType;
}
@@ -3136,9 +3148,14 @@ void SlaOutputDev::updateFont(GfxState *state)
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (ff)
{
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ codeToGID = ((Gfx8BitFont*) gfxFont)->getCodeToGIDMap(ff.get());
+ ff.reset();
+#else
codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
- n = 256;
delete ff;
+#endif
+ n = 256;
}
else
{
@@ -3209,8 +3226,13 @@ void SlaOutputDev::updateFont(GfxState *state)
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (! ff)
goto err2;
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
+ codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n);
+ ff.reset();
+#else
codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
delete ff;
+#endif
}
if (!(fontFile = m_fontEngine->loadTrueTypeFont(
id,
@@ -3247,14 +3269,19 @@ void SlaOutputDev::updateFont(GfxState *state)
mat[3] = -m22;
m_font = m_fontEngine->getFont(fontFile, mat, matrix);
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
delete fontLoc;
+#endif
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();
return;
err2:
delete id;
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
delete fontLoc;
+#endif
+
err1:
if (fontsrc && !fontsrc->isFile)
fontsrc->unref();

View File

@@ -1,41 +0,0 @@
From 1b546978bc4ea0b2a73fbe4d7cf947887e865162 Mon Sep 17 00:00:00 2001
From: Jean Ghali <jghali@libertysurf.fr>
Date: Sat, 21 Aug 2021 20:05:43 +0000
Subject: [PATCH] Use new hb-subset api with harfbuzz >= 2.9.0 in order to
prepeare for removal of legacy API in 3.0
git-svn-id: svn://scribus.net/trunk/Scribus@24696 11d20701-8431-0410-a711-e3c959e3b870
Upstream-Status: Accepted[https://github.com/scribusproject/scribus/commit/1b546978bc4ea0b2a73fbe4d7cf947887e865162]
---
scribus/fonts/sfnt.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scribus/fonts/sfnt.cpp b/scribus/fonts/sfnt.cpp
index 50777f66e..fca8b3915 100644
--- a/scribus/fonts/sfnt.cpp
+++ b/scribus/fonts/sfnt.cpp
@@ -1256,11 +1256,19 @@ namespace sfnt {
for (int i = 0; i < cids.count(); ++i)
hb_set_add(glyphSet, cids.at(i));
-
+
+#if HB_VERSION_ATLEAST(2, 9, 0)
+ uint32_t subsetFlags = (uint32_t) hb_subset_input_get_flags(hbSubsetInput.get());
+ subsetFlags |= HB_SUBSET_FLAGS_RETAIN_GIDS;
+ subsetFlags &= ~HB_SUBSET_FLAGS_NO_HINTING;
+ subsetFlags |= HB_SUBSET_FLAGS_NAME_LEGACY;
+ hb_subset_input_set_flags(hbSubsetInput.get(), subsetFlags);
+#else
hb_subset_input_set_retain_gids(hbSubsetInput.get(), true);
hb_subset_input_set_drop_hints(hbSubsetInput.get(), false);
#if HB_VERSION_ATLEAST(2, 6, 5)
hb_subset_input_set_name_legacy(hbSubsetInput.get(), true);
+#endif
#endif
QScopedPointer<hb_face_t, HbFaceDeleter> hbSubsetFace(hb_subset(hbFullFace.get(), hbSubsetInput.get()));
--
2.31.1

View File

@@ -1,35 +0,0 @@
From 68ec41169eaceea4a6e1d6f359762a191c7e61d5 Mon Sep 17 00:00:00 2001
From: Jean Ghali <jghali@libertysurf.fr>
Date: Sun, 19 Sep 2021 11:59:50 +0000
Subject: [PATCH] #16635: Replace hb_subset, removed in harfbuzz 3.0, by
hb_subset_or_fail
git-svn-id: svn://scribus.net/trunk/Scribus@24707 11d20701-8431-0410-a711-e3c959e3b870
Upstream-Status: Accepted[https://github.com/scribusproject/scribus/commit/68ec41169eaceea4a6e1d6f359762a191c7e61d5]
---
scribus/fonts/sfnt.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scribus/fonts/sfnt.cpp b/scribus/fonts/sfnt.cpp
index fca8b3915..b3dfa50dc 100644
--- a/scribus/fonts/sfnt.cpp
+++ b/scribus/fonts/sfnt.cpp
@@ -1271,9 +1271,15 @@ namespace sfnt {
#endif
#endif
+#if HB_VERSION_ATLEAST(2, 9, 0)
+ QScopedPointer<hb_face_t, HbFaceDeleter> hbSubsetFace(hb_subset_or_fail(hbFullFace.get(), hbSubsetInput.get()));
+ if (hbSubsetFace.isNull())
+ return QByteArray();
+#else
QScopedPointer<hb_face_t, HbFaceDeleter> hbSubsetFace(hb_subset(hbFullFace.get(), hbSubsetInput.get()));
if (hbSubsetFace.isNull())
return QByteArray();
+#endif
QScopedPointer<hb_blob_t, HbBlobDeleter> hbSubsetBlob(hb_face_reference_blob(hbSubsetFace.get()));
if (hbSubsetBlob.isNull())
--
2.31.1

View File

@@ -1,7 +1,7 @@
SUMMARY = "Scribus: Open source desktop publishing"
HOMEPAGE = "https://www.scribus.net/"
LICENSE = "GPL-2.0-or-later & LGPL-2.0-or-later & BSD-3-Clause & MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=46d73026c0f1b3a4016bc06a677411ab"
LIC_FILES_CHKSUM = "file://COPYING;md5=300e791cb9c6b02206963fb25dfa9aa5"
inherit cmake_qt5 cmake_extra_sanity pkgconfig python3native gtk-icon-cache mime mime-xdg
@@ -14,12 +14,14 @@ DEPENDS += " \
poppler \
"
# remove once we don't have patches any more
inherit dos2unix
SRC_URI = " \
${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}-devel/${PV}/${BPN}-${PV}.tar.xz \
file://0001-Use-new-hb-subset-api-with-harfbuzz-2.9.0-in-order-t.patch \
file://0002-16635-Replace-hb_subset-removed-in-harfbuzz-3.0-by-h.patch \
file://0001-16734-Build-break-with-poppler-22.2.0.patch \
"
SRC_URI[sha256sum] = "318316b2cfc7a76191d3e0d3f8c2265147daea0570162028e243c292d826f8ce"
SRC_URI[sha256sum] = "47816e8fcf6d05788ff16aa4499f97ff22431c777a7789149b0a88b451e16b74"
# necessary since poppler 21.01.0
EXTRA_OECMAKE = "-DWANT_CPP17=ON"