[neon/extras/calligra/Neon/release] debian: support newer poppler (#1012846)

Pino Toscano null at kde.org
Wed Sep 7 17:19:49 BST 2022


Git commit eb2dc3324f1f3f78d58a81deeba7e115307a482b by Pino Toscano.
Committed on 06/07/2022 at 12:19.
Pushed by jriddell into branch 'Neon/release'.

support newer poppler (#1012846)

- backport upstream commit 2bbbeb09f9d50f1952fd7f4020ca77a0c932d23b,
  upstream commit 236bacbe13739414e919de868283b0caf2df5d8a,
  upstream commit 6b75bec784c9835c78993349845d8c2ef22ec3de, and
  upstream commit 59eb4d2235b88408accf452421526b6f281cbab0
- update poppler B-Ds accordingly

M  +12   -0    debian/changelog
M  +2    -1    debian/control
M  +4    -0    debian/patches/series
A  +73   -0    debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler.patch
A  +94   -0    debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler_2.patch
A  +305  -0    debian/patches/upstream_Raise-minimum-poppler-version-to-0.83.0-cleaning-up-.patch
A  +25   -0    debian/patches/upstream_SvgOutputDev-Fix-ifdef-version-for-getFont-API-chang.patch

https://invent.kde.org/neon/extras/calligra/commit/eb2dc3324f1f3f78d58a81deeba7e115307a482b

diff --git a/debian/changelog b/debian/changelog
index 41d3c39..21c4a8a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,18 @@ calligra (1:3.2.1+dfsg-6) UNRELEASED; urgency=medium
   * Bump Standards-Version to 4.6.1, no changes required.
   * Remove inactive Uploaders, adding myself as one to avoid leaving the source
     with no human maintainers.
+  * Backport upstream commit 2bbbeb09f9d50f1952fd7f4020ca77a0c932d23b,
+    upstream commit 236bacbe13739414e919de868283b0caf2df5d8a,
+    upstream commit 6b75bec784c9835c78993349845d8c2ef22ec3de, and
+    upstream commit 59eb4d2235b88408accf452421526b6f281cbab0 to fix the build
+    with newer versions of Poppler; patches
+    upstream_Raise-minimum-poppler-version-to-0.83.0-cleaning-up-.patch,
+    upstream_PdfImport-Fix-compile-with-newer-poppler.patch,
+    upstream_PdfImport-Fix-compile-with-newer-poppler_2.patch, and
+    upstream_SvgOutputDev-Fix-ifdef-version-for-getFont-API-chang.patch
+    (Closes: #1012846)
+    - bump the required version of Poppler to 0.83.0 accordingly
+    - add the libpoppler-qt5-dev build dependency
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Wed, 06 Jul 2022 13:59:19 +0200
 
diff --git a/debian/control b/debian/control
index 5198740..57f302f 100644
--- a/debian/control
+++ b/debian/control
@@ -56,7 +56,8 @@ Build-Depends: cmake (>= 3.16~),
                libopenexr-dev,
                libphonon4qt5-dev,
                libphonon4qt5experimental-dev,
-               libpoppler-private-dev,
+               libpoppler-private-dev (>= 0.83.0~),
+               libpoppler-qt5-dev (>= 0.83.0~),
                libqca-qt5-2-dev,
                libqt5opengl5-dev (>= 5.3.0),
                libqt5svg5-dev (>= 5.3.0),
diff --git a/debian/patches/series b/debian/patches/series
index 27443a9..fe091ae 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,7 @@ upstream_Small-CMake-modernization.patch
 upstream_Update-Cmake-and-deps-Fix-Freetype-and-FontConfig-Li.patch
 upstream_Remove-old-std-c-11-setting-for-Vc.patch
 upstream_Fix-compile-with-newer-versions-of-poppler.patch
+upstream_Raise-minimum-poppler-version-to-0.83.0-cleaning-up-.patch
+upstream_PdfImport-Fix-compile-with-newer-poppler.patch
+upstream_PdfImport-Fix-compile-with-newer-poppler_2.patch
+upstream_SvgOutputDev-Fix-ifdef-version-for-getFont-API-chang.patch
diff --git a/debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler.patch b/debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler.patch
new file mode 100644
index 0000000..ba27196
--- /dev/null
+++ b/debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler.patch
@@ -0,0 +1,73 @@
+From 236bacbe13739414e919de868283b0caf2df5d8a Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid at kde.org>
+Date: Wed, 13 Apr 2022 01:25:44 +0200
+Subject: [PATCH] PdfImport: Fix compile with newer poppler
+
+Brings a dependency on poppler-qt5 to be able to include the version
+header, honestly it's not strictly needed, one could do a
+check_cxx_source_compiles, but I don't care about Calligra enough to
+spend more time making it compile while it's using poppler the wrong
+way.
+---
+ CMakeLists.txt                    | 1 +
+ filters/karbon/pdf/CMakeLists.txt | 2 +-
+ filters/karbon/pdf/PdfImport.cpp  | 9 +++++++++
+ 3 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 51f1d65b8e6..06bbad5c24c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -952,6 +952,7 @@ calligra_drop_product_on_bad_condition( FILTER_WPG_TO_ODG
+ calligra_drop_product_on_bad_condition( FILTER_PDF_TO_SVG
+     NOT_WIN "not supported on Windows"
+     PopplerXPDFHeaders_FOUND "poppler xpdf headers not found"
++    Poppler_FOUND "poppler qt5 headers not found"
+     )
+ 
+ calligra_drop_product_on_bad_condition( FILTER_HTML_TO_ODS
+diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
+index 8fddf1ad757..b71c92cbf04 100644
+--- a/filters/karbon/pdf/CMakeLists.txt
++++ b/filters/karbon/pdf/CMakeLists.txt
+@@ -3,7 +3,7 @@ set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp )
+ add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS})
+ calligra_filter_desktop_to_json(calligra_filter_pdf2svg calligra_filter_pdf2svg.desktop)
+ 
+-target_link_libraries(calligra_filter_pdf2svg komain Poppler::Core)
++target_link_libraries(calligra_filter_pdf2svg komain Poppler::Core Poppler::Qt5)
+ 
+ install(TARGETS calligra_filter_pdf2svg DESTINATION ${PLUGIN_INSTALL_DIR}/calligra/formatfilters)
+ 
+diff --git a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp
+index abbe681b4e8..e97974fc133 100644
+--- a/filters/karbon/pdf/PdfImport.cpp
++++ b/filters/karbon/pdf/PdfImport.cpp
+@@ -17,6 +17,10 @@
+ 
+ #include <kpluginfactory.h>
+ 
++#include <poppler-version.h>
++
++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
++
+ // Don't show this warning: it's an issue in poppler
+ #ifdef __GNUC__
+ #pragma GCC diagnostic ignored "-Wunused-parameter"
+@@ -54,8 +58,13 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt
+     if (! globalParams)
+         return KoFilter::NotImplemented;
+ 
++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
+     GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
+     PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
++#else
++    std::unique_ptr<GooString> fname = std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data());
++    PDFDoc * pdfDoc = new PDFDoc(std::move(fname));
++#endif
+     if (! pdfDoc) {
+         globalParams.reset();
+         return KoFilter::StupidError;
+-- 
+2.35.1
+
diff --git a/debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler_2.patch b/debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler_2.patch
new file mode 100644
index 0000000..f972b60
--- /dev/null
+++ b/debian/patches/upstream_PdfImport-Fix-compile-with-newer-poppler_2.patch
@@ -0,0 +1,94 @@
+From 6b75bec784c9835c78993349845d8c2ef22ec3de Mon Sep 17 00:00:00 2001
+From: Dag Andersen <dag.andersen at kdemail.net>
+Date: Wed, 13 Apr 2022 14:45:33 +0200
+Subject: [PATCH] PdfImport: Fix compile with newer poppler
+
+Also fixes odg2pdf filter.
+
+Same solution as commit 236bacbe13739414e919de868283b0caf2df5d8a
+by accid at kde.org.
+---
+ filters/karbon/pdf/CMakeLists.txt    | 2 +-
+ filters/karbon/pdf/Pdf2OdgImport.cpp | 9 +++++++++
+ filters/karbon/pdf/SvgOutputDev.cpp  | 9 +++++++++
+ 3 files changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
+index b71c92cbf04..4ce138ccdd6 100644
+--- a/filters/karbon/pdf/CMakeLists.txt
++++ b/filters/karbon/pdf/CMakeLists.txt
+@@ -13,6 +13,6 @@ set(pdf2odg_PART_SRCS PdfImportDebug.cpp Pdf2OdgImport.cpp SvgOutputDev.cpp)
+ add_library(calligra_filter_pdf2odg MODULE ${pdf2odg_PART_SRCS})
+ calligra_filter_desktop_to_json(calligra_filter_pdf2odg calligra_filter_pdf2odg.desktop)
+ 
+-target_link_libraries(calligra_filter_pdf2odg kopageapp karbonui Poppler::Core)
++target_link_libraries(calligra_filter_pdf2odg kopageapp karbonui Poppler::Core Poppler::Qt5)
+ 
+ install(TARGETS calligra_filter_pdf2odg DESTINATION ${PLUGIN_INSTALL_DIR}/calligra/formatfilters)
+diff --git a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp
+index 934e31dd5aa..a21eac97a77 100644
+--- a/filters/karbon/pdf/Pdf2OdgImport.cpp
++++ b/filters/karbon/pdf/Pdf2OdgImport.cpp
+@@ -27,6 +27,8 @@
+ 
+ #include <kpluginfactory.h>
+ 
++#include <poppler-version.h>
++
+ // Don't show this warning: it's an issue in poppler
+ #ifdef __GNUC__
+ #pragma GCC diagnostic ignored "-Wunused-parameter"
+@@ -36,6 +38,8 @@
+ #include <PDFDoc.h>
+ #include <GlobalParams.h>
+ 
++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
++
+ K_PLUGIN_FACTORY_WITH_JSON(Pdf2OdgImportFactory, "calligra_filter_pdf2odg.json",
+                            registerPlugin<Pdf2OdgImport>();)
+ 
+@@ -69,8 +73,13 @@ KoFilter::ConversionStatus Pdf2OdgImport::convert(const QByteArray& from, const
+     if (! globalParams)
+         return KoFilter::NotImplemented;
+ 
++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
+     GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
+     PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
++#else
++    std::unique_ptr<GooString> fname = std::make_unique<GooString>(QFile::encodeName(m_chain->inputFile()).data());
++    PDFDoc * pdfDoc = new PDFDoc(std::move(fname));
++#endif
+     if (! pdfDoc) {
+         globalParams.reset();
+         return KoFilter::StupidError;
+diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp
+index 0e6e5a934ca..7caec15175a 100644
+--- a/filters/karbon/pdf/SvgOutputDev.cpp
++++ b/filters/karbon/pdf/SvgOutputDev.cpp
+@@ -22,6 +22,10 @@
+ #include <QPen>
+ #include <QImage>
+ 
++#include <poppler-version.h>
++
++#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
++
+ class SvgOutputDev::Private
+ {
+ public:
+@@ -386,7 +390,12 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
+     if (s->getLength() == 0)
+         return;
+ 
++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
+     GfxFont * font = state->getFont();
++#else
++    std::shared_ptr<GfxFont> font = state->getFont();
++#endif
++
+ 
+     QString str;
+ 
+-- 
+2.35.1
+
diff --git a/debian/patches/upstream_Raise-minimum-poppler-version-to-0.83.0-cleaning-up-.patch b/debian/patches/upstream_Raise-minimum-poppler-version-to-0.83.0-cleaning-up-.patch
new file mode 100644
index 0000000..f674e76
--- /dev/null
+++ b/debian/patches/upstream_Raise-minimum-poppler-version-to-0.83.0-cleaning-up-.patch
@@ -0,0 +1,305 @@
+From 2bbbeb09f9d50f1952fd7f4020ca77a0c932d23b Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <asturm at gentoo.org>
+Date: Mon, 20 Dec 2021 10:33:08 +0100
+Subject: [PATCH] Raise minimum poppler version to 0.83.0, cleaning up ifdefs
+
+Signed-off-by: Andreas Sturmlechner <asturm at gentoo.org>
+---
+ CMakeLists.txt                       |  2 +-
+ filters/karbon/pdf/CMakeLists.txt    | 16 -----------
+ filters/karbon/pdf/Pdf2OdgImport.cpp | 19 -------------
+ filters/karbon/pdf/PdfImport.cpp     | 21 ---------------
+ filters/karbon/pdf/SvgOutputDev.cpp  | 40 +---------------------------
+ filters/karbon/pdf/SvgOutputDev.h    | 14 ----------
+ 6 files changed, 2 insertions(+), 110 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 89636205c2b..3a86ec88f7d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -704,7 +704,7 @@ set_package_properties(LibEtonyek PROPERTIES
+ ##
+ ## Test for qt-poppler
+ ##
+-macro_optional_find_package(Poppler COMPONENTS Qt5)
++macro_optional_find_package(Poppler 0.83.0 COMPONENTS Qt5)
+ set_package_properties(Poppler PROPERTIES
+     DESCRIPTION "A PDF rendering library"
+     URL "http://poppler.freedesktop.org"
+diff --git a/filters/karbon/pdf/CMakeLists.txt b/filters/karbon/pdf/CMakeLists.txt
+index 94d4071da3d..8fddf1ad757 100644
+--- a/filters/karbon/pdf/CMakeLists.txt
++++ b/filters/karbon/pdf/CMakeLists.txt
+@@ -1,19 +1,3 @@
+-if(Poppler_VERSION VERSION_LESS "0.64.0")
+-    add_definitions("-DHAVE_POPPLER_PRE_0_64")
+-endif()
+-
+-if(Poppler_VERSION VERSION_LESS "0.72.0")
+-    add_definitions("-DHAVE_POPPLER_PRE_0_72")
+-endif()
+-
+-if(Poppler_VERSION VERSION_LESS "0.82.0")
+-    add_definitions("-DHAVE_POPPLER_PRE_0_82")
+-endif()
+-
+-if(Poppler_VERSION VERSION_LESS "0.83.0")
+-    add_definitions("-DHAVE_POPPLER_PRE_0_83")
+-endif()
+-
+ set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp )
+ 
+ add_library(calligra_filter_pdf2svg MODULE ${pdf2svg_PART_SRCS})
+diff --git a/filters/karbon/pdf/Pdf2OdgImport.cpp b/filters/karbon/pdf/Pdf2OdgImport.cpp
+index f8a24c000b7..934e31dd5aa 100644
+--- a/filters/karbon/pdf/Pdf2OdgImport.cpp
++++ b/filters/karbon/pdf/Pdf2OdgImport.cpp
+@@ -65,33 +65,19 @@ KoFilter::ConversionStatus Pdf2OdgImport::convert(const QByteArray& from, const
+     Q_ASSERT(m_document->pages().isEmpty());
+ 
+     // read config file
+-#ifdef HAVE_POPPLER_PRE_0_83
+-    globalParams = new GlobalParams();
+-#else
+     globalParams = std::unique_ptr<GlobalParams>(new GlobalParams);
+-#endif
+     if (! globalParams)
+         return KoFilter::NotImplemented;
+ 
+     GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
+     PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
+     if (! pdfDoc) {
+-#ifdef HAVE_POPPLER_PRE_0_83
+-        delete globalParams;
+-        globalParams = nullptr;
+-#else
+         globalParams.reset();
+-#endif
+         return KoFilter::StupidError;
+     }
+ 
+     if (! pdfDoc->isOk()) {
+-#ifdef HAVE_POPPLER_PRE_0_83
+-        delete globalParams;
+-        globalParams = nullptr;
+-#else
+         globalParams.reset();
+-#endif
+         delete pdfDoc;
+         return KoFilter::StupidError;
+     }
+@@ -126,12 +112,7 @@ KoFilter::ConversionStatus Pdf2OdgImport::convert(const QByteArray& from, const
+         delete dev;
+     }
+     delete pdfDoc;
+-#ifdef HAVE_POPPLER_PRE_0_83
+-    delete globalParams;
+-    globalParams = nullptr;
+-#else
+     globalParams.reset();
+-#endif
+     return status;
+ }
+ 
+diff --git a/filters/karbon/pdf/PdfImport.cpp b/filters/karbon/pdf/PdfImport.cpp
+index 6309caefa8e..abbe681b4e8 100644
+--- a/filters/karbon/pdf/PdfImport.cpp
++++ b/filters/karbon/pdf/PdfImport.cpp
+@@ -26,9 +26,7 @@
+ #include <PDFDoc.h>
+ #include <GlobalParams.h>
+ 
+-#ifndef HAVE_POPPLER_PRE_0_83
+ #include <memory>
+-#endif
+ 
+ K_PLUGIN_FACTORY_WITH_JSON(PdfImportFactory, "calligra_filter_pdf2svg.json",
+                            registerPlugin<PdfImport>();)
+@@ -52,33 +50,19 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt
+     }
+ 
+     // read config file
+-#ifdef HAVE_POPPLER_PRE_0_83
+-    globalParams = new GlobalParams();
+-#else
+     globalParams = std::unique_ptr<GlobalParams>(new GlobalParams);
+-#endif
+     if (! globalParams)
+         return KoFilter::NotImplemented;
+ 
+     GooString * fname = new GooString(QFile::encodeName(m_chain->inputFile()).data());
+     PDFDoc * pdfDoc = new PDFDoc(fname, 0, 0, 0);
+     if (! pdfDoc) {
+-#ifdef HAVE_POPPLER_PRE_0_83
+-        delete globalParams;
+-        globalParams = nullptr;
+-#else
+         globalParams.reset();
+-#endif
+         return KoFilter::StupidError;
+     }
+ 
+     if (! pdfDoc->isOk()) {
+-#ifdef HAVE_POPPLER_PRE_0_83
+-        delete globalParams;
+-        globalParams = nullptr;
+-#else
+         globalParams.reset();
+-#endif
+         delete pdfDoc;
+         return KoFilter::StupidError;
+     }
+@@ -105,12 +89,7 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt
+ 
+     delete dev;
+     delete pdfDoc;
+-#ifdef HAVE_POPPLER_PRE_0_83
+-    delete globalParams;
+-    globalParams = nullptr;
+-#else
+     globalParams.reset();
+-#endif
+ 
+     return KoFilter::OK;
+ }
+diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp
+index 6c9dddfc661..0e6e5a934ca 100644
+--- a/filters/karbon/pdf/SvgOutputDev.cpp
++++ b/filters/karbon/pdf/SvgOutputDev.cpp
+@@ -160,11 +160,7 @@ void SvgOutputDev::eoFill(GfxState *state)
+     *d->body << "/>" << endl;
+ }
+ 
+-#ifdef HAVE_POPPLER_PRE_0_83
+-QString SvgOutputDev::convertPath(GfxPath *path)
+-#else
+ QString SvgOutputDev::convertPath(const GfxPath *path)
+-#endif
+ {
+     if (! path)
+         return QString();
+@@ -172,11 +168,7 @@ QString SvgOutputDev::convertPath(const GfxPath *path)
+     QString output;
+ 
+     for (int i = 0; i < path->getNumSubpaths(); ++i) {
+-#ifdef HAVE_POPPLER_PRE_0_83
+-        GfxSubpath * subpath = path->getSubpath(i);
+-#else
+         const GfxSubpath * subpath = path->getSubpath(i);
+-#endif
+         if (subpath->getNumPoints() > 0) {
+             output += QString("M%1 %2").arg(subpath->getX(0)).arg(subpath->getY(0));
+             int j = 1;
+@@ -383,11 +375,7 @@ QString SvgOutputDev::printStroke()
+     return stroke;
+ }
+ 
+-#ifdef HAVE_POPPLER_PRE_0_64
+-void SvgOutputDev::drawString(GfxState * state, GooString * s)
+-#else
+ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
+-#endif
+ {
+     int render = state->getRender();
+     // check for invisible text -- this is used by Acrobat Capture
+@@ -402,22 +390,10 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
+ 
+     QString str;
+ 
+-#ifdef HAVE_POPPLER_PRE_0_64
+-    char * p = s->getCString();
+-#else
+-    #ifdef HAVE_POPPLER_PRE_0_72
+-        const char * p = s->getCString();
+-    #else
+-        const char * p = s->c_str();
+-    #endif
+-#endif
++    const char * p = s->c_str();
+     int len = s->getLength();
+     CharCode code;
+-#ifdef HAVE_POPPLER_PRE_0_82
+-    Unicode *u = nullptr;
+-#else
+     const Unicode *u = nullptr;
+-#endif
+     int uLen;
+     double dx, dy, originX, originY;
+     while (len > 0) {
+@@ -463,18 +439,10 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
+     *d->body << " y=\"" << y << "px\"";
+ 
+     if (font && font->getFamily()) {
+-#ifdef HAVE_POPPLER_PRE_0_72
+-        *d->body << " font-family=\"" << QString::fromLatin1(font->getFamily()->getCString()) << "\"";
+-#else
+         *d->body << " font-family=\"" << QString::fromLatin1(font->getFamily()->c_str()) << "\"";
+-#endif
+         //debugPdf << "font family:" << QString::fromLatin1( font->getFamily()->getCString() );
+     } else if (font && font->getName()) {
+-#ifdef HAVE_POPPLER_PRE_0_72
+-        *d->body << " font-family=\"" << QString::fromLatin1(font->getName()->getCString()) << "\"";
+-#else
+         *d->body << " font-family=\"" << QString::fromLatin1(font->getName()->c_str()) << "\"";
+-#endif
+         //debugPdf << "font name:" << QString::fromLatin1( font->getName()->getCString() );
+     }
+     *d->body << " font-size=\"" << qMax(state->getFontSize(), state->getTransformedFontSize()) << "px\"";
+@@ -494,15 +462,9 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
+     *d->body << "</text>" << endl;
+ }
+ 
+-#ifdef HAVE_POPPLER_PRE_0_82
+-void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
+-                             int width, int height, GfxImageColorMap *colorMap,
+-                             bool interpolate, int *maskColors, bool inlineImg)
+-#else
+ void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
+                              int width, int height, GfxImageColorMap *colorMap,
+                              bool interpolate, const int *maskColors, bool inlineImg)
+-#endif
+ {
+     Q_UNUSED(ref)
+     Q_UNUSED(interpolate)
+diff --git a/filters/karbon/pdf/SvgOutputDev.h b/filters/karbon/pdf/SvgOutputDev.h
+index 96cdb594309..9eeb105c81b 100644
+--- a/filters/karbon/pdf/SvgOutputDev.h
++++ b/filters/karbon/pdf/SvgOutputDev.h
+@@ -40,22 +40,12 @@ public:
+     void eoFill(GfxState *state) override;
+ 
+     // text
+-#ifdef HAVE_POPPLER_PRE_0_64
+-    void drawString(GfxState * state, GooString * s) override;
+-#else
+     void drawString(GfxState * state, const GooString * s) override;
+-#endif
+ 
+     // images
+-#ifdef HAVE_POPPLER_PRE_0_82
+-    void drawImage(GfxState *state, Object *ref, Stream *str,
+-                           int width, int height, GfxImageColorMap *colorMap,
+-                           bool interpolate, int *maskColors, bool inlineImg) override;
+-#else
+     void drawImage(GfxState *state, Object *ref, Stream *str,
+                            int width, int height, GfxImageColorMap *colorMap,
+                            bool interpolate, const int *maskColors, bool inlineImg) override;
+-#endif
+     // styles
+     void updateAll(GfxState *state) override;
+     void updateFillColor(GfxState *state) override;
+@@ -70,11 +60,7 @@ public:
+     /// Dumps content to svg file
+     void dumpContent();
+ private:
+-#ifdef HAVE_POPPLER_PRE_0_83
+-    QString convertPath(GfxPath *path);
+-#else
+     QString convertPath(const GfxPath *path);
+-#endif
+     QString convertMatrix(const QMatrix &matrix);
+     QString convertMatrix(const double * matrix);
+     QString printFill();
+-- 
+2.35.1
+
diff --git a/debian/patches/upstream_SvgOutputDev-Fix-ifdef-version-for-getFont-API-chang.patch b/debian/patches/upstream_SvgOutputDev-Fix-ifdef-version-for-getFont-API-chang.patch
new file mode 100644
index 0000000..44a2e7e
--- /dev/null
+++ b/debian/patches/upstream_SvgOutputDev-Fix-ifdef-version-for-getFont-API-chang.patch
@@ -0,0 +1,25 @@
+From 59eb4d2235b88408accf452421526b6f281cbab0 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid at kde.org>
+Date: Wed, 13 Apr 2022 21:30:14 +0200
+Subject: [PATCH] SvgOutputDev: Fix ifdef version for getFont API change
+
+---
+ filters/karbon/pdf/SvgOutputDev.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/filters/karbon/pdf/SvgOutputDev.cpp b/filters/karbon/pdf/SvgOutputDev.cpp
+index 7caec15175a..af07c379900 100644
+--- a/filters/karbon/pdf/SvgOutputDev.cpp
++++ b/filters/karbon/pdf/SvgOutputDev.cpp
+@@ -390,7 +390,7 @@ void SvgOutputDev::drawString(GfxState * state, const GooString * s)
+     if (s->getLength() == 0)
+         return;
+ 
+-#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 03, 0)
++#if POPPLER_VERSION_MACRO < QT_VERSION_CHECK(22, 04, 0)
+     GfxFont * font = state->getFont();
+ #else
+     std::shared_ptr<GfxFont> font = state->getFont();
+-- 
+2.35.1
+



More information about the Neon-commits mailing list