inkscape: upgrade 1.1.2 -> 1.2.1 & fix build with poppler 22.09
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
SUMMARY = "Inkscape is a Free and open source vector graphics editor"
|
||||
HOMEPAGE = "https://inkscape.org/"
|
||||
LICENSE = "GPL-3.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=d20d608cfa3a8343d722c2e69a43bbcd"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=46f815712c095f667139ef42f2270d57"
|
||||
|
||||
PV = "1.1.2"
|
||||
PV = "1.2.1"
|
||||
SRC_URI = " \
|
||||
https://inkscape.org/gallery/item/31668/${BP}.tar.xz \
|
||||
file://0001-Fix-build-with-poppler-22.03.patch \
|
||||
file://0002-Fix-build-with-poppler-22.04.patch \
|
||||
https://inkscape.org/gallery/item/34673/${BP}.tar.xz \
|
||||
file://0001-Fix-build-with-poppler-22.09.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "3ffe54a06d0b25a4cd8b6eb424536ef1ed205be13443a39cd437c8c7b89b96d1"
|
||||
S = "${WORKDIR}/${BPN}-${PV}_2022-02-04_0a00cf5339"
|
||||
SRC_URI[sha256sum] = "46ce7da0eba7ca4badc1db70e9cbb67e0adf9bb342687dc6e08b5ca21b8d4c1b"
|
||||
S = "${WORKDIR}/${BPN}-${PV}_2022-07-14_9c6d41e410"
|
||||
|
||||
DEPENDS = " \
|
||||
glib-2.0-native \
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From a87fba8eaa4c53fa5f2a00d751c93bbffde21ec1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
|
||||
Date: Fri, 11 Mar 2022 23:15:08 +0100
|
||||
Subject: [PATCH] Fix build with poppler >= 22.03
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
|
||||
---
|
||||
src/extension/internal/pdfinput/pdf-input.cpp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
|
||||
index e6204f6..2cba594 100644
|
||||
--- a/src/extension/internal/pdfinput/pdf-input.cpp
|
||||
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
|
||||
@@ -668,8 +668,12 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
|
||||
|
||||
// poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from
|
||||
// glib gstdio.c
|
||||
+#if POPPLER_CHECK_VERSION(22,03,0)
|
||||
+ pdf_doc = std::make_shared<PDFDoc>(std::make_unique<GooString>(uri)); // TODO: Could ask for password
|
||||
+#else
|
||||
GooString *filename_goo = new GooString(uri);
|
||||
pdf_doc = std::make_shared<PDFDoc>(filename_goo, nullptr, nullptr, nullptr); // TODO: Could ask for password
|
||||
+#endif
|
||||
|
||||
if (!pdf_doc->isOk()) {
|
||||
int error = pdf_doc->getErrorCode();
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
From ceb354d22bf25e4b48d00817cc993926358f258b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
|
||||
Date: Sat, 15 Oct 2022 21:38:30 +0200
|
||||
Subject: [PATCH] Fix build with poppler 22.09
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Upstream-Statu: Pending
|
||||
|
||||
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
|
||||
---
|
||||
src/extension/internal/pdfinput/pdf-parser.cpp | 12 ++++++++++++
|
||||
src/extension/internal/pdfinput/svg-builder.cpp | 10 ++++++++++
|
||||
2 files changed, 22 insertions(+)
|
||||
|
||||
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
|
||||
index d6e2ede..b1ae5bb 100644
|
||||
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
|
||||
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
|
||||
@@ -685,6 +685,17 @@ void PdfParser::opConcat(Object args[], int /*numArgs*/)
|
||||
// TODO not good that numArgs is ignored but args[] is used:
|
||||
void PdfParser::opSetDash(Object args[], int /*numArgs*/)
|
||||
{
|
||||
+#if POPPLER_CHECK_VERSION(22,9,0)
|
||||
+ Array *a = args[0].getArray();
|
||||
+ int length = a->getLength();
|
||||
+ std::vector<double> dash(length);
|
||||
+ for (int i = 0; i < length; ++i) {
|
||||
+ Object obj;
|
||||
+ dash[i] = _POPPLER_CALL_ARGS_DEREF(obj, a->get, i).getNum();
|
||||
+ _POPPLER_FREE(obj);
|
||||
+ }
|
||||
+ state->setLineDash(std::move(dash), args[1].getNum());
|
||||
+#else
|
||||
double *dash = nullptr;
|
||||
|
||||
Array *a = args[0].getArray();
|
||||
@@ -698,6 +709,7 @@ void PdfParser::opSetDash(Object args[], int /*numArgs*/)
|
||||
}
|
||||
}
|
||||
state->setLineDash(dash, length, args[1].getNum());
|
||||
+#endif
|
||||
builder->updateStyle(state);
|
||||
}
|
||||
|
||||
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
|
||||
index 901cc8c..ef660eb 100644
|
||||
--- a/src/extension/internal/pdfinput/svg-builder.cpp
|
||||
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
|
||||
@@ -388,6 +388,15 @@ void SvgBuilder::_setStrokeStyle(SPCSSAttr *css, GfxState *state) {
|
||||
sp_repr_css_set_property(css, "stroke-miterlimit", os_ml.str().c_str());
|
||||
|
||||
// Line dash
|
||||
+#if POPPLER_CHECK_VERSION(22,9,0)
|
||||
+ double dash_start;
|
||||
+ const auto& dash_pattern = state->getLineDash(&dash_start);
|
||||
+ int dash_length = dash_pattern.size();
|
||||
+ if ( dash_length > 0 ) {
|
||||
+ Inkscape::CSSOStringStream os_array;
|
||||
+ for ( int i = 0 ; i < dash_pattern.size() ; i++ ) {
|
||||
+ os_array << dash_pattern[i];
|
||||
+#else
|
||||
double *dash_pattern;
|
||||
int dash_length;
|
||||
double dash_start;
|
||||
@@ -396,6 +405,7 @@ void SvgBuilder::_setStrokeStyle(SPCSSAttr *css, GfxState *state) {
|
||||
Inkscape::CSSOStringStream os_array;
|
||||
for ( int i = 0 ; i < dash_length ; i++ ) {
|
||||
os_array << dash_pattern[i];
|
||||
+#endif
|
||||
if (i < (dash_length - 1)) {
|
||||
os_array << ",";
|
||||
}
|
||||
--
|
||||
2.35.3
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
From d989cdf1059c78bc3bb6414330242073768d640b Mon Sep 17 00:00:00 2001
|
||||
From: Rafael Siejakowski <rs@rs-math.net>
|
||||
Date: Mon, 4 Apr 2022 22:09:39 -0300
|
||||
Subject: [PATCH] Compatibility with Poppler 22.04
|
||||
|
||||
Replace vanilla pointers with std::shared_ptr for pointers to fonts;
|
||||
eliminate manual ref-counting.
|
||||
|
||||
Fixes https://gitlab.com/inkscape/inkscape/-/issues/3387
|
||||
|
||||
Upstream-Status: Backport[https://gitlab.com/inkscape/inkscape/-/commit/d989cdf1059c78bc3bb6414330242073768d640b]
|
||||
---
|
||||
src/extension/internal/pdfinput/pdf-parser.cpp | 14 ++++++++------
|
||||
.../internal/pdfinput/poppler-transition-api.h | 6 ++++++
|
||||
src/extension/internal/pdfinput/svg-builder.cpp | 7 +------
|
||||
src/extension/internal/pdfinput/svg-builder.h | 1 -
|
||||
4 files changed, 15 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
|
||||
index feecefa043..d6e2ede4f3 100644
|
||||
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
|
||||
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "Gfx.h"
|
||||
#include "pdf-parser.h"
|
||||
#include "util/units.h"
|
||||
+#include "poppler-transition-api.h"
|
||||
|
||||
#include "glib/poppler-features.h"
|
||||
#include "goo/gmem.h"
|
||||
@@ -2158,7 +2159,7 @@ void PdfParser::opSetCharSpacing(Object args[], int /*numArgs*/)
|
||||
// TODO not good that numArgs is ignored but args[] is used:
|
||||
void PdfParser::opSetFont(Object args[], int /*numArgs*/)
|
||||
{
|
||||
- GfxFont *font = res->lookupFont(args[0].getName());
|
||||
+ auto font = res->lookupFont(args[0].getName());
|
||||
|
||||
if (!font) {
|
||||
// unsetting the font (drawing no text) is better than using the
|
||||
@@ -2179,7 +2180,9 @@ void PdfParser::opSetFont(Object args[], int /*numArgs*/)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
+#if !POPPLER_CHECK_VERSION(22, 4, 0)
|
||||
font->incRefCnt();
|
||||
+#endif
|
||||
state->setFont(font, args[1].getNum());
|
||||
fontChanged = gTrue;
|
||||
}
|
||||
@@ -2373,7 +2376,6 @@ void PdfParser::doShowText(const GooString *s) {
|
||||
#else
|
||||
void PdfParser::doShowText(GooString *s) {
|
||||
#endif
|
||||
- GfxFont *font;
|
||||
int wMode;
|
||||
double riseX, riseY;
|
||||
CharCode code;
|
||||
@@ -2392,7 +2394,7 @@ void PdfParser::doShowText(GooString *s) {
|
||||
#endif
|
||||
int len, n, uLen;
|
||||
|
||||
- font = state->getFont();
|
||||
+ auto font = state->getFont();
|
||||
wMode = font->getWMode();
|
||||
|
||||
builder->beginString(state);
|
||||
@@ -2445,10 +2447,10 @@ void PdfParser::doShowText(GooString *s) {
|
||||
//out->updateCTM(state, 1, 0, 0, 1, 0, 0);
|
||||
if (false){ /*!out->beginType3Char(state, curX + riseX, curY + riseY, tdx, tdy,
|
||||
code, u, uLen)) {*/
|
||||
- _POPPLER_CALL_ARGS(charProc, ((Gfx8BitFont *)font)->getCharProc, code);
|
||||
- if ((resDict = ((Gfx8BitFont *)font)->getResources())) {
|
||||
+ _POPPLER_CALL_ARGS(charProc, _POPPLER_FONTPTR_TO_GFX8(font)->getCharProc, code);
|
||||
+ if (resDict = _POPPLER_FONTPTR_TO_GFX8(font)->getResources()) {
|
||||
pushResources(resDict);
|
||||
- }
|
||||
+ }
|
||||
if (charProc.isStream()) {
|
||||
//parse(&charProc, gFalse); // TODO: parse into SVG font
|
||||
} else {
|
||||
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
|
||||
index 87a19d4..17e173a 100644
|
||||
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
|
||||
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
|
||||
@@ -14,6 +14,12 @@
|
||||
|
||||
#include <glib/poppler-features.h>
|
||||
|
||||
+#if POPPLER_CHECK_VERSION(22, 4, 0)
|
||||
+#define _POPPLER_FONTPTR_TO_GFX8(font_ptr) ((Gfx8BitFont *)font_ptr.get())
|
||||
+#else
|
||||
+#define _POPPLER_FONTPTR_TO_GFX8(font_ptr) ((Gfx8BitFont *)font_ptr)
|
||||
+#endif
|
||||
+
|
||||
#if POPPLER_CHECK_VERSION(0, 83, 0)
|
||||
#define _POPPLER_CONST_83 const
|
||||
#else
|
||||
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
|
||||
index eede668893..901cc8cddb 100644
|
||||
--- a/src/extension/internal/pdfinput/svg-builder.cpp
|
||||
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
|
||||
@@ -108,7 +108,6 @@ SvgBuilder::~SvgBuilder() = default;
|
||||
|
||||
void SvgBuilder::_init() {
|
||||
_font_style = nullptr;
|
||||
- _current_font = nullptr;
|
||||
_font_specification = nullptr;
|
||||
_font_scaling = 1;
|
||||
_need_font_update = true;
|
||||
@@ -1064,11 +1063,8 @@ void SvgBuilder::updateFont(GfxState *state) {
|
||||
_need_font_update = false;
|
||||
updateTextMatrix(state); // Ensure that we have a text matrix built
|
||||
|
||||
- if (_font_style) {
|
||||
- //sp_repr_css_attr_unref(_font_style);
|
||||
- }
|
||||
_font_style = sp_repr_css_attr_new();
|
||||
- GfxFont *font = state->getFont();
|
||||
+ auto font = state->getFont();
|
||||
// Store original name
|
||||
if (font->getName()) {
|
||||
_font_specification = font->getName()->getCString();
|
||||
@@ -1213,7 +1209,6 @@ void SvgBuilder::updateFont(GfxState *state) {
|
||||
sp_repr_css_set_property(_font_style, "writing-mode", "tb");
|
||||
}
|
||||
|
||||
- _current_font = font;
|
||||
_invalidated_style = true;
|
||||
}
|
||||
|
||||
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h
|
||||
index fb4e64fa19..e91febd717 100644
|
||||
--- a/src/extension/internal/pdfinput/svg-builder.h
|
||||
+++ b/src/extension/internal/pdfinput/svg-builder.h
|
||||
@@ -204,7 +204,6 @@ private:
|
||||
std::vector<SvgGraphicsState> _state_stack;
|
||||
|
||||
SPCSSAttr *_font_style; // Current font style
|
||||
- GfxFont *_current_font;
|
||||
const char *_font_specification;
|
||||
double _font_scaling;
|
||||
bool _need_font_update;
|
||||
--
|
||||
GitLab
|
||||
|
||||
Reference in New Issue
Block a user