inkscape: rebuild for poppler-26.07.0

This commit is contained in:
Đoàn Trần Công Danh
2026-07-24 22:28:57 +07:00
parent 70ee8fa301
commit 8830d2fc9e
8 changed files with 804 additions and 375 deletions
@@ -12,11 +12,9 @@ Fixes https://gitlab.com/inkscape/inkscape/-/work_items/6126
src/extension/extension.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index 47f3eca72f..b6ce3778e2 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -468,7 +468,7 @@ void Extension::lookup_translation_catalog() {
@@ -468,7 +468,7 @@ void Extension::lookup_translation_catal
// register catalog with gettext if found, disable translation for this extension otherwise
if (!_gettext_catalog_dir.empty()) {
char const *current_dir = bindtextdomain(_translationdomain, nullptr);
@@ -25,6 +23,3 @@ index 47f3eca72f..b6ce3778e2 100644
g_info("Binding textdomain '%s' to '%s'.", _translationdomain, _gettext_catalog_dir.c_str());
bindtextdomain(_translationdomain, _gettext_catalog_dir.c_str());
bind_textdomain_codeset(_translationdomain, "UTF-8");
--
GitLab
@@ -0,0 +1,104 @@
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 7b5e0ecb1db7aaa062fe0c9c2b0ee5476ada1329..45df931f00ea462c70ec78e1236ed4c383172eab 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -33,6 +33,7 @@
#include <poppler/glib/poppler.h>
#include <poppler/glib/poppler-document.h>
#include <poppler/glib/poppler-page.h>
+#include <poppler/goo/gmem.h>
#endif
#include <gdkmm/general.h>
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 6c78247dfbd21e3680dcac1396cfdda470d7995e..8b2e6f3d54341273eac5630ad95bc927d3519b7b 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -32,6 +32,7 @@
#include <poppler/GfxState.h>
#include <poppler/Page.h>
#include <poppler/Stream.h>
+#include <poppler/goo/gmem.h>
#include "color.h"
#include "color/cms-util.h"
@@ -2093,7 +2094,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
} else {
image_stream = new ImageStream(str, width, 1, 1);
}
+#if POPPLER_CHECK_VERSION(26, 0, 0)
+ image_stream->rewind();
+#else
image_stream->reset();
+#endif
// Convert grayscale values
unsigned char *buffer = new unsigned char[width];
@@ -2119,7 +2124,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
image_stream = new ImageStream(str, width,
color_map->getNumPixelComps(),
color_map->getBits());
+#if POPPLER_CHECK_VERSION(26, 0, 0)
+ image_stream->rewind();
+#else
image_stream->reset();
+#endif
// Convert RGB values
unsigned int *buffer = new unsigned int[width];
From 7e74f51fc097d725dde29fadff5440cc69658172 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Faist?= <faist@rexcontrols.cz>
Date: Mon, 2 Feb 2026 17:39:08 +0100
Subject: [PATCH] Fix warning with poppler 26.x.x
---
.../internal/pdfinput/svg-builder.cpp | 24 +++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 8b2e6f3d54..94d4342dc4 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -2095,7 +2095,17 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
image_stream = new ImageStream(str, width, 1, 1);
}
#if POPPLER_CHECK_VERSION(26, 0, 0)
- image_stream->rewind();
+ if(!image_stream->rewind())
+ {
+ g_warning("ImageStream: Failed to rewind image stream");
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+ if (!_embed_images) {
+ fclose(fp);
+ g_free(file_name);
+ }
+ delete image_stream;
+ return nullptr;
+ }
#else
image_stream->reset();
#endif
@@ -2125,7 +2135,17 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
color_map->getNumPixelComps(),
color_map->getBits());
#if POPPLER_CHECK_VERSION(26, 0, 0)
- image_stream->rewind();
+ if(!image_stream->rewind())
+ {
+ g_warning("ImageStream: Failed to rewind image stream");
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+ if (!_embed_images) {
+ fclose(fp);
+ g_free(file_name);
+ }
+ delete image_stream;
+ return nullptr;
+ }
#else
image_stream->reset();
#endif
--
GitLab
@@ -0,0 +1,205 @@
From cbea002d86f70ddbb525ac7633dfceedb73ff652 Mon Sep 17 00:00:00 2001
From: KrIr17 <elendil.krir17@gmail.com>
Date: Thu, 12 Feb 2026 20:58:50 +0100
Subject: [PATCH] Fix building with Poppler 0.26.02
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Adapted from [1] with changes to make it backwards-compatible with older
versions of Poppler.
[1] github.com/OpenMandrivaAssociation/inkscape/blob/master/inkscape-poppler-26.02.patch#L29
Credits: Bernhard Rosenkränzer <bero@lindev.ch>
Fixes https://gitlab.com/inkscape/inkscape/-/issues/6054
---
.../internal/pdfinput/pdf-parser.cpp | 36 ++++++++++++++++---
.../pdfinput/poppler-transition-api.h | 10 ++++++
.../internal/pdfinput/svg-builder.cpp | 10 +++---
3 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index ba6c448513..c44bef277f 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -653,7 +653,11 @@ void PdfParser::opSetFlat(Object args[], int /*numArgs*/)
void PdfParser::opSetLineJoin(Object args[], int /*numArgs*/)
{
builder->beforeStateChange(state);
+#if POPPLER_CHECK_VERSION(26,2,0)
+ state->setLineJoin((GfxState::LineJoinStyle) args[0].getInt());
+#else
state->setLineJoin(args[0].getInt());
+#endif
builder->updateStyle(state);
}
@@ -661,7 +665,11 @@ void PdfParser::opSetLineJoin(Object args[], int /*numArgs*/)
void PdfParser::opSetLineCap(Object args[], int /*numArgs*/)
{
builder->beforeStateChange(state);
+#if POPPLER_CHECK_VERSION(26,2,0)
+ state->setLineCap((GfxState::LineCapStyle) args[0].getInt());
+#else
state->setLineCap(args[0].getInt());
+#endif
builder->updateStyle(state);
}
@@ -1565,7 +1573,13 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat,
// restore graphics state
restoreState();
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ state->clearPath();
+ GfxPath *currPath = const_cast<GfxPath*>(state->getPath());
+ currPath->append(savedPath);
+#else
state->setPath(savedPath);
+#endif
}
// TODO not good that numArgs is ignored but args[] is used:
@@ -1626,7 +1640,13 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/)
// restore graphics state
if (savedState) {
restoreState();
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ state->clearPath();
+ GfxPath *currPath = const_cast<GfxPath*>(state->getPath());
+ currPath->append(savedPath);
+#else
state->setPath(savedPath);
+#endif
}
}
@@ -2213,7 +2233,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/)
{
Array *a = nullptr;
Object obj;
- int wMode = 0; // Writing mode (horizontal/vertical).
+ _POPPLER_WMODE wMode = _POPPLER_WMODE_HORIZONTAL; // Writing mode (horizontal/vertical).
if (!state->getFont()) {
error(errSyntaxError, getPos(), "No font in show/space");
@@ -2227,7 +2247,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/)
if (obj.isNum()) {
// this uses the absolute value of the font size to match
// Acrobat's behavior
- if (wMode) {
+ if (wMode != _POPPLER_WMODE_HORIZONTAL) {
state->textShift(0, -obj.getNum() * 0.001 *
fabs(state->getFontSize()));
} else {
@@ -2254,7 +2274,7 @@ void PdfParser::doShowText(const GooString *s) {
void PdfParser::doShowText(GooString *s) {
#endif
auto font = state->getFont();
- int wMode = font->getWMode(); // Vertical/Horizontal/Invalid
+ _POPPLER_WMODE wMode = font->getWMode(); // Vertical/Horizontal/Invalid
builder->beginString(state, get_goostring_length(*s));
@@ -2289,7 +2309,7 @@ void PdfParser::doShowText(GooString *s) {
auto ax = dx;
auto ay = dy;
- if (wMode != 0) {
+ if (wMode != _POPPLER_WMODE_HORIZONTAL) {
// Vertical text (or invalid value).
dy += state->getCharSpace();
if (n == 1 && *p == ' ') {
@@ -2964,7 +2984,11 @@ Stream *PdfParser::buildImageStream() {
// make stream
#if defined(POPPLER_NEW_OBJECT_API)
str = new EmbedStream(parser->getStream(), dict.copy(), gFalse, 0);
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ str = str->addFilters(std::unique_ptr<Stream>(str), dict.getDict()).release();
+#else
str = str->addFilters(dict.getDict());
+#endif
#else
str = new EmbedStream(parser->getStream(), &dict, gFalse, 0);
str = str->addFilters(&dict);
@@ -3138,7 +3162,11 @@ void PdfParser::loadOptionalContentLayers(Dict *resources)
// Normally we'd use poppler optContentIsVisible, but these dict
// objects don't retain their references so can't be used directly.
for (auto &[ref, ocg] : ocgs->getOCGs()) {
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ if (ocg->getName()->toStr() == label)
+#else
if (ocg->getName()->cmp(label) == 0)
+#endif
visible = ocg->getState() == OptionalContentGroup::On;
}
builder->addOptionalGroup(dict->getKey(j), label, visible);
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index 866b630bb6..65788128b7 100644
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -15,6 +15,16 @@
#include <glib/poppler-features.h>
#include <poppler/UTF.h>
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+#define _POPPLER_WMODE GfxFont::WritingMode
+#define _POPPLER_WMODE_HORIZONTAL GfxFont::WritingMode::Horizontal
+#define _POPPLER_WMODE_VERTICAL GfxFont::WritingMode::Vertical
+#else
+#define _POPPLER_WMODE int
+#define _POPPLER_WMODE_HORIZONTAL 0
+#define _POPPLER_WMODE_VERTICAL 1
+#endif
+
#if POPPLER_CHECK_VERSION(25, 7, 0)
#define _POPPLER_TEXT_SHIFT_WITH_USER_COORDS(dx, dy) textShiftWithUserCoords(dx, dy)
#define _POPPLER_FOFI_TRUETYPE_MAKE(font_data, faceIndex) FoFiTrueType::make(std::span(font_data), faceIndex)
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 94d4342dc4..d854ed8a2e 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -1386,7 +1386,7 @@ void SvgBuilder::updateFont(GfxState *state, std::shared_ptr<CairoFont> cairo_fo
sp_repr_css_set_property(_css_font, "font-variant", "normal");
// Writing mode
- if ( font->getWMode() == 0 ) {
+ if ( font->getWMode() == _POPPLER_WMODE_HORIZONTAL ) {
sp_repr_css_set_property(_css_font, "writing-mode", "lr");
} else {
sp_repr_css_set_property(_css_font, "writing-mode", "tb");
@@ -1398,7 +1398,7 @@ void SvgBuilder::updateFont(GfxState *state, std::shared_ptr<CairoFont> cairo_fo
*/
void SvgBuilder::updateTextShift(GfxState *state, double shift) {
double shift_value = -shift * 0.001 * fabs(state->getFontSize());
- if (state->getFont()->getWMode()) {
+ if (state->getFont()->getWMode() != _POPPLER_WMODE_HORIZONTAL) {
_text_position[1] += shift_value;
} else {
_text_position[0] += shift_value;
@@ -1452,7 +1452,7 @@ Inkscape::XML::Node* SvgBuilder::_flushTextText(GfxState *state, double text_sca
// Text direction is a property of the <text> element.
auto font = state->getFont();
- if (font->getWMode() == 1) {
+ if (font->getWMode() == _POPPLER_WMODE_VERTICAL) {
// Only set if vertical.
auto css_text = sp_repr_css_attr_new();
sp_repr_css_set_property(css_text, "writing-mode", "tb");
@@ -1546,8 +1546,8 @@ Inkscape::XML::Node* SvgBuilder::_flushTextText(GfxState *state, double text_sca
bool output_tspan =
next_it == _glyphs.end() ||
next_it->style_changed ||
- (writing_mode == 0 && std::abs(glyph.text_position[1] - next_it->text_position[1]) > 0.1) ||
- (writing_mode == 1 && std::abs(glyph.text_position[0] - next_it->text_position[0]) > 0.1);
+ (writing_mode == _POPPLER_WMODE_HORIZONTAL && std::abs(glyph.text_position[1] - next_it->text_position[1]) > 0.1) ||
+ (writing_mode == _POPPLER_WMODE_VERTICAL && std::abs(glyph.text_position[0] - next_it->text_position[0]) > 0.1);
if (output_tspan) {
--
GitLab
@@ -0,0 +1,47 @@
From 244771b2dc3e565cb02ad3d46812d0c4add3b7c0 Mon Sep 17 00:00:00 2001
From: Matthias Kilian <kili@outback.escape.de>
Date: Wed, 11 Mar 2026 23:17:00 +0100
Subject: [PATCH] Fix build with poppler-26.03.0.
(cherry picked from commit 754a866b878623554ade26d53496eeb8687c4685)
---
src/extension/internal/pdfinput/pdf-parser.cpp | 4 ++++
src/extension/internal/pdfinput/poppler-utils.cpp | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index c44bef277f..9f9fcea40a 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -2951,7 +2951,11 @@ Stream *PdfParser::buildImageStream() {
// build dictionary
#if defined(POPPLER_NEW_OBJECT_API)
+#if POPPLER_CHECK_VERSION(26, 3, 0)
+ dict = Object(std::make_unique<Dict>(xref));
+#else
dict = Object(new Dict(xref));
+#endif
#else
dict.initDict(xref);
#endif
diff --git a/src/extension/internal/pdfinput/poppler-utils.cpp b/src/extension/internal/pdfinput/poppler-utils.cpp
index fac42152eb..b85963e65e 100644
--- a/src/extension/internal/pdfinput/poppler-utils.cpp
+++ b/src/extension/internal/pdfinput/poppler-utils.cpp
@@ -88,7 +88,11 @@ InkFontDict::InkFontDict(XRef *xref, Ref *fontDictRef, Dict *fontDict)
r.num = hashFontObject(&obj2);
}
// Newer poppler will require some reworking as it gives a shared ptr.
+#if POPPLER_CHECK_VERSION(26,3,0)
+ fonts[i] = GfxFont::makeFont(xref, fontDict->getKey(i), r, *obj2.getDict());
+#else
fonts[i] = GfxFont::makeFont(xref, fontDict->getKey(i), r, obj2.getDict());
+#endif
if (fonts[i] && !fonts[i]->isOk()) {
fonts[i] = nullptr;
}
--
GitLab
@@ -1,356 +1,3 @@
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 7b5e0ecb1db7aaa062fe0c9c2b0ee5476ada1329..45df931f00ea462c70ec78e1236ed4c383172eab 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -33,6 +33,7 @@
#include <poppler/glib/poppler.h>
#include <poppler/glib/poppler-document.h>
#include <poppler/glib/poppler-page.h>
+#include <poppler/goo/gmem.h>
#endif
#include <gdkmm/general.h>
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 6c78247dfbd21e3680dcac1396cfdda470d7995e..8b2e6f3d54341273eac5630ad95bc927d3519b7b 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -32,6 +32,7 @@
#include <poppler/GfxState.h>
#include <poppler/Page.h>
#include <poppler/Stream.h>
+#include <poppler/goo/gmem.h>
#include "color.h"
#include "color/cms-util.h"
@@ -2093,7 +2094,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
} else {
image_stream = new ImageStream(str, width, 1, 1);
}
+#if POPPLER_CHECK_VERSION(26, 0, 0)
+ image_stream->rewind();
+#else
image_stream->reset();
+#endif
// Convert grayscale values
unsigned char *buffer = new unsigned char[width];
@@ -2119,7 +2124,11 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
image_stream = new ImageStream(str, width,
color_map->getNumPixelComps(),
color_map->getBits());
+#if POPPLER_CHECK_VERSION(26, 0, 0)
+ image_stream->rewind();
+#else
image_stream->reset();
+#endif
// Convert RGB values
unsigned int *buffer = new unsigned int[width];
From 7e74f51fc097d725dde29fadff5440cc69658172 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Faist?= <faist@rexcontrols.cz>
Date: Mon, 2 Feb 2026 17:39:08 +0100
Subject: [PATCH] Fix warning with poppler 26.x.x
---
.../internal/pdfinput/svg-builder.cpp | 24 +++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 8b2e6f3d54..94d4342dc4 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -2095,7 +2095,17 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
image_stream = new ImageStream(str, width, 1, 1);
}
#if POPPLER_CHECK_VERSION(26, 0, 0)
- image_stream->rewind();
+ if(!image_stream->rewind())
+ {
+ g_warning("ImageStream: Failed to rewind image stream");
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+ if (!_embed_images) {
+ fclose(fp);
+ g_free(file_name);
+ }
+ delete image_stream;
+ return nullptr;
+ }
#else
image_stream->reset();
#endif
@@ -2125,7 +2135,17 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
color_map->getNumPixelComps(),
color_map->getBits());
#if POPPLER_CHECK_VERSION(26, 0, 0)
- image_stream->rewind();
+ if(!image_stream->rewind())
+ {
+ g_warning("ImageStream: Failed to rewind image stream");
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+ if (!_embed_images) {
+ fclose(fp);
+ g_free(file_name);
+ }
+ delete image_stream;
+ return nullptr;
+ }
#else
image_stream->reset();
#endif
--
GitLab
From cbea002d86f70ddbb525ac7633dfceedb73ff652 Mon Sep 17 00:00:00 2001
From: KrIr17 <elendil.krir17@gmail.com>
Date: Thu, 12 Feb 2026 20:58:50 +0100
Subject: [PATCH] Fix building with Poppler 0.26.02
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Adapted from [1] with changes to make it backwards-compatible with older
versions of Poppler.
[1] github.com/OpenMandrivaAssociation/inkscape/blob/master/inkscape-poppler-26.02.patch#L29
Credits: Bernhard Rosenkränzer <bero@lindev.ch>
Fixes https://gitlab.com/inkscape/inkscape/-/issues/6054
---
.../internal/pdfinput/pdf-parser.cpp | 36 ++++++++++++++++---
.../pdfinput/poppler-transition-api.h | 10 ++++++
.../internal/pdfinput/svg-builder.cpp | 10 +++---
3 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index ba6c448513..c44bef277f 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -653,7 +653,11 @@ void PdfParser::opSetFlat(Object args[], int /*numArgs*/)
void PdfParser::opSetLineJoin(Object args[], int /*numArgs*/)
{
builder->beforeStateChange(state);
+#if POPPLER_CHECK_VERSION(26,2,0)
+ state->setLineJoin((GfxState::LineJoinStyle) args[0].getInt());
+#else
state->setLineJoin(args[0].getInt());
+#endif
builder->updateStyle(state);
}
@@ -661,7 +665,11 @@ void PdfParser::opSetLineJoin(Object args[], int /*numArgs*/)
void PdfParser::opSetLineCap(Object args[], int /*numArgs*/)
{
builder->beforeStateChange(state);
+#if POPPLER_CHECK_VERSION(26,2,0)
+ state->setLineCap((GfxState::LineCapStyle) args[0].getInt());
+#else
state->setLineCap(args[0].getInt());
+#endif
builder->updateStyle(state);
}
@@ -1565,7 +1573,13 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat,
// restore graphics state
restoreState();
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ state->clearPath();
+ GfxPath *currPath = const_cast<GfxPath*>(state->getPath());
+ currPath->append(savedPath);
+#else
state->setPath(savedPath);
+#endif
}
// TODO not good that numArgs is ignored but args[] is used:
@@ -1626,7 +1640,13 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/)
// restore graphics state
if (savedState) {
restoreState();
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ state->clearPath();
+ GfxPath *currPath = const_cast<GfxPath*>(state->getPath());
+ currPath->append(savedPath);
+#else
state->setPath(savedPath);
+#endif
}
}
@@ -2213,7 +2233,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/)
{
Array *a = nullptr;
Object obj;
- int wMode = 0; // Writing mode (horizontal/vertical).
+ _POPPLER_WMODE wMode = _POPPLER_WMODE_HORIZONTAL; // Writing mode (horizontal/vertical).
if (!state->getFont()) {
error(errSyntaxError, getPos(), "No font in show/space");
@@ -2227,7 +2247,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/)
if (obj.isNum()) {
// this uses the absolute value of the font size to match
// Acrobat's behavior
- if (wMode) {
+ if (wMode != _POPPLER_WMODE_HORIZONTAL) {
state->textShift(0, -obj.getNum() * 0.001 *
fabs(state->getFontSize()));
} else {
@@ -2254,7 +2274,7 @@ void PdfParser::doShowText(const GooString *s) {
void PdfParser::doShowText(GooString *s) {
#endif
auto font = state->getFont();
- int wMode = font->getWMode(); // Vertical/Horizontal/Invalid
+ _POPPLER_WMODE wMode = font->getWMode(); // Vertical/Horizontal/Invalid
builder->beginString(state, get_goostring_length(*s));
@@ -2289,7 +2309,7 @@ void PdfParser::doShowText(GooString *s) {
auto ax = dx;
auto ay = dy;
- if (wMode != 0) {
+ if (wMode != _POPPLER_WMODE_HORIZONTAL) {
// Vertical text (or invalid value).
dy += state->getCharSpace();
if (n == 1 && *p == ' ') {
@@ -2964,7 +2984,11 @@ Stream *PdfParser::buildImageStream() {
// make stream
#if defined(POPPLER_NEW_OBJECT_API)
str = new EmbedStream(parser->getStream(), dict.copy(), gFalse, 0);
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ str = str->addFilters(std::unique_ptr<Stream>(str), dict.getDict()).release();
+#else
str = str->addFilters(dict.getDict());
+#endif
#else
str = new EmbedStream(parser->getStream(), &dict, gFalse, 0);
str = str->addFilters(&dict);
@@ -3138,7 +3162,11 @@ void PdfParser::loadOptionalContentLayers(Dict *resources)
// Normally we'd use poppler optContentIsVisible, but these dict
// objects don't retain their references so can't be used directly.
for (auto &[ref, ocg] : ocgs->getOCGs()) {
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+ if (ocg->getName()->toStr() == label)
+#else
if (ocg->getName()->cmp(label) == 0)
+#endif
visible = ocg->getState() == OptionalContentGroup::On;
}
builder->addOptionalGroup(dict->getKey(j), label, visible);
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index 866b630bb6..65788128b7 100644
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -15,6 +15,16 @@
#include <glib/poppler-features.h>
#include <poppler/UTF.h>
+#if POPPLER_CHECK_VERSION(26, 2, 0)
+#define _POPPLER_WMODE GfxFont::WritingMode
+#define _POPPLER_WMODE_HORIZONTAL GfxFont::WritingMode::Horizontal
+#define _POPPLER_WMODE_VERTICAL GfxFont::WritingMode::Vertical
+#else
+#define _POPPLER_WMODE int
+#define _POPPLER_WMODE_HORIZONTAL 0
+#define _POPPLER_WMODE_VERTICAL 1
+#endif
+
#if POPPLER_CHECK_VERSION(25, 7, 0)
#define _POPPLER_TEXT_SHIFT_WITH_USER_COORDS(dx, dy) textShiftWithUserCoords(dx, dy)
#define _POPPLER_FOFI_TRUETYPE_MAKE(font_data, faceIndex) FoFiTrueType::make(std::span(font_data), faceIndex)
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 94d4342dc4..d854ed8a2e 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -1386,7 +1386,7 @@ void SvgBuilder::updateFont(GfxState *state, std::shared_ptr<CairoFont> cairo_fo
sp_repr_css_set_property(_css_font, "font-variant", "normal");
// Writing mode
- if ( font->getWMode() == 0 ) {
+ if ( font->getWMode() == _POPPLER_WMODE_HORIZONTAL ) {
sp_repr_css_set_property(_css_font, "writing-mode", "lr");
} else {
sp_repr_css_set_property(_css_font, "writing-mode", "tb");
@@ -1398,7 +1398,7 @@ void SvgBuilder::updateFont(GfxState *state, std::shared_ptr<CairoFont> cairo_fo
*/
void SvgBuilder::updateTextShift(GfxState *state, double shift) {
double shift_value = -shift * 0.001 * fabs(state->getFontSize());
- if (state->getFont()->getWMode()) {
+ if (state->getFont()->getWMode() != _POPPLER_WMODE_HORIZONTAL) {
_text_position[1] += shift_value;
} else {
_text_position[0] += shift_value;
@@ -1452,7 +1452,7 @@ Inkscape::XML::Node* SvgBuilder::_flushTextText(GfxState *state, double text_sca
// Text direction is a property of the <text> element.
auto font = state->getFont();
- if (font->getWMode() == 1) {
+ if (font->getWMode() == _POPPLER_WMODE_VERTICAL) {
// Only set if vertical.
auto css_text = sp_repr_css_attr_new();
sp_repr_css_set_property(css_text, "writing-mode", "tb");
@@ -1546,8 +1546,8 @@ Inkscape::XML::Node* SvgBuilder::_flushTextText(GfxState *state, double text_sca
bool output_tspan =
next_it == _glyphs.end() ||
next_it->style_changed ||
- (writing_mode == 0 && std::abs(glyph.text_position[1] - next_it->text_position[1]) > 0.1) ||
- (writing_mode == 1 && std::abs(glyph.text_position[0] - next_it->text_position[0]) > 0.1);
+ (writing_mode == _POPPLER_WMODE_HORIZONTAL && std::abs(glyph.text_position[1] - next_it->text_position[1]) > 0.1) ||
+ (writing_mode == _POPPLER_WMODE_VERTICAL && std::abs(glyph.text_position[0] - next_it->text_position[0]) > 0.1);
if (output_tspan) {
--
GitLab
From 244771b2dc3e565cb02ad3d46812d0c4add3b7c0 Mon Sep 17 00:00:00 2001
From: Matthias Kilian <kili@outback.escape.de>
Date: Wed, 11 Mar 2026 23:17:00 +0100
Subject: [PATCH] Fix build with poppler-26.03.0.
(cherry picked from commit 754a866b878623554ade26d53496eeb8687c4685)
---
src/extension/internal/pdfinput/pdf-parser.cpp | 4 ++++
src/extension/internal/pdfinput/poppler-utils.cpp | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index c44bef277f..9f9fcea40a 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -2951,7 +2951,11 @@ Stream *PdfParser::buildImageStream() {
// build dictionary
#if defined(POPPLER_NEW_OBJECT_API)
+#if POPPLER_CHECK_VERSION(26, 3, 0)
+ dict = Object(std::make_unique<Dict>(xref));
+#else
dict = Object(new Dict(xref));
+#endif
#else
dict.initDict(xref);
#endif
diff --git a/src/extension/internal/pdfinput/poppler-utils.cpp b/src/extension/internal/pdfinput/poppler-utils.cpp
index fac42152eb..b85963e65e 100644
--- a/src/extension/internal/pdfinput/poppler-utils.cpp
+++ b/src/extension/internal/pdfinput/poppler-utils.cpp
@@ -88,7 +88,11 @@ InkFontDict::InkFontDict(XRef *xref, Ref *fontDictRef, Dict *fontDict)
r.num = hashFontObject(&obj2);
}
// Newer poppler will require some reworking as it gives a shared ptr.
+#if POPPLER_CHECK_VERSION(26,3,0)
+ fonts[i] = GfxFont::makeFont(xref, fontDict->getKey(i), r, *obj2.getDict());
+#else
fonts[i] = GfxFont::makeFont(xref, fontDict->getKey(i), r, obj2.getDict());
+#endif
if (fonts[i] && !fonts[i]->isOk()) {
fonts[i] = nullptr;
}
--
GitLab
From f7a93dd8e28a08bb039d929df8415a838ba5642e Mon Sep 17 00:00:00 2001
From: KrIr17 <elendil.krir17@gmail.com>
Date: Thu, 9 Apr 2026 12:45:19 +0200
+128 -15
View File
@@ -1,4 +1,50 @@
Heavily modified patch in https://gitlab.com/inkscape/inkscape/-/merge_requests/7968
From 1ad89c941bad5e42a3378cd8644a4c4cd3b6ea71 Mon Sep 17 00:00:00 2001
From: KrIr17 <elendil.krir17@gmail.com>
Date: Mon, 8 Jun 2026 20:16:32 +0200
Subject: [PATCH] Fix Building with Poppler 26.06.0
- pdfparser: Some `const PDFRectangle *` to `const PDFRectangle &` [1]
- pdfparser: Some `const GfxColor *` to `const GfxColor &` [2]
- pdf-utils: Add a `getRect(const PDFRectangle &)` alongside `getRect(const
PDFRectangle *)`
- poppler-cairo-font-engine: `getKey()` now returns std::string and not
char[], so change `strcmp` to `std::string(...).compare(...)` [3]
- poppler-utils: `obj->dictGetKey()` etc. were removed; use
`obj->dict()->getKey()` instead (these have also existed in poppler
since the beginning, so shouldn't break any old poppler) [4,5]
- svg-builder: `convertGfxColor` now takes `const GfxColor &` as input.
A convenience function taking `const GfxColor *` (for older poppler)
now calls the new one after confirming `color` is a valid pointer
- svg-builder: `_addStopToGradient` now takes `const GfxColor &` as
input. This was used only in `convertGfxColor` and therefore doesn't
need a helper function for compatibility
- testfiles pdf-utils-test: `<poppler/*.h>` to `<*.h>` (see e3eb1210)
- testfiles pdf-utils-test: Some `const PDFRectangle *`
to `const PDFRectangle &` [1]
Fixes https://gitlab.com/inkscape/inkscape/-/work_items/6210
Upstream Commits:
[1] https://gitlab.freedesktop.org/poppler/poppler/-/commit/d50a4510
[2] https://gitlab.freedesktop.org/poppler/poppler/-/commit/0f94f530
[3] https://gitlab.freedesktop.org/poppler/poppler/-/commit/a3de7f8a
[4] https://gitlab.freedesktop.org/poppler/poppler/-/commit/bb13b0f5
[5] https://gitlab.freedesktop.org/poppler/poppler/-/commit/8ae0f8e7
---
src/extension/internal/pdfinput/pdf-input.cpp | 14 +++++-
.../internal/pdfinput/pdf-parser.cpp | 45 ++++++++++---------
src/extension/internal/pdfinput/pdf-parser.h | 4 +-
src/extension/internal/pdfinput/pdf-utils.cpp | 7 ++-
src/extension/internal/pdfinput/pdf-utils.h | 1 +
.../pdfinput/poppler-cairo-font-engine.cpp | 2 +-
.../pdfinput/poppler-transition-api.h | 16 +++++++
.../internal/pdfinput/poppler-utils.cpp | 20 +++++----
.../internal/pdfinput/svg-builder.cpp | 36 +++++++++------
src/extension/internal/pdfinput/svg-builder.h | 3 +-
testfiles/src/pdf-utils-test.cpp | 7 +--
11 files changed, 101 insertions(+), 54 deletions(-)
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -808,7 +808,11 @@ PdfInput::add_builder_page(std::shared_p
@@ -242,7 +288,7 @@ Heavily modified patch in https://gitlab.com/inkscape/inkscape/-/merge_requests/
return Geom::Rect(box->x1, box->y1, box->x2, box->y2);
}
+Geom::Rect getRect(const PDFRectangle& box)
+Geom::Rect getRect(_POPPLER_CONST PDFRectangle &box)
+{
+ return Geom::Rect(box.x1, box.y1, box.x2, box.y2);
+}
@@ -256,7 +302,7 @@ Heavily modified patch in https://gitlab.com/inkscape/inkscape/-/merge_requests/
};
Geom::Rect getRect(_POPPLER_CONST PDFRectangle *box);
+Geom::Rect getRect(const PDFRectangle& box);
+Geom::Rect getRect(_POPPLER_CONST PDFRectangle &box);
Geom::PathVector getPathV(GfxPath *gPath);
#endif /* PDF_UTILS_H */
@@ -327,38 +373,105 @@ Heavily modified patch in https://gitlab.com/inkscape/inkscape/-/merge_requests/
case objStream:
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -392,6 +392,11 @@ static std::string svgConvertGfxRGB(GfxR
return svgConvertRGBToText(r, g, b);
}
@@ -394,6 +394,14 @@ static std::string svgConvertGfxRGB(GfxR
+std::string SvgBuilder::convertGfxColor(const GfxColor& color, GfxColorSpace *space)
+{
+ return convertGfxColor(&color, space);
+}
+
std::string SvgBuilder::convertGfxColor(const GfxColor *color, GfxColorSpace *space)
{
+ if (!color) {
+ return "";
+ }
+ return convertGfxColor(*color, space);
+}
+
+std::string SvgBuilder::convertGfxColor(const GfxColor &color, GfxColorSpace *space)
+{
std::string icc = "";
@@ -412,7 +417,7 @@ std::string SvgBuilder::convertGfxColor(
switch (space->getMode()) {
case csDeviceGray:
@@ -412,14 +420,14 @@ std::string SvgBuilder::convertGfxColor(
}
GfxRGB rgb;
- space->getRGB(color, &rgb);
+ space->_POPPLER_GET_RGB(*color, &rgb);
+ space->_POPPLER_GET_RGB(color, &rgb);
auto rgb_color = svgConvertGfxRGB(&rgb);
if (!icc.empty()) {
@@ -1214,7 +1219,7 @@ void SvgBuilder::_addStopToGradient(Inks
Inkscape::CSSOStringStream icc_color;
icc_color << rgb_color << " icc-color(" << icc;
for (int i = 0; i < space->getNComps(); ++i) {
- icc_color << ", " << colToDbl((*color).c[i]);
+ icc_color << ", " << colToDbl((color).c[i]);
}
icc_color << ");";
return icc_color.str();
@@ -1204,7 +1212,7 @@ gchar *SvgBuilder::_createGradient(GfxSh
/**
* \brief Adds a stop with the given properties to the gradient's representation
*/
-void SvgBuilder::_addStopToGradient(Inkscape::XML::Node *gradient, double offset, GfxColor *color, GfxColorSpace *space,
+void SvgBuilder::_addStopToGradient(Inkscape::XML::Node *gradient, double offset, GfxColor &color, GfxColorSpace *space,
double opacity)
{
Inkscape::XML::Node *stop = _xml_doc->createElement("svg:stop");
@@ -1214,7 +1222,7 @@ void SvgBuilder::_addStopToGradient(Inks
if (space->getMode() == csDeviceGray) {
// This is a transparency mask.
GfxRGB rgb;
- space->getRGB(color, &rgb);
+ space->_POPPLER_GET_RGB(*color, &rgb);
+ space->_POPPLER_GET_RGB(color, &rgb);
double gray = (double)rgb.r / 65535.0;
gray = CLAMP(gray, 0.0, 1.0);
os_opacity << gray;
@@ -1255,8 +1263,8 @@ bool SvgBuilder::_addGradientStops(Inksc
if (!svgGetShadingColor(shading, 0.0, &stop1) || !svgGetShadingColor(shading, 1.0, &stop2)) {
return false;
} else {
- _addStopToGradient(gradient, 0.0, &stop1, space, 1.0);
- _addStopToGradient(gradient, 1.0, &stop2, space, 1.0);
+ _addStopToGradient(gradient, 0.0, stop1, space, 1.0);
+ _addStopToGradient(gradient, 1.0, stop2, space, 1.0);
}
} else if (type == _POPPLER_FUNCTION_TYPE_STITCHING) {
auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func);
@@ -1269,7 +1277,7 @@ bool SvgBuilder::_addGradientStops(Inksc
// Add stops from all the stitched functions
GfxColor prev_color, color;
svgGetShadingColor(shading, bounds[0], &prev_color);
- _addStopToGradient(gradient, bounds[0], &prev_color, space, 1.0);
+ _addStopToGradient(gradient, bounds[0], prev_color, space, 1.0);
for ( int i = 0 ; i < num_funcs ; i++ ) {
svgGetShadingColor(shading, bounds[i + 1], &color);
// Add stops
@@ -1279,14 +1287,14 @@ bool SvgBuilder::_addGradientStops(Inksc
expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1
if (encode[2*i] == 0) { // normal sequence
auto offset = (bounds[i + 1] - expE) / max_bound;
- _addStopToGradient(gradient, offset, &prev_color, space, 1.0);
+ _addStopToGradient(gradient, offset, prev_color, space, 1.0);
} else { // reflected sequence
auto offset = (bounds[i] + expE) / max_bound;
- _addStopToGradient(gradient, offset, &color, space, 1.0);
+ _addStopToGradient(gradient, offset, color, space, 1.0);
}
}
}
- _addStopToGradient(gradient, bounds[i + 1] / max_bound, &color, space, 1.0);
+ _addStopToGradient(gradient, bounds[i + 1] / max_bound, color, space, 1.0);
prev_color = color;
}
} else { // Unsupported function type
--- a/src/extension/internal/pdfinput/svg-builder.h
+++ b/src/extension/internal/pdfinput/svg-builder.h
@@ -186,7 +186,7 @@ private:
// Pattern creation
gchar *_createPattern(GfxPattern *pattern, GfxState *state, bool is_stroke=false);
gchar *_createGradient(GfxShading *shading, const Geom::Affine pat_matrix, bool for_shading = false);
- void _addStopToGradient(Inkscape::XML::Node *gradient, double offset, GfxColor *color, GfxColorSpace *space,
+ void _addStopToGradient(Inkscape::XML::Node *gradient, double offset, GfxColor &color, GfxColorSpace *space,
double opacity);
bool _addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
_POPPLER_CONST Function *func);
@@ -240,6 +240,7 @@ private:
// Colors
@@ -0,0 +1,318 @@
From fc52525f8d8d7d3e772c5bfa1bdfe9b33c7f9709 Mon Sep 17 00:00:00 2001
From: KrIr17 <elendil.krir17@gmail.com>
Date: Sat, 4 Jul 2026 14:07:44 +0200
Subject: [PATCH] Fix building with Poppler 26.07.0
1. `arrayGetfoo()` to `getArray()->getFoo()` [1]
2. `streamGetFoo()` to `getStream()->getFoo()` [2]
3. indextolabel now requires an `std::string *` and not `GooString *`
introduced _POPPLER_STRING_26_7 that changes accordingly.
Relevant poppler commits:
[1] [Remove Object::arrayGetNF](https://gitlab.freedesktop.org/poppler/poppler/-/commit/d9ffc4c29d1975a5c81d6bac9d8a1b6dc5aa1f50): Technically only arrayGetNF was removed, but perusing the commit shows that all `arrayGetFoo` are being changed. I assume they are slated for removal in future releases.
[2] [Remove Object::streamGetDict](gitlab.freedesktop.org/poppler/poppler/-/commit/87edb5a5c40e67e782e54a14a2251547b4acdfb5)
[3] [Use std::string instead of GooString for label](https://gitlab.freedesktop.org/poppler/poppler/-/commit/9e34004aae04064f1b798b5e711e13d0dddacf9e)
---
src/extension/internal/pdfinput/pdf-input.cpp | 5 +-
.../internal/pdfinput/pdf-parser.cpp | 54 +++++++++----------
.../pdfinput/poppler-transition-api.h | 6 +++
.../internal/pdfinput/poppler-utils.cpp | 29 +++++-----
.../internal/pdfinput/poppler-utils.h | 1 +
5 files changed, 54 insertions(+), 41 deletions(-)
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -855,9 +855,10 @@ PdfInput::add_builder_page(std::shared_p
// Parse the annotations
if (auto annots = page->getAnnotsObject(); annots.isArray()) {
- auto const size = annots.arrayGetLength();
+ auto* annotsArray = annots.getArray();
+ auto const size = annotsArray->getLength();
for (int i = 0; i < size; i++) {
- pdf_parser.build_annots(annots.arrayGet(i), page_num);
+ pdf_parser.build_annots(annotsArray->get(i), page_num);
}
}
}
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -293,8 +293,8 @@ PdfParser::PdfParser(std::shared_ptr<PDF
if (page) {
// Increment the page building here and set page label
Catalog *catalog = pdf_doc->getCatalog();
- GooString *label = new GooString("");
- catalog->indexToLabel(page->getNum() - 1, label);
+ _POPPLER_STRING_26_7 label;
+ catalog->indexToLabel(page->getNum() - 1, &label);
builder->pushPage(getString(label), state);
}
@@ -370,8 +370,8 @@ void PdfParser::parse(Object *obj, GBool
Object obj2;
if (obj->isArray()) {
- for (int i = 0; i < obj->arrayGetLength(); ++i) {
- _POPPLER_CALL_ARGS(obj2, obj->arrayGet, i);
+ for (int i = 0; i < obj->getArray()->getLength(); ++i) {
+ _POPPLER_CALL_ARGS(obj2, obj->getArray()->get, i);
if (!obj2.isStream()) {
error(errInternal, -1, "Weird page contents");
_POPPLER_FREE(obj2);
@@ -808,8 +808,8 @@ void PdfParser::opSetExtGState(Object ar
for (int &i : backdropColor.c) {
i = 0;
}
- for (int i = 0; i < obj3.arrayGetLength() && i < gfxColorMaxComps; ++i) {
- _POPPLER_CALL_ARGS(obj4, obj3.arrayGet, i);
+ for (int i = 0; i < obj3.getArray()->getLength() && i < gfxColorMaxComps; ++i) {
+ _POPPLER_CALL_ARGS(obj4, obj3.getArray()->get, i);
if (obj4.isNum()) {
backdropColor.c[i] = dblToCol(obj4.getNum());
}
@@ -818,7 +818,7 @@ void PdfParser::opSetExtGState(Object ar
}
_POPPLER_FREE(obj3);
if (_POPPLER_CALL_ARGS_DEREF(obj3, obj2.dictLookup, "G").isStream()) {
- if (_POPPLER_CALL_ARGS_DEREF(obj4, obj3.streamGetDict()->lookup, "Group").isDict()) {
+ if (_POPPLER_CALL_ARGS_DEREF(obj4, obj3.getStream()->getDict()->lookup, "Group").isDict()) {
std::unique_ptr<GfxColorSpace> blendingColorSpace;
GBool isolated = gFalse;
GBool knockout = gFalse;
@@ -881,7 +881,7 @@ void PdfParser::doSoftMask(Object *str,
}
// get stream dict
- dict = str->streamGetDict();
+ dict = str->getStream()->getDict();
// check form type
_POPPLER_CALL_ARGS(obj1, dict->lookup, "FormType");
@@ -898,7 +898,7 @@ void PdfParser::doSoftMask(Object *str,
return;
}
for (i = 0; i < 4; ++i) {
- _POPPLER_CALL_ARGS(obj2, obj1.arrayGet, i);
+ _POPPLER_CALL_ARGS(obj2, obj1.getArray()->get, i);
bbox[i] = obj2.getNum();
_POPPLER_FREE(obj2);
}
@@ -908,7 +908,7 @@ void PdfParser::doSoftMask(Object *str,
_POPPLER_CALL_ARGS(obj1, dict->lookup, "Matrix");
if (obj1.isArray()) {
for (i = 0; i < 6; ++i) {
- _POPPLER_CALL_ARGS(obj2, obj1.arrayGet, i);
+ _POPPLER_CALL_ARGS(obj2, obj1.getArray()->get, i);
m[i] = obj2.getNum();
_POPPLER_FREE(obj2);
}
@@ -2378,7 +2378,7 @@ void PdfParser::opXObject(Object args[],
}
//add layer at root if xObject has type OCG
- _POPPLER_CALL_ARGS(obj2, obj1.streamGetDict()->lookup, "OC");
+ _POPPLER_CALL_ARGS(obj2, obj1.getStream()->getDict()->lookup, "OC");
if(obj2.isDict()){
auto type_dict = obj2.getDict();
if (type_dict->lookup("Type").isName("OCG")) {
@@ -2396,7 +2396,7 @@ void PdfParser::opXObject(Object args[],
}
}
- _POPPLER_CALL_ARGS(obj2, obj1.streamGetDict()->lookup, "Subtype");
+ _POPPLER_CALL_ARGS(obj2, obj1.getStream()->getDict()->lookup, "Subtype");
if (obj2.isName(const_cast<char*>("Image"))) {
_POPPLER_CALL_ARGS(refObj, res->lookupXObjectNF, name);
doImage(&refObj, obj1.getStream(), gFalse);
@@ -2404,7 +2404,7 @@ void PdfParser::opXObject(Object args[],
} else if (obj2.isName(const_cast<char*>("Form"))) {
doForm(&obj1);
} else if (obj2.isName(const_cast<char*>("PS"))) {
- _POPPLER_CALL_ARGS(obj3, obj1.streamGetDict()->lookup, "Level1");
+ _POPPLER_CALL_ARGS(obj3, obj1.getStream()->getDict()->lookup, "Level1");
} else if (obj2.isName()) {
error(errSyntaxError, getPos(), "Unknown XObject subtype '{0:s}'", obj2.getName());
} else {
@@ -2535,7 +2535,7 @@ void PdfParser::doImage(Object * /*ref*/
_POPPLER_CALL_ARGS(obj1, dict->lookup, "D");
}
if (obj1.isArray()) {
- _POPPLER_CALL_ARGS(obj2, obj1.arrayGet, 0);
+ _POPPLER_CALL_ARGS(obj2, obj1.getArray()->get, 0);
if (obj2.isInt() && obj2.getInt() == 1) {
invert = gTrue;
}
@@ -2597,7 +2597,7 @@ void PdfParser::doImage(Object * /*ref*/
goto err1;
}
maskStr = smaskObj.getStream();
- maskDict = smaskObj.streamGetDict();
+ maskDict = smaskObj.getStream()->getDict();
_POPPLER_CALL_ARGS(obj1, maskDict->lookup, "Width");
if (obj1.isNull()) {
_POPPLER_FREE(obj1);
@@ -2663,8 +2663,8 @@ void PdfParser::doImage(Object * /*ref*/
} else if (maskObj.isArray()) {
// color key mask
int i;
- for (i = 0; i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps; ++i) {
- _POPPLER_CALL_ARGS(obj1, maskObj.arrayGet, i);
+ for (i = 0; i < maskObj.getArray()->getLength() && i < 2*gfxColorMaxComps; ++i) {
+ _POPPLER_CALL_ARGS(obj1, maskObj.getArray()->get, i);
maskColors[i] = obj1.getInt();
_POPPLER_FREE(obj1);
}
@@ -2675,7 +2675,7 @@ void PdfParser::doImage(Object * /*ref*/
goto err1;
}
maskStr = maskObj.getStream();
- maskDict = maskObj.streamGetDict();
+ maskDict = maskObj.getStream()->getDict();
_POPPLER_CALL_ARGS(obj1, maskDict->lookup, "Width");
if (obj1.isNull()) {
_POPPLER_FREE(obj1);
@@ -2722,7 +2722,7 @@ void PdfParser::doImage(Object * /*ref*/
_POPPLER_CALL_ARGS(obj1, maskDict->lookup, "D");
}
if (obj1.isArray()) {
- _POPPLER_CALL_ARGS(obj2, obj1.arrayGet, 0);
+ _POPPLER_CALL_ARGS(obj2, obj1.getArray()->get, 0);
if (obj2.isInt() && obj2.getInt() == 1) {
maskInvert = gTrue;
}
@@ -2775,7 +2775,7 @@ void PdfParser::doForm(Object *str, doub
}
// get stream dict
- dict = str->streamGetDict();
+ dict = str->getStream()->getDict();
// check form type
_POPPLER_CALL_ARGS(obj1, dict->lookup, "FormType");
@@ -2792,7 +2792,7 @@ void PdfParser::doForm(Object *str, doub
return;
}
for (i = 0; i < 4; ++i) {
- _POPPLER_CALL_ARGS(obj1, bboxObj.arrayGet, i);
+ _POPPLER_CALL_ARGS(obj1, bboxObj.getArray()->get, i);
bbox[i] = obj1.getNum();
_POPPLER_FREE(obj1);
}
@@ -2802,7 +2802,7 @@ void PdfParser::doForm(Object *str, doub
_POPPLER_CALL_ARGS(matrixObj, dict->lookup, "Matrix");
if (matrixObj.isArray()) {
for (i = 0; i < 6; ++i) {
- _POPPLER_CALL_ARGS(obj1, matrixObj.arrayGet, i);
+ _POPPLER_CALL_ARGS(obj1, matrixObj.getArray()->get, i);
m[i] = obj1.getNum();
_POPPLER_FREE(obj1);
}
@@ -3194,10 +3194,10 @@ void PdfParser::loadColorProfile()
return;
Object outputIntents = catDict.dictLookup("OutputIntents");
- if (!outputIntents.isArray() || outputIntents.arrayGetLength() != 1)
+ if (!outputIntents.isArray() || outputIntents.getArray()->getLength() != 1)
return;
- Object firstElement = outputIntents.arrayGet(0);
+ Object firstElement = outputIntents.getArray()->get(0);
if (!firstElement.isDict())
return;
@@ -3245,7 +3245,7 @@ void PdfParser::build_annots(const Objec
_POPPLER_CALL_ARGS(Rect_obj, annot_dict->lookup, "Rect");
if (Rect_obj.isArray()) {
for (int i = 0; i < 2; i++) {
- _POPPLER_CALL_ARGS(xy_obj, Rect_obj.arrayGet, i);
+ _POPPLER_CALL_ARGS(xy_obj, Rect_obj.getArray()->get, i);
offset[i] = xy_obj.getNum();
}
doForm(&first_state_obj, offset);
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -15,6 +15,12 @@
#include <glib/poppler-features.h>
#include <poppler/UTF.h>
+#if POPPLER_CHECK_VERSION(26, 7, 0)
+#define _POPPLER_STRING_26_7 std::string
+#else
+#define _POPPLER_STRING_26_7 GooString
+#endif
+
#if POPPLER_CHECK_VERSION(26, 6, 0)
#define _POPPLER_GET_GRAY(color, gray) getGray(color, gray)
#define _POPPLER_GET_RGB(color, rgb) getRGB(color, rgb)
--- a/src/extension/internal/pdfinput/poppler-utils.cpp
+++ b/src/extension/internal/pdfinput/poppler-utils.cpp
@@ -186,15 +186,16 @@ void InkFontDict::hashFontObject1(const
case objNull:
h->hash('z');
break;
- case objArray:
- h->hash('a');
- n = obj->arrayGetLength();
- h->hash((char *)&n, sizeof(int));
- for (i = 0; i < n; ++i) {
- const Object &obj2 = obj->arrayGetNF(i);
- hashFontObject1(&obj2, h);
- }
- break;
+ case objArray: {
+ h->hash('a');
+ Array * objArray = obj->getArray();
+ n = objArray->getLength();
+ h->hash((char *)&n, sizeof(int));
+ for (i = 0; i < n; ++i) {
+ const Object &obj2 = objArray->getNF(i);
+ hashFontObject1(&obj2, h);
+ }
+ } break;
case objDict: {
h->hash('d');
auto objdict = obj->getDict();
@@ -206,8 +207,7 @@ void InkFontDict::hashFontObject1(const
const Object &obj2 = objdict->getValNF(i);
hashFontObject1(&obj2, h);
}
- }
- break;
+ } break;
case objStream:
// this should never happen - streams must be indirect refs
break;
@@ -545,7 +545,7 @@ void _getFontsRecursive(std::shared_ptr<
continue;
Ref resourcesRef;
- const Object resObj = obj2.streamGetDict()->lookup("Resources", &resourcesRef);
+ const Object resObj = obj2.getStream()->getDict()->lookup("Resources", &resourcesRef);
if (resourcesRef != Ref::INVALID() && !visitedObjects.insert(resourcesRef.num).second)
continue;
@@ -610,6 +610,11 @@ std::string getString(const GooString *v
return "";
}
+std::string getString(const GooString &value)
+{
+ return getString(value.toStr());
+}
+
/**
* Convert PDF strings, which can be formatted as UTF8, UTF16BE or UTF16LE into
* a predictable UTF8 string consistant with svg requirements.
--- a/src/extension/internal/pdfinput/poppler-utils.h
+++ b/src/extension/internal/pdfinput/poppler-utils.h
@@ -86,6 +86,7 @@ std::string getDictString(Dict *dict, co
std::string getString(const std::string &value);
std::string getString(const std::unique_ptr<GooString> &value);
std::string getString(const GooString *value);
+std::string getString(const GooString &value);
std::string validateString(std::string const &in);
// Replacate poppler FontDict
+1 -1
View File
@@ -1,7 +1,7 @@
# Template file for 'inkscape'
pkgname=inkscape
version=1.4.3
revision=4
revision=5
build_style=cmake
make_check_target="check"
hostmakedepends="automake gettext glib-devel intltool libgraphicsmagick-devel