pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/graphics/inkscape



Module Name:    pkgsrc
Committed By:   markd
Date:           Sun Jan  6 08:41:01 UTC 2019

Modified Files:
        pkgsrc/graphics/inkscape: Makefile PLIST
        pkgsrc/graphics/inkscape/patches:
            patch-CMakeScripts_DefineDependsandFlags.cmake
            patch-src_extension_internal_pdfinput_pdf-input.cpp
            patch-src_extension_internal_pdfinput_pdf-parser.cpp
            patch-src_extension_internal_pdfinput_pdf-parser.h
            patch-src_extension_internal_pdfinput_svg-builder.cpp
Added Files:
        pkgsrc/graphics/inkscape/patches:
            patch-src_extension_internal_pdfinput_pdf-input.h
            patch-src_extension_internal_pdfinput_poppler-transition-api.h
            patch-src_extension_internal_pdfinput_svg-builder.h
Removed Files:
        pkgsrc/graphics/inkscape/patches: patch-config.h.cmake

Log Message:
inkscape: update to 0.92.3

Also post 0.92.3 updates from upstream for poppler-0.72 by way of
linuxfromscratch.
http://www.linuxfromscratch.org/patches/blfs/svn/inkscape-0.92.3-consolidated_fixes-1.patch

Inkscape 0.92.3 is a maintenance release resolving numerous bugs and making
this the most stable release of the series. Among the most reported bugs
addressed were:

* Blank pages being output when attempting to print multiple copies of a
  document
* The inability to cancel during the export of large files
* Application crashes caused by attempting to drag a path at a cap or line
  join
* Some issues with keyboard shortcut functionality on non-Latin keyboard
  layouts

A few performance improvements and usability enhancements that made it into
the release, include:

* New SVG export options from the command line
* Support for right-to-left text
* Improved ellipse controls
* Multi-line text support for the PDF+LaTeX export
* New render tile preferences for performance tuning
* Better startup performance for many Windows users


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 pkgsrc/graphics/inkscape/Makefile
cvs rdiff -u -r1.25 -r1.26 pkgsrc/graphics/inkscape/PLIST
cvs rdiff -u -r1.1 -r1.2 \
    pkgsrc/graphics/inkscape/patches/patch-CMakeScripts_DefineDependsandFlags.cmake \
    pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.cpp \
    pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.cpp
cvs rdiff -u -r1.1 -r0 pkgsrc/graphics/inkscape/patches/patch-config.h.cmake
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.h \
    pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_poppler-transition-api.h \
    pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.h
cvs rdiff -u -r1.9 -r1.10 \
    pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.cpp
cvs rdiff -u -r1.3 -r1.4 \
    pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/graphics/inkscape/Makefile
diff -u pkgsrc/graphics/inkscape/Makefile:1.180 pkgsrc/graphics/inkscape/Makefile:1.181
--- pkgsrc/graphics/inkscape/Makefile:1.180     Thu Dec 13 19:52:00 2018
+++ pkgsrc/graphics/inkscape/Makefile   Sun Jan  6 08:41:01 2019
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.180 2018/12/13 19:52:00 adam Exp $
+# $NetBSD: Makefile,v 1.181 2019/01/06 08:41:01 markd Exp $
 
-DISTNAME=      inkscape-0.92.2
-PKGREVISION=   22
+DISTNAME=      inkscape-0.92.3
 CATEGORIES=    graphics
 MASTER_SITES=  https://media.inkscape.org/dl/resources/file/
 EXTRACT_SUFX=  .tar.bz2
@@ -53,6 +52,11 @@ SUBST_FILES.pycmd+=  share/symbols/CMakeL
 SUBST_FILES.pycmd+=    share/templates/CMakeLists.txt
 SUBST_SED.pycmd=       -e "s,COMMAND python,COMMAND ${PYTHONBIN},g"
 
+SUBST_CLASSES+=                bool
+SUBST_STAGE.bool=      pre-configure
+SUBST_FILES.bool+=     src/extension/internal/pdfinput/pdf-parser.*
+SUBST_SED.bool=                -e 's|gTrue|true|g' -e 's|gFalse|false|g' -e 's|GBool|bool|g'
+
 REPLACE_PYTHON+=       cxxtest/cxxtestgen.py
 REPLACE_PYTHON+=       share/extensions/*.py
 REPLACE_PYTHON+=       share/extensions/Barcode/*.py

Index: pkgsrc/graphics/inkscape/PLIST
diff -u pkgsrc/graphics/inkscape/PLIST:1.25 pkgsrc/graphics/inkscape/PLIST:1.26
--- pkgsrc/graphics/inkscape/PLIST:1.25 Tue Dec 19 09:28:25 2017
+++ pkgsrc/graphics/inkscape/PLIST      Sun Jan  6 08:41:01 2019
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.25 2017/12/19 09:28:25 markd Exp $
+@comment $NetBSD: PLIST,v 1.26 2019/01/06 08:41:01 markd Exp $
 bin/inkscape
 bin/inkview
 lib/inkscape/lib2geom_LIB.a
@@ -703,8 +703,6 @@ share/inkscape/tutorials/pixelart-dialog
 share/inkscape/tutorials/pixelart-dialog.ru.png
 share/inkscape/tutorials/pixelart-dialog.sk.png
 share/inkscape/tutorials/pixelart-dialog.zh_TW.png
-share/inkscape/tutorials/potrace.be.png
-share/inkscape/tutorials/potrace.ca.png
 share/inkscape/tutorials/potrace.de.png
 share/inkscape/tutorials/potrace.el.png
 share/inkscape/tutorials/potrace.en.png
@@ -724,7 +722,6 @@ share/inkscape/tutorials/potrace.ru.png
 share/inkscape/tutorials/potrace.sk.png
 share/inkscape/tutorials/potrace.sl.png
 share/inkscape/tutorials/potrace.vi.png
-share/inkscape/tutorials/potrace.zh_CN.png
 share/inkscape/tutorials/potrace.zh_TW.png
 share/inkscape/tutorials/tutorial-advanced.be.svg
 share/inkscape/tutorials/tutorial-advanced.ca.svg
@@ -735,6 +732,7 @@ share/inkscape/tutorials/tutorial-advanc
 share/inkscape/tutorials/tutorial-advanced.eu.svg
 share/inkscape/tutorials/tutorial-advanced.fa.svg
 share/inkscape/tutorials/tutorial-advanced.fr.svg
+share/inkscape/tutorials/tutorial-advanced.gl.svg
 share/inkscape/tutorials/tutorial-advanced.hu.svg
 share/inkscape/tutorials/tutorial-advanced.id.svg
 share/inkscape/tutorials/tutorial-advanced.it.svg
@@ -789,6 +787,7 @@ share/inkscape/tutorials/tutorial-callig
 share/inkscape/tutorials/tutorial-calligraphy.eu.svg
 share/inkscape/tutorials/tutorial-calligraphy.fa.svg
 share/inkscape/tutorials/tutorial-calligraphy.fr.svg
+share/inkscape/tutorials/tutorial-calligraphy.gl.svg
 share/inkscape/tutorials/tutorial-calligraphy.hu.svg
 share/inkscape/tutorials/tutorial-calligraphy.id.svg
 share/inkscape/tutorials/tutorial-calligraphy.ja.svg
@@ -810,6 +809,7 @@ share/inkscape/tutorials/tutorial-elemen
 share/inkscape/tutorials/tutorial-elements.eu.svg
 share/inkscape/tutorials/tutorial-elements.fa.svg
 share/inkscape/tutorials/tutorial-elements.fr.svg
+share/inkscape/tutorials/tutorial-elements.gl.svg
 share/inkscape/tutorials/tutorial-elements.hu.svg
 share/inkscape/tutorials/tutorial-elements.id.svg
 share/inkscape/tutorials/tutorial-elements.it.svg
@@ -827,6 +827,7 @@ share/inkscape/tutorials/tutorial-interp
 share/inkscape/tutorials/tutorial-interpolate.de.svg
 share/inkscape/tutorials/tutorial-interpolate.el.svg
 share/inkscape/tutorials/tutorial-interpolate.fr.svg
+share/inkscape/tutorials/tutorial-interpolate.gl.svg
 share/inkscape/tutorials/tutorial-interpolate.hu.svg
 share/inkscape/tutorials/tutorial-interpolate.ja.svg
 share/inkscape/tutorials/tutorial-interpolate.nl.svg
@@ -872,6 +873,7 @@ share/inkscape/tutorials/tutorial-tips.e
 share/inkscape/tutorials/tutorial-tips.eu.svg
 share/inkscape/tutorials/tutorial-tips.fa.svg
 share/inkscape/tutorials/tutorial-tips.fr.svg
+share/inkscape/tutorials/tutorial-tips.gl.svg
 share/inkscape/tutorials/tutorial-tips.hu.svg
 share/inkscape/tutorials/tutorial-tips.id.svg
 share/inkscape/tutorials/tutorial-tips.it.svg

Index: pkgsrc/graphics/inkscape/patches/patch-CMakeScripts_DefineDependsandFlags.cmake
diff -u pkgsrc/graphics/inkscape/patches/patch-CMakeScripts_DefineDependsandFlags.cmake:1.1 pkgsrc/graphics/inkscape/patches/patch-CMakeScripts_DefineDependsandFlags.cmake:1.2
--- pkgsrc/graphics/inkscape/patches/patch-CMakeScripts_DefineDependsandFlags.cmake:1.1 Sat Sep  9 21:48:56 2017
+++ pkgsrc/graphics/inkscape/patches/patch-CMakeScripts_DefineDependsandFlags.cmake     Sun Jan  6 08:41:01 2019
@@ -1,18 +1,25 @@
-$NetBSD: patch-CMakeScripts_DefineDependsandFlags.cmake,v 1.1 2017/09/09 21:48:56 prlw1 Exp $
+$NetBSD: patch-CMakeScripts_DefineDependsandFlags.cmake,v 1.2 2019/01/06 08:41:01 markd Exp $
 
-Support poppler 0.58
-https://gitlab.com/inkscape/inkscape/commit/9418824967eb4c53371ef8588243fed4cab496e0
+support for poppler 0.72 from upstream by way of linuxfromscratch 
 
---- CMakeScripts/DefineDependsandFlags.cmake.orig      2017-02-13 23:46:57.000000000 +0000
+--- CMakeScripts/DefineDependsandFlags.cmake.orig      2018-03-11 20:38:09.000000000 +0000
 +++ CMakeScripts/DefineDependsandFlags.cmake
-@@ -126,6 +126,10 @@ if(ENABLE_POPPLER)
-               POPPLER_VERSION VERSION_EQUAL   "0.29.0")
-           set(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API ON)
+@@ -116,18 +116,6 @@ if(ENABLE_POPPLER)
+               set(HAVE_POPPLER_GLIB ON)
+           endif()
        endif()
-+      if(POPPLER_VERSION VERSION_GREATER "0.58.0" OR
-+              POPPLER_VERSION VERSION_EQUAL   "0.58.0")
-+            set(POPPLER_NEW_OBJECT_API ON)
-+      endif()
+-      if(POPPLER_VERSION VERSION_GREATER "0.26.0" OR
+-              POPPLER_VERSION VERSION_EQUAL   "0.26.0")
+-          set(POPPLER_EVEN_NEWER_COLOR_SPACE_API ON)
+-      endif()
+-      if(POPPLER_VERSION VERSION_GREATER "0.29.0" OR
+-              POPPLER_VERSION VERSION_EQUAL   "0.29.0")
+-          set(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API ON)
+-      endif()
+-      if(POPPLER_VERSION VERSION_GREATER "0.58.0" OR
+-              POPPLER_VERSION VERSION_EQUAL   "0.58.0")
+-            set(POPPLER_NEW_OBJECT_API ON)
+-      endif()
      else()
        set(ENABLE_POPPLER_CAIRO OFF)
      endif()
Index: pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.cpp
diff -u pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.cpp:1.1 pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.cpp:1.2
--- pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.cpp:1.1    Sat Sep  9 21:48:56 2017
+++ pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.cpp        Sun Jan  6 08:41:01 2019
@@ -1,28 +1,15 @@
-$NetBSD: patch-src_extension_internal_pdfinput_pdf-input.cpp,v 1.1 2017/09/09 21:48:56 prlw1 Exp $
+$NetBSD: patch-src_extension_internal_pdfinput_pdf-input.cpp,v 1.2 2019/01/06 08:41:01 markd Exp $
 
-Support poppler 0.58
-https://gitlab.com/inkscape/inkscape/commit/9418824967eb4c53371ef8588243fed4cab496e0
+support for poppler 0.72 from upstream by way of linuxfromscratch
 
---- src/extension/internal/pdfinput/pdf-input.cpp.orig 2017-02-13 23:46:57.000000000 +0000
+--- src/extension/internal/pdfinput/pdf-input.cpp.orig 2018-03-11 20:38:09.000000000 +0000
 +++ src/extension/internal/pdfinput/pdf-input.cpp
-@@ -840,14 +840,20 @@ PdfInput::open(::Inkscape::Extension::In
-         }
+@@ -793,7 +793,7 @@ PdfInput::open(::Inkscape::Extension::In
+             dlg->getImportSettings(prefs);
  
-         // Parse the document structure
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        Object obj = page->getContents();
-+#else
-         Object obj;
-         page->getContents(&obj);
-+#endif
-         if (!obj.isNull()) {
-             pdf_parser->parse(&obj);
-         }
+         // Apply crop settings
+-        PDFRectangle *clipToBox = NULL;
++        _POPPLER_CONST PDFRectangle *clipToBox = NULL;
+         double crop_setting;
+         sp_repr_get_double(prefs, "cropTo", &crop_setting);
  
-         // Cleanup
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         obj.free();
-+#endif
-         delete pdf_parser;
-         delete builder;
-         g_free(docname);
Index: pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.cpp
diff -u pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.cpp:1.1 pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.cpp:1.2
--- pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.cpp:1.1  Tue May  1 06:17:11 2018
+++ pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.cpp      Sun Jan  6 08:41:01 2019
@@ -1,15 +1,118 @@
-$NetBSD: patch-src_extension_internal_pdfinput_svg-builder.cpp,v 1.1 2018/05/01 06:17:11 wiz Exp $
+$NetBSD: patch-src_extension_internal_pdfinput_svg-builder.cpp,v 1.2 2019/01/06 08:41:01 markd Exp $
 
-Support poppler-0.64.0.
+support for poppler 0.72 from upstream by way of linuxfromscratch 
 
---- src/extension/internal/pdfinput/svg-builder.cpp.orig       2017-08-06 20:44:00.000000000 +0000
+--- src/extension/internal/pdfinput/svg-builder.cpp.orig       2018-03-11 20:38:09.000000000 +0000
 +++ src/extension/internal/pdfinput/svg-builder.cpp
-@@ -1020,7 +1020,7 @@ void SvgBuilder::updateFont(GfxState *st
-     GfxFont *font = state->getFont();
-     // Store original name
+@@ -625,7 +625,7 @@ gchar *SvgBuilder::_createPattern(GfxPat
+     if ( pattern != NULL ) {
+         if ( pattern->getType() == 2 ) {  // Shading pattern
+             GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern);
+-            double *ptm;
++            const double *ptm;
+             double m[6] = {1, 0, 0, 1, 0, 0};
+             double det;
+ 
+@@ -672,7 +672,7 @@ gchar *SvgBuilder::_createTilingPattern(
+ 
+     Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern");
+     // Set pattern transform matrix
+-    double *p2u = tiling_pattern->getMatrix();
++    const double *p2u = tiling_pattern->getMatrix();
+     double m[6] = {1, 0, 0, 1, 0, 0};
+     double det;
+     det = _ttm[0] * _ttm[3] - _ttm[1] * _ttm[2];    // see LP Bug 1168908
+@@ -698,7 +698,7 @@ gchar *SvgBuilder::_createTilingPattern(
+     pattern_node->setAttribute("patternUnits", "userSpaceOnUse");
+     // Set pattern tiling
+     // FIXME: don't ignore XStep and YStep
+-    double *bbox = tiling_pattern->getBBox();
++    const double *bbox = tiling_pattern->getBBox();
+     sp_repr_set_svg_double(pattern_node, "x", 0.0);
+     sp_repr_set_svg_double(pattern_node, "y", 0.0);
+     sp_repr_set_svg_double(pattern_node, "width", bbox[2] - bbox[0]);
+@@ -751,7 +751,7 @@ gchar *SvgBuilder::_createTilingPattern(
+  */
+ gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for_shading) {
+     Inkscape::XML::Node *gradient;
+-    Function *func;
++    _POPPLER_CONST Function *func;
+     int num_funcs;
+     bool extend0, extend1;
+ 
+@@ -865,7 +865,7 @@ static bool svgGetShadingColorRGB(GfxSha
+ 
+ #define INT_EPSILON 8
+ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
+-                                   Function *func) {
++                                   _POPPLER_CONST Function *func) {
+     int type = func->getType();
+     if ( type == 0 || type == 2 ) {  // Sampled or exponential function
+         GfxRGB stop1, stop2;
+@@ -877,9 +877,9 @@ bool SvgBuilder::_addGradientStops(Inksc
+             _addStopToGradient(gradient, 1.0, &stop2, 1.0);
+         }
+     } else if ( type == 3 ) { // Stitching
+-        StitchingFunction *stitchingFunc = static_cast<StitchingFunction*>(func);
+-        double *bounds = stitchingFunc->getBounds();
+-        double *encode = stitchingFunc->getEncode();
++        auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func);
++        const double *bounds = stitchingFunc->getBounds();
++        const double *encode = stitchingFunc->getEncode();
+         int num_funcs = stitchingFunc->getNumFuncs();
+ 
+         // Add stops from all the stitched functions
+@@ -890,7 +890,7 @@ bool SvgBuilder::_addGradientStops(Inksc
+             svgGetShadingColorRGB(shading, bounds[i + 1], &color);
+             // Add stops
+             if (stitchingFunc->getFunc(i)->getType() == 2) {    // process exponential fxn
+-                double expE = (static_cast<ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
++                double expE = (static_cast<_POPPLER_CONST ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE();
+                 if (expE > 1.0) {
+                     expE = (bounds[i + 1] - bounds[i])/expE;    // approximate exponential as a single straight line at x=1
+                     if (encode[2*i] == 0) {    // normal sequence
+@@ -1022,7 +1022,7 @@ void SvgBuilder::updateFont(GfxState *st
      if (font->getName()) {
--        _font_specification = font->getName()->getCString();
-+        _font_specification = (char*)font->getName()->getCString();
+         _font_specification = font->getName()->getCString();
      } else {
-         _font_specification = (char*) "Arial";
+-        _font_specification = (char*) "Arial";
++        _font_specification = "Arial";
+     }
+ 
+     // Prune the font name to get the correct font family name
+@@ -1030,7 +1030,7 @@ void SvgBuilder::updateFont(GfxState *st
+     char *font_family = NULL;
+     char *font_style = NULL;
+     char *font_style_lowercase = NULL;
+-    char *plus_sign = strstr(_font_specification, "+");
++    const char *plus_sign = strstr(_font_specification, "+");
+     if (plus_sign) {
+         font_family = g_strdup(plus_sign + 1);
+         _font_specification = plus_sign + 1;
+@@ -1148,7 +1148,7 @@ void SvgBuilder::updateFont(GfxState *st
+     Inkscape::CSSOStringStream os_font_size;
+     double css_font_size = _font_scaling * state->getFontSize();
+     if ( font->getType() == fontType3 ) {
+-        double *font_matrix = font->getFontMatrix();
++        const double *font_matrix = font->getFontMatrix();
+         if ( font_matrix[0] != 0.0 ) {
+             css_font_size *= font_matrix[3] / font_matrix[0];
+         }
+@@ -1193,7 +1193,7 @@ void SvgBuilder::updateTextPosition(doub
+ void SvgBuilder::updateTextMatrix(GfxState *state) {
+     _flushText();
+     // Update text matrix
+-    double *text_matrix = state->getTextMat();
++    const double *text_matrix = state->getTextMat();
+     double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] );
+     double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] );
+     double max_scale;
+@@ -1361,7 +1361,7 @@ void SvgBuilder::_flushText() {
+     _glyphs.clear();
+ }
+ 
+-void SvgBuilder::beginString(GfxState *state, GooString * /*s*/) {
++void SvgBuilder::beginString(GfxState *state) {
+     if (_need_font_update) {
+         updateFont(state);
      }

Index: pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.cpp
diff -u pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.cpp:1.9 pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.cpp:1.10
--- pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.cpp:1.9   Fri Dec 21 08:46:16 2018
+++ pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.cpp       Sun Jan  6 08:41:01 2019
@@ -1,553 +1,91 @@
-$NetBSD: patch-src_extension_internal_pdfinput_pdf-parser.cpp,v 1.9 2018/12/21 08:46:16 wiz Exp $
+$NetBSD: patch-src_extension_internal_pdfinput_pdf-parser.cpp,v 1.10 2019/01/06 08:41:01 markd Exp $
 
 - Object.h is included in pdf-parser.h -- see patch for pdf-parser.h.
-- Support poppler 0.58
-  https://gitlab.com/inkscape/inkscape/commit/9418824967eb4c53371ef8588243fed4cab496e0
-- Support poppler 0.64
+- Support for poppler 0.72 from upstream by way of linuxfromscratch 
 
---- src/extension/internal/pdfinput/pdf-parser.cpp.orig        2017-08-06 20:44:00.000000000 +0000
+--- src/extension/internal/pdfinput/pdf-parser.cpp.orig        2018-03-11 20:38:09.000000000 +0000
 +++ src/extension/internal/pdfinput/pdf-parser.cpp
-@@ -38,10 +38,9 @@ extern "C" {
+@@ -36,12 +36,11 @@ extern "C" {
+ #include "pdf-parser.h"
+ #include "util/units.h"
  
++#include "glib/poppler-features.h"
  #include "goo/gmem.h"
- #include "goo/GooTimer.h"
+-#include "goo/GooTimer.h"
 -#include "goo/GooHash.h"
++#include "goo/GooString.h"
  #include "GlobalParams.h"
  #include "CharTypes.h"
 -#include "Object.h"
-+#define POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API 1
  #include "Array.h"
  #include "Dict.h"
  #include "Stream.h"
+@@ -295,8 +294,8 @@ PdfParser::PdfParser(XRef *xrefA,
+                      int /*pageNum*/,
+                    int rotate,
+                    Dict *resDict,
+-                     PDFRectangle *box,
+-                   PDFRectangle *cropBox) :
++                     _POPPLER_CONST PDFRectangle *box,
++                     _POPPLER_CONST PDFRectangle *cropBox) :
+     xref(xrefA),
+     builder(builderA),
+     subPage(gFalse),
 @@ -318,7 +317,7 @@ PdfParser::PdfParser(XRef *xrefA,
    builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"),
                             Inkscape::Util::Quantity::convert(state->getPageHeight(), "pt", "px"));
  
 -  double *ctm = state->getCTM();
-+  _POPPLER_CONST double *ctm = state->getCTM();
++  const double *ctm = state->getCTM();
    double scaledCTM[6];
    for (int i = 0; i < 6; ++i) {
      baseMatrix[i] = ctm[i];
-@@ -414,13 +413,21 @@ void PdfParser::parse(Object *obj, GBool
- 
-   if (obj->isArray()) {
-     for (int i = 0; i < obj->arrayGetLength(); ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      obj2 = obj->arrayGet(i);
-+#else
-       obj->arrayGet(i, &obj2);
-+#endif
-       if (!obj2.isStream()) {
-       error(errInternal, -1, "Weird page contents");
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj2.free();
-+#endif
-       return;
-       }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj2.free();
-+#endif
-     }
-   } else if (!obj->isStream()) {
-       error(errInternal, -1, "Weird page contents");
-@@ -439,7 +446,11 @@ void PdfParser::go(GBool /*topLevel*/)
- 
-   // scan a sequence of objects
-   int numArgs = 0;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj = parser->getObj();
-+#else
-   parser->getObj(&obj);
-+#endif
-   while (!obj.isEOF()) {
- 
-     // got a command - execute it
-@@ -457,14 +468,20 @@ void PdfParser::go(GBool /*topLevel*/)
-       // Run the operation
-       execOp(&obj, args, numArgs);
- 
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj.free();
-       for (int i = 0; i < numArgs; ++i)
-       args[i].free();
-+#endif
-       numArgs = 0;
- 
-     // got an argument - save it
-     } else if (numArgs < maxArgs) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      args[numArgs++] = std::move(obj);
-+#else
-       args[numArgs++] = obj;
-+#endif
- 
-     // too many arguments - something is wrong
-     } else {
-@@ -475,13 +492,21 @@ void PdfParser::go(GBool /*topLevel*/)
-       printf("\n");
-       fflush(stdout);
-       }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj.free();
-+#endif
-     }
- 
-     // grab the next object
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj = parser->getObj();
-+#else
-     parser->getObj(&obj);
-+#endif
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj.free();
-+#endif
- 
-   // args at end with no command
-   if (numArgs > 0) {
-@@ -495,8 +520,10 @@ void PdfParser::go(GBool /*topLevel*/)
-       printf("\n");
-       fflush(stdout);
-     }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     for (int i = 0; i < numArgs; ++i)
-       args[i].free();
-+#endif
-   }
- }
- 
-@@ -543,8 +570,8 @@ const char *PdfParser::getPreviousOperat
- }
+@@ -353,7 +352,7 @@ PdfParser::PdfParser(XRef *xrefA,
+ PdfParser::PdfParser(XRef *xrefA,
+                    Inkscape::Extension::Internal::SvgBuilder *builderA,
+                      Dict *resDict,
+-                   PDFRectangle *box) :
++                   _POPPLER_CONST PDFRectangle *box) :
+     xref(xrefA),
+     builder(builderA),
+     subPage(gTrue),
+@@ -572,7 +571,7 @@ const char *PdfParser::getPreviousOperat
  
  void PdfParser::execOp(Object *cmd, Object args[], int numArgs) {
--  PdfOperator *op;
+   PdfOperator *op;
 -  char *name;
-+  _POPPLER_CONST PdfOperator *op;
-+  _POPPLER_CONST char *name;
++  const char *name;
    Object *argPtr;
    int i;
  
-@@ -692,9 +719,13 @@ void PdfParser::opSetDash(Object args[],
-   if (length != 0) {
-     dash = (double *)gmallocn(length, sizeof(double));
-     for (int i = 0; i < length; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      dash[i] = a->get(i).getNum();
-+#else
-       Object obj;
-       dash[i] = a->get(i, &obj)->getNum();
-       obj.free();
-+#endif
-     }
-   }
-   state->setLineDash(dash, length, args[1].getNum());
-@@ -744,12 +775,18 @@ void PdfParser::opSetExtGState(Object ar
-   GBool haveBackdropColor = gFalse;
-   GBool alpha = gFalse;
- 
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj1 = res->lookupGState(args[0].getName())).isNull()) {
-+#else
-   if (!res->lookupGState(args[0].getName(), &obj1)) {
-+#endif
-     return;
-   }
-   if (!obj1.isDict()) {
-     error(errSyntaxError, getPos(), "ExtGState '{0:s}' is wrong type"), args[0].getName();
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj1.free();
-+#endif
-     return;
-   }
-   if (printCommands) {
-@@ -759,7 +796,11 @@ void PdfParser::opSetExtGState(Object ar
-   }
- 
-   // transparency support: blend mode, fill/stroke opacity
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if (!((obj2 = obj1.dictLookup(const_cast<char*>("BM"))).isNull())) {
-+#else
-   if (!obj1.dictLookup(const_cast<char*>("BM"), &obj2)->isNull()) {
-+#endif
-     GfxBlendMode mode = gfxBlendNormal;
-     if (state->parseBlendMode(&obj2, &mode)) {
-       state->setBlendMode(mode);
-@@ -767,40 +808,71 @@ void PdfParser::opSetExtGState(Object ar
-       error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState");
-     }
-   }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj2 = obj1.dictLookup(const_cast<char*>("ca"))).isNum()) {
-+#else
-   obj2.free();
-   if (obj1.dictLookup(const_cast<char*>("ca"), &obj2)->isNum()) {
-+#endif
-     state->setFillOpacity(obj2.getNum());
-   }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj2 = obj1.dictLookup(const_cast<char*>("CA"))).isNum()) {
-+#else
-   obj2.free();
-   if (obj1.dictLookup(const_cast<char*>("CA"), &obj2)->isNum()) {
-+#endif
-     state->setStrokeOpacity(obj2.getNum());
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj2.free();
-+#endif
- 
-   // fill/stroke overprint
-   GBool haveFillOP = gFalse;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((haveFillOP = (obj2 = obj1.dictLookup(const_cast<char*>("op"))).isBool())) {
-+#else
-   if ((haveFillOP = (obj1.dictLookup(const_cast<char*>("op"), &obj2)->isBool()))) {
-+#endif
-     state->setFillOverprint(obj2.getBool());
-   }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj2 = obj1.dictLookup(const_cast<char*>("OP"))).isBool()) {
-+#else
-   obj2.free();
-   if (obj1.dictLookup(const_cast<char*>("OP"), &obj2)->isBool()) {
-+#endif
-     state->setStrokeOverprint(obj2.getBool());
-     if (!haveFillOP) {
-       state->setFillOverprint(obj2.getBool());
-     }
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj2.free();
-+#endif
- 
-   // stroke adjust
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj2 = obj1.dictLookup(const_cast<char*>("SA"))).isBool()) {
-+#else
-   if (obj1.dictLookup(const_cast<char*>("SA"), &obj2)->isBool()) {
-+#endif
-     state->setStrokeAdjust(obj2.getBool());
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj2.free();
-+#endif
- 
-   // transfer function
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj2 = obj1.dictLookup(const_cast<char*>("TR2"))).isNull()) {
-+    obj2 = obj1.dictLookup(const_cast<char*>("TR"));
-+#else
-   if (obj1.dictLookup(const_cast<char*>("TR2"), &obj2)->isNull()) {
-     obj2.free();
-     obj1.dictLookup(const_cast<char*>("TR"), &obj2);
-+#endif
-   }
-   if (obj2.isName(const_cast<char*>("Default")) ||
-       obj2.isName(const_cast<char*>("Identity"))) {
-@@ -809,9 +881,15 @@ void PdfParser::opSetExtGState(Object ar
-   } else if (obj2.isArray() && obj2.arrayGetLength() == 4) {
-     int pos = 4;
-     for (int i = 0; i < 4; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      obj3 = obj2.arrayGet(i);
-+#else
-       obj2.arrayGet(i, &obj3);
-+#endif
-       funcs[i] = Function::parse(&obj3);
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj3.free();
-+#endif
-       if (!funcs[i]) {
-       pos = i;
-       break;
-@@ -828,21 +906,37 @@ void PdfParser::opSetExtGState(Object ar
-   } else if (!obj2.isNull()) {
-     error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState");
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj2.free();
-+#endif
- 
-   // soft mask
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if (!((obj2 = obj1.dictLookup(const_cast<char*>("SMask"))).isNull())) {
-+#else
-   if (!obj1.dictLookup(const_cast<char*>("SMask"), &obj2)->isNull()) {
-+#endif
-     if (obj2.isName(const_cast<char*>("None"))) {
-       builder->clearSoftMask(state);
-     } else if (obj2.isDict()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      if ((obj3 = obj2.dictLookup(const_cast<char*>("S"))).isName(const_cast<char*>("Alpha"))) {
-+#else
-       if (obj2.dictLookup(const_cast<char*>("S"), &obj3)->isName(const_cast<char*>("Alpha"))) {
-+#endif
-       alpha = gTrue;
-       } else { // "Luminosity"
-       alpha = gFalse;
-       }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj3.free();
-+#endif
-       funcs[0] = NULL;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      if (!((obj3 = obj2.dictLookup(const_cast<char*>("TR"))).isNull())) {
-+#else
-       if (!obj2.dictLookup(const_cast<char*>("TR"), &obj3)->isNull()) {
-+#endif
-       funcs[0] = Function::parse(&obj3);
-       if (funcs[0]->getInputSize() != 1 ||
-           funcs[0]->getOutputSize() != 1) {
-@@ -851,26 +945,45 @@ void PdfParser::opSetExtGState(Object ar
-         funcs[0] = NULL;
-       }
-       }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      if ((haveBackdropColor = (obj3 = obj2.dictLookup(const_cast<char*>("BC"))).isArray())) {
-+#else
-       obj3.free();
-       if ((haveBackdropColor = obj2.dictLookup(const_cast<char*>("BC"), &obj3)->isArray())) {
-+#endif
-       for (int i = 0; i < gfxColorMaxComps; ++i) {
-         backdropColor.c[i] = 0;
-       }
-       for (int i = 0; i < obj3.arrayGetLength() && i < gfxColorMaxComps; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj4 = obj3.arrayGet(i);
-+#else
-         obj3.arrayGet(i, &obj4);
-+#endif
-         if (obj4.isNum()) {
-           backdropColor.c[i] = dblToCol(obj4.getNum());
-         }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         obj4.free();
-+#endif
-       }
-       }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      if ((obj3 = obj2.dictLookup(const_cast<char*>("G"))).isStream()) {
-+      if ((obj4 = obj3.streamGetDict()->lookup(const_cast<char*>("Group"))).isDict()) {
-+#else
-       obj3.free();
-       if (obj2.dictLookup(const_cast<char*>("G"), &obj3)->isStream()) {
-       if (obj3.streamGetDict()->lookup(const_cast<char*>("Group"), &obj4)->isDict()) {
-+#endif
-         GfxColorSpace *blendingColorSpace = 0;
-         GBool isolated = gFalse;
-         GBool knockout = gFalse;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        if (!((obj5 = obj4.dictLookup(const_cast<char*>("CS"))).isNull())) {
-+#else
-         if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) {
-+#endif
- #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
-           blendingColorSpace = GfxColorSpace::parse(NULL, &obj5, NULL, NULL);
- #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
-@@ -879,15 +992,25 @@ void PdfParser::opSetExtGState(Object ar
-           blendingColorSpace = GfxColorSpace::parse(&obj5, NULL);
- #endif
-         }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        if ((obj5 = obj4.dictLookup(const_cast<char*>("I"))).isBool()) {
-+#else
-         obj5.free();
-         if (obj4.dictLookup(const_cast<char*>("I"), &obj5)->isBool()) {
-+#endif
-           isolated = obj5.getBool();
-         }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        if ((obj5 = obj4.dictLookup(const_cast<char*>("K"))).isBool()) {
-+#else
-         obj5.free();
-         if (obj4.dictLookup(const_cast<char*>("K"), &obj5)->isBool()) {
-+#endif
-           knockout = obj5.getBool();
-         }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         obj5.free();
-+#endif
-         if (!haveBackdropColor) {
-           if (blendingColorSpace) {
-             blendingColorSpace->getDefaultColor(&backdropColor);
-@@ -906,18 +1029,24 @@ void PdfParser::opSetExtGState(Object ar
-       } else {
-         error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group");
-       }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj4.free();
-+#endif
-       } else {
-       error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group");
-       }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj3.free();
-+#endif
-     } else if (!obj2.isNull()) {
-       error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState");
-     }
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj2.free();
- 
-   obj1.free();
-+#endif
+@@ -620,7 +619,7 @@ void PdfParser::execOp(Object *cmd, Obje
+   (this->*op->func)(argPtr, numArgs);
  }
  
- void PdfParser::doSoftMask(Object *str, GBool alpha,
-@@ -938,43 +1067,79 @@ void PdfParser::doSoftMask(Object *str, 
-   dict = str->streamGetDict();
- 
-   // check form type
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj1 = dict->lookup(const_cast<char*>("FormType"));
-+#else
-   dict->lookup(const_cast<char*>("FormType"), &obj1);
-+#endif
-   if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
-     error(errSyntaxError, getPos(), "Unknown form type");
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj1.free();
-+#endif
- 
-   // get bounding box
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj1 = dict->lookup(const_cast<char*>("BBox"));
-+#else
-   dict->lookup(const_cast<char*>("BBox"), &obj1);
-+#endif
-   if (!obj1.isArray()) {
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj1.free();
-+#endif
-     error(errSyntaxError, getPos(), "Bad form bounding box");
-     return;
-   }
-   for (i = 0; i < 4; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj2 = obj1.arrayGet(i);
-+#else
-     obj1.arrayGet(i, &obj2);
-+#endif
-     bbox[i] = obj2.getNum();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  }
-+#else
-     obj2.free();
-   }
-   obj1.free();
-+#endif
- 
-   // get matrix
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj1 = dict->lookup(const_cast<char*>("Matrix"));
-+#else
-   dict->lookup(const_cast<char*>("Matrix"), &obj1);
-+#endif
-   if (obj1.isArray()) {
-     for (i = 0; i < 6; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      obj2 = obj1.arrayGet(i);
-+#else
-       obj1.arrayGet(i, &obj2);
-+#endif
-       m[i] = obj2.getNum();
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj2.free();
-+#endif
-     }
-   } else {
-     m[0] = 1; m[1] = 0;
-     m[2] = 0; m[3] = 1;
-     m[4] = 0; m[5] = 0;
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj1.free();
-+#endif
- 
-   // get resources
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj1 = dict->lookup(const_cast<char*>("Resources"));
-+#else
-   dict->lookup(const_cast<char*>("Resources"), &obj1);
-+#endif
-   resDict = obj1.isDict() ? obj1.getDict() : (Dict *)NULL;
- 
-   // draw it
-@@ -987,7 +1152,9 @@ void PdfParser::doSoftMask(Object *str, 
-   if (blendingColorSpace) {
-     delete blendingColorSpace;
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj1.free();
-+#endif
- }
- 
- void PdfParser::opSetRenderingIntent(Object /*args*/[], int /*numArgs*/)
-@@ -1084,7 +1251,11 @@ void PdfParser::opSetFillColorSpace(Obje
-   Object obj;
- 
-   state->setFillPattern(NULL);
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj = res->lookupColorSpace(args[0].getName());
-+#else
-   res->lookupColorSpace(args[0].getName(), &obj);
-+#endif
- 
-   GfxColorSpace *colorSpace = 0;
- #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
-@@ -1106,7 +1277,9 @@ void PdfParser::opSetFillColorSpace(Obje
-     colorSpace = GfxColorSpace::parse(&obj, NULL);
-   }
- #endif
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj.free();
-+#endif
-   if (colorSpace) {
-   GfxColor color;
-     state->setFillColorSpace(colorSpace);
-@@ -1125,7 +1298,11 @@ void PdfParser::opSetStrokeColorSpace(Ob
-   GfxColorSpace *colorSpace = 0;
- 
-   state->setStrokePattern(NULL);
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj = res->lookupColorSpace(args[0].getName());
-+#else
-   res->lookupColorSpace(args[0].getName(), &obj);
-+#endif
- #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
-   if (obj.isNull()) {
-     colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL);
-@@ -1145,7 +1322,9 @@ void PdfParser::opSetStrokeColorSpace(Ob
-     colorSpace = GfxColorSpace::parse(&obj, NULL);
-   }
- #endif
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj.free();
-+#endif
-   if (colorSpace) {
-     GfxColor color;
-     state->setStrokeColorSpace(colorSpace);
-@@ -1572,7 +1751,7 @@ void PdfParser::doShadingPatternFillFall
+-PdfOperator* PdfParser::findOp(char *name) {
++PdfOperator* PdfParser::findOp(const char *name) {
+   int a = -1;
+   int b = numOps;
+   int cmp = -1;
+@@ -1752,7 +1751,7 @@ void PdfParser::doShadingPatternFillFall
                                               GBool stroke, GBool eoFill) {
    GfxShading *shading;
    GfxPath *savedPath;
 -  double *ctm, *btm, *ptm;
-+  _POPPLER_CONST double *ctm, *btm, *ptm;
++  const double *ctm, *btm, *ptm;
    double m[6], ictm[6], m1[6];
    double xMin, yMin, xMax, yMax;
    double det;
-@@ -1814,7 +1993,7 @@ void PdfParser::doFunctionShFill1(GfxFun
+@@ -1994,7 +1993,7 @@ void PdfParser::doFunctionShFill1(GfxFun
    GfxColor color0M, color1M, colorM0, colorM1, colorMM;
    GfxColor colors2[4];
    double functionColorDelta = colorDeltas[pdfFunctionShading-1];
 -  double *matrix;
-+  _POPPLER_CONST double *matrix;
++  const double *matrix;
    double xM, yM;
    int nComps, i, j;
  
-@@ -1994,7 +2173,7 @@ void PdfParser::doPatchMeshShFill(GfxPat
+@@ -2174,7 +2173,7 @@ void PdfParser::doPatchMeshShFill(GfxPat
    }
  }
  
@@ -556,61 +94,19 @@ $NetBSD: patch-src_extension_internal_pd
    GfxPatch patch00 = blankPatch();
    GfxPatch patch01 = blankPatch();
    GfxPatch patch10 = blankPatch();
-@@ -2310,7 +2489,7 @@ void PdfParser::opShowText(Object args[]
-     builder->updateFont(state);
-     fontChanged = gFalse;
+@@ -2582,7 +2581,11 @@ void PdfParser::opShowSpaceText(Object a
    }
--  doShowText(args[0].getString());
-+  doShowText((GooString *)args[0].getString());
- }
- 
- // TODO not good that numArgs is ignored but args[] is used:
-@@ -2331,7 +2510,7 @@ void PdfParser::opMoveShowText(Object ar
-   ty = state->getLineY() - state->getLeading();
-   state->textMoveTo(tx, ty);
-   builder->updateTextPosition(tx, ty);
--  doShowText(args[0].getString());
-+  doShowText((GooString *)args[0].getString());
  }
  
- // TODO not good that numArgs is ignored but args[] is used:
-@@ -2354,7 +2533,7 @@ void PdfParser::opMoveSetShowText(Object
-   ty = state->getLineY() - state->getLeading();
-   state->textMoveTo(tx, ty);
-   builder->updateTextPosition(tx, ty);
--  doShowText(args[2].getString());
-+  doShowText((GooString *)args[2].getString());
- }
- 
- // TODO not good that numArgs is ignored but args[] is used:
-@@ -2375,7 +2554,11 @@ void PdfParser::opShowSpaceText(Object a
-   wMode = state->getFont()->getWMode();
-   a = args[0].getArray();
-   for (int i = 0; i < a->getLength(); ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj = a->get(i);
++#if POPPLER_CHECK_VERSION(0,64,0)
++void PdfParser::doShowText(const GooString *s) {
 +#else
-     a->get(i, &obj);
-+#endif
-     if (obj.isNum()) {
-       // this uses the absolute value of the font size to match
-       // Acrobat's behavior
-@@ -2388,11 +2571,13 @@ void PdfParser::opShowSpaceText(Object a
-       }
-       builder->updateTextShift(state, obj.getNum());
-     } else if (obj.isString()) {
--      doShowText(obj.getString());
-+      doShowText((GooString *)obj.getString());
-     } else {
-       error(errSyntaxError, getPos(), "Element of show/space array must be number or string");
-     }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj.free();
+ void PdfParser::doShowText(GooString *s) {
 +#endif
-   }
- }
- 
-@@ -2405,11 +2590,11 @@ void PdfParser::doShowText(GooString *s)
+   GfxFont *font;
+   int wMode;
+   double riseX, riseY;
+@@ -2591,17 +2594,21 @@ void PdfParser::doShowText(GooString *s)
    double x, y, dx, dy, tdx, tdy;
    double originX, originY, tOriginX, tOriginY;
    double oldCTM[6], newCTM[6];
@@ -619,816 +115,73 @@ $NetBSD: patch-src_extension_internal_pd
    Object charProc;
    Dict *resDict;
    Parser *oldParser;
--  char *p;
-+  _POPPLER_CONST char *p;
++#if POPPLER_CHECK_VERSION(0,64,0)
++  const char *p;
++#else
+   char *p;
++#endif
    int len, n, uLen;
  
    font = state->getFont();
-@@ -2465,7 +2650,11 @@ void PdfParser::doShowText(GooString *s)
-       //out->updateCTM(state, 1, 0, 0, 1, 0, 0);
-       if (0){ /*!out->beginType3Char(state, curX + riseX, curY + riseY, tdx, tdy,
-                              code, u, uLen)) {*/
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      charProc = ((Gfx8BitFont *)font)->getCharProc(code);
-+#else
-       ((Gfx8BitFont *)font)->getCharProc(code, &charProc);
-+#endif
-       if ((resDict = ((Gfx8BitFont *)font)->getResources())) {
-         pushResources(resDict);
-       }
-@@ -2478,7 +2667,9 @@ void PdfParser::doShowText(GooString *s)
-       if (resDict) {
-         popResources();
-       }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       charProc.free();
-+#endif
-       }
-       restoreState();
-       // GfxState::restore() does *not* restore the current position,
-@@ -2540,24 +2731,44 @@ void PdfParser::opXObject(Object args[],
- {
-   Object obj1, obj2, obj3, refObj;
+   wMode = font->getWMode();
  
--  char *name = args[0].getName();
-+  char *name = (char *)args[0].getName();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj1 = res->lookupXObject(name)).isNull()) {
-+#else
-   if (!res->lookupXObject(name, &obj1)) {
-+#endif
-     return;
-   }
-   if (!obj1.isStream()) {
-     error(errSyntaxError, getPos(), "XObject '{0:s}' is wrong type", name);
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj1.free();
-+#endif
-     return;
-   }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj2 = obj1.streamGetDict()->lookup(const_cast<char*>("Subtype"));
-+#else
-   obj1.streamGetDict()->lookup(const_cast<char*>("Subtype"), &obj2);
-+#endif
-   if (obj2.isName(const_cast<char*>("Image"))) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    refObj = res->lookupXObjectNF(name);
-+#else
-     res->lookupXObjectNF(name, &refObj);
-+#endif
-     doImage(&refObj, obj1.getStream(), gFalse);
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     refObj.free();
-+#endif
-   } else if (obj2.isName(const_cast<char*>("Form"))) {
-     doForm(&obj1);
-   } else if (obj2.isName(const_cast<char*>("PS"))) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj3 = obj1.streamGetDict()->lookup(const_cast<char*>("Level1"));
-+#else
-     obj1.streamGetDict()->lookup(const_cast<char*>("Level1"), &obj3);
-+#endif
- /*    out->psXObject(obj1.getStream(),
-                  obj3.isStream() ? obj3.getStream() : (Stream *)NULL);*/
-   } else if (obj2.isName()) {
-@@ -2565,8 +2776,10 @@ void PdfParser::opXObject(Object args[],
-   } else {
-     error(errSyntaxError, getPos(), "XObject subtype is missing or wrong type");
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj2.free();
-   obj1.free();
-+#endif
- }
+-  builder->beginString(state, s);
++  builder->beginString(state);
  
- void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
-@@ -2593,10 +2806,18 @@ void PdfParser::doImage(Object * /*ref*/
-     dict = str->getDict();
-     
-     // get size
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj1 = dict->lookup(const_cast<char*>("Width"));
-+#else
-     dict->lookup(const_cast<char*>("Width"), &obj1);
-+#endif
-     if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj1 = dict->lookup(const_cast<char*>("W"));
-+#else
-         obj1.free();
-         dict->lookup(const_cast<char*>("W"), &obj1);
-+#endif
-     }
-     if (obj1.isInt()){
-         width = obj1.getInt();
-@@ -2607,11 +2828,19 @@ void PdfParser::doImage(Object * /*ref*/
-     else {
-         goto err2;
-     }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj1 = dict->lookup(const_cast<char*>("Height"));
-+#else
-     obj1.free();
-     dict->lookup(const_cast<char*>("Height"), &obj1);
-+#endif
-     if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj1 = dict->lookup(const_cast<char*>("H"));
-+#else
-         obj1.free();
-         dict->lookup(const_cast<char*>("H"), &obj1);
-+#endif
-     }
-     if (obj1.isInt()) {
-         height = obj1.getInt();
-@@ -2622,26 +2851,46 @@ void PdfParser::doImage(Object * /*ref*/
-     else {
-         goto err2;
-     }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj1.free();
-+#endif
-     
-     // image interpolation
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj1 = dict->lookup("Interpolate");
-+#else
-     dict->lookup("Interpolate", &obj1);
-+#endif
-     if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      obj1 = dict->lookup("I");
-+#else
-       obj1.free();
-       dict->lookup("I", &obj1);
-+#endif
-     }
-     if (obj1.isBool())
-       interpolate = obj1.getBool();
-     else
-       interpolate = gFalse;
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj1.free();
-+#endif
-     maskInterpolate = gFalse;
+   // handle a Type 3 char
+   if (font->getType() == fontType3 && 0) {//out->interpretType3Chars()) {
+@@ -2732,7 +2739,11 @@ void PdfParser::opXObject(Object args[],
+ {
+   Object obj1, obj2, obj3, refObj;
  
-     // image or mask?
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj1 = dict->lookup(const_cast<char*>("ImageMask"));
-+#else
-     dict->lookup(const_cast<char*>("ImageMask"), &obj1);
-+#endif
-     if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj1 = dict->lookup(const_cast<char*>("IM"));
-+#else
-         obj1.free();
-         dict->lookup(const_cast<char*>("IM"), &obj1);
-+#endif
-     }
-     mask = gFalse;
-     if (obj1.isBool()) {
-@@ -2650,14 +2899,24 @@ void PdfParser::doImage(Object * /*ref*/
-     else if (!obj1.isNull()) {
-         goto err2;
-     }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj1.free();
-+#endif
-     
-     // bit depth
-     if (bits == 0) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj1 = dict->lookup(const_cast<char*>("BitsPerComponent"));
-+#else
-         dict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
-+#endif
-         if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = dict->lookup(const_cast<char*>("BPC"));
-+#else
-             obj1.free();
-             dict->lookup(const_cast<char*>("BPC"), &obj1);
-+#endif
-         }
-         if (obj1.isInt()) {
-             bits = obj1.getInt();
-@@ -2666,7 +2925,9 @@ void PdfParser::doImage(Object * /*ref*/
-         } else {
-             goto err2;
-         }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         obj1.free();
-+#endif
-     }
-     
-     // display a mask
-@@ -2676,21 +2937,37 @@ void PdfParser::doImage(Object * /*ref*/
-             goto err1;
-         }
-         invert = gFalse;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj1 = dict->lookup(const_cast<char*>("Decode"));
-+#else
-         dict->lookup(const_cast<char*>("Decode"), &obj1);
-+#endif
-         if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = dict->lookup(const_cast<char*>("D"));
-+#else
-             obj1.free();
-             dict->lookup(const_cast<char*>("D"), &obj1);
-+#endif
-         }
-         if (obj1.isArray()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj2 = obj1.arrayGet(0);
-+#else
-             obj1.arrayGet(0, &obj2);
-+#endif
-             if (obj2.isInt() && obj2.getInt() == 1) {
-                 invert = gTrue;
-             }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-             obj2.free();
-+#endif
-         } else if (!obj1.isNull()) {
-             goto err2;
-         }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         obj1.free();
-+#endif
-         
-         // draw it
-         builder->addImageMask(state, str, width, height, invert, interpolate);
-@@ -2698,18 +2975,36 @@ void PdfParser::doImage(Object * /*ref*/
-     } else {
-         // get color space and color map
-         GfxColorSpace *colorSpace;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj1 = dict->lookup(const_cast<char*>("ColorSpace"));
-+#else
-         dict->lookup(const_cast<char*>("ColorSpace"), &obj1);
-+#endif
-         if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = dict->lookup(const_cast<char*>("CS"));
-+#else
-             obj1.free();
-             dict->lookup(const_cast<char*>("CS"), &obj1);
-+#endif
-         }
-         if (obj1.isName()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj2 = res->lookupColorSpace(obj1.getName());
++#if POPPLER_CHECK_VERSION(0,64,0)
++  const char *name = args[0].getName();
 +#else
-             res->lookupColorSpace(obj1.getName(), &obj2);
+   char *name = args[0].getName();
 +#endif
-             if (!obj2.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                    obj1 = std::move(obj2);
-+#else
-                   obj1.free();
-                   obj1 = obj2;
-+#endif
-             } else {
-+#if !defined(POPPLER_NEW_OBJECT_API)
-                   obj2.free();
-+#endif
-             }
-         }
-         if (!obj1.isNull()) {
-@@ -2729,17 +3024,29 @@ void PdfParser::doImage(Object * /*ref*/
-         } else {
-             colorSpace = NULL;
-         }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         obj1.free();
-+#endif
-         if (!colorSpace) {
-             goto err1;
-         }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        obj1 = dict->lookup(const_cast<char*>("Decode"));
-+#else
-         dict->lookup(const_cast<char*>("Decode"), &obj1);
-+#endif
-         if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = dict->lookup(const_cast<char*>("D"));
-+#else
-             obj1.free();
-             dict->lookup(const_cast<char*>("D"), &obj1);
-+#endif
-         }
-         GfxImageColorMap *colorMap = new GfxImageColorMap(bits, &obj1, colorSpace);
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         obj1.free();
-+#endif
-         if (!colorMap->isOk()) {
-             delete colorMap;
-             goto err1;
-@@ -2753,8 +3060,13 @@ void PdfParser::doImage(Object * /*ref*/
-         int maskHeight = 0;
-         maskInvert = gFalse;
-         GfxImageColorMap *maskColorMap = NULL;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+        maskObj = dict->lookup(const_cast<char*>("Mask"));
-+        smaskObj = dict->lookup(const_cast<char*>("SMask"));
-+#else
-         dict->lookup(const_cast<char*>("Mask"), &maskObj);
-         dict->lookup(const_cast<char*>("SMask"), &smaskObj);
-+#endif
-         Dict* maskDict;
-         if (smaskObj.isStream()) {
-             // soft mask
-@@ -2763,58 +3075,108 @@ void PdfParser::doImage(Object * /*ref*/
-             }
-             maskStr = smaskObj.getStream();
-             maskDict = smaskObj.streamGetDict();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("Width"));
-+#else
-             maskDict->lookup(const_cast<char*>("Width"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                  obj1 = maskDict->lookup(const_cast<char*>("W"));
-+#else
-                   obj1.free();
-                   maskDict->lookup(const_cast<char*>("W"), &obj1);
-+#endif
-             }
-             if (!obj1.isInt()) {
-                   goto err2;
-             }
-             maskWidth = obj1.getInt();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("Height"));
-+#else
-             obj1.free();
-             maskDict->lookup(const_cast<char*>("Height"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                    obj1 = maskDict->lookup(const_cast<char*>("H"));
-+#else
-                   obj1.free();
-                   maskDict->lookup(const_cast<char*>("H"), &obj1);
-+#endif
-             }
-             if (!obj1.isInt()) {
-                   goto err2;
-             }
-             maskHeight = obj1.getInt();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("BitsPerComponent"));
-+#else
-             obj1.free();
-             maskDict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                    obj1 = maskDict->lookup(const_cast<char*>("BPC"));
-+#else
-                   obj1.free();
-                   maskDict->lookup(const_cast<char*>("BPC"), &obj1);
-+#endif
-             }
-             if (!obj1.isInt()) {
-                   goto err2;
-             }
-             int maskBits = obj1.getInt();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("Interpolate"));
-+#else
-             obj1.free();
-           maskDict->lookup("Interpolate", &obj1);
-+#endif
-           if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+              obj1 = maskDict->lookup(const_cast<char*>("I"));
-+#else
-             obj1.free();
-             maskDict->lookup("I", &obj1);
-+#endif
-           }
-           if (obj1.isBool())
-             maskInterpolate = obj1.getBool();
-           else
-             maskInterpolate = gFalse;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("ColorSpace"));
-+#else
-           obj1.free();
-             maskDict->lookup(const_cast<char*>("ColorSpace"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                    obj1 = maskDict->lookup(const_cast<char*>("CS"));
-+#else
-                   obj1.free();
-                   maskDict->lookup(const_cast<char*>("CS"), &obj1);
-+#endif
-             }
-             if (obj1.isName()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                  obj2 = res->lookupColorSpace(obj1.getName());
-+#else
-                   res->lookupColorSpace(obj1.getName(), &obj2);
-+#endif
-                   if (!obj2.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                        obj1 = std::move(obj2);
-+#else
-                       obj1.free();
-                   obj1 = obj2;
-+#endif
-                   } else {
-+#if !defined(POPPLER_NEW_OBJECT_API)
-                       obj2.free();
-+#endif
-                   }
-             }
- #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
-@@ -2824,17 +3186,29 @@ void PdfParser::doImage(Object * /*ref*/
+ #if defined(POPPLER_NEW_OBJECT_API)
+   if ((obj1 = res->lookupXObject(name)).isNull()) {
  #else
-             GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
- #endif
-+#if !defined(POPPLER_NEW_OBJECT_API)
-             obj1.free();
-+#endif
-             if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
-                 goto err1;
-             }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("Decode"));
-+#else
-             maskDict->lookup(const_cast<char*>("Decode"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                obj1 = maskDict->lookup(const_cast<char*>("D"));
-+#else
-                   obj1.free();
-               maskDict->lookup(const_cast<char*>("D"), &obj1);
-+#endif
-             }
-             maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace);
-+#if !defined(POPPLER_NEW_OBJECT_API)
-             obj1.free();
-+#endif
-             if (!maskColorMap->isOk()) {
-                 delete maskColorMap;
-                 goto err1;
-@@ -2845,9 +3219,15 @@ void PdfParser::doImage(Object * /*ref*/
-             // color key mask
-             int i;
-             for (i = 0; i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                obj1 = maskObj.arrayGet(i);
-+#else
-                 maskObj.arrayGet(i, &obj1);
-+#endif
-                 maskColors[i] = obj1.getInt();
-+#if !defined(POPPLER_NEW_OBJECT_API)
-                 obj1.free();
-+#endif
-             }
-               haveColorKeyMask = gTrue;
-         } else if (maskObj.isStream()) {
-@@ -2857,61 +3237,111 @@ void PdfParser::doImage(Object * /*ref*/
-             }
-             maskStr = maskObj.getStream();
-             maskDict = maskObj.streamGetDict();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("Width"));
-+#else
-             maskDict->lookup(const_cast<char*>("Width"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                obj1 = maskDict->lookup(const_cast<char*>("W"));
-+#else
-                 obj1.free();
-                 maskDict->lookup(const_cast<char*>("W"), &obj1);
-+#endif
-             }
-             if (!obj1.isInt()) {
-                 goto err2;
-             }
-             maskWidth = obj1.getInt();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("Height"));
-+#else
-             obj1.free();
-             maskDict->lookup(const_cast<char*>("Height"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                obj1 = maskDict->lookup(const_cast<char*>("H"));
-+#else
-                 obj1.free();
-                 maskDict->lookup(const_cast<char*>("H"), &obj1);
-+#endif
-             }
-             if (!obj1.isInt()) {
-                 goto err2;
-             }
-             maskHeight = obj1.getInt();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("ImageMask"));
-+#else
-             obj1.free();
-             maskDict->lookup(const_cast<char*>("ImageMask"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                obj1 = maskDict->lookup(const_cast<char*>("IM"));
-+#else
-                 obj1.free();
-                 maskDict->lookup(const_cast<char*>("IM"), &obj1);
-+#endif
-             }
-             if (!obj1.isBool() || !obj1.getBool()) {
-                 goto err2;
-             }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup("Interpolate");
-+#else
-             obj1.free();
-           maskDict->lookup("Interpolate", &obj1);
-+#endif
-           if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup("I");
-+#else
-             obj1.free();
-             maskDict->lookup("I", &obj1);
-+#endif
-           }
-           if (obj1.isBool())
-             maskInterpolate = obj1.getBool();
-           else
-             maskInterpolate = gFalse;
-+#if !defined(POPPLER_NEW_OBJECT_API)
-           obj1.free();
-+#endif
-             maskInvert = gFalse;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+            obj1 = maskDict->lookup(const_cast<char*>("Decode"));
-+#else
-             maskDict->lookup(const_cast<char*>("Decode"), &obj1);
-+#endif
-             if (obj1.isNull()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                obj1 = maskDict->lookup(const_cast<char*>("D"));
-+#else
-                 obj1.free();
-                 maskDict->lookup(const_cast<char*>("D"), &obj1);
-+#endif
-             }
-             if (obj1.isArray()) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+                obj2 = obj1.arrayGet(0);
-+#else
-                 obj1.arrayGet(0, &obj2);
-+#endif
-                 if (obj2.isInt() && obj2.getInt() == 1) {
-                     maskInvert = gTrue;
-                 }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-                 obj2.free();
-+#endif
-             } else if (!obj1.isNull()) {
-                 goto err2;
-             }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-             obj1.free();
-+#endif
-             haveExplicitMask = gTrue;
-         }
-         
-@@ -2929,14 +3359,18 @@ void PdfParser::doImage(Object * /*ref*/
-         }
-         delete colorMap;
-         
-+#if !defined(POPPLER_NEW_OBJECT_API)
-         maskObj.free();
-         smaskObj.free();
-+#endif
-     }
- 
-     return;
- 
-  err2:
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj1.free();
-+#endif
-  err1:
-     error(errSyntaxError, getPos(), "Bad image parameters");
- }
-@@ -2961,52 +3395,97 @@ void PdfParser::doForm(Object *str) {
-   dict = str->streamGetDict();
- 
-   // check form type
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  obj1 = dict->lookup(const_cast<char*>("FormType"));
-+#else
-   dict->lookup(const_cast<char*>("FormType"), &obj1);
-+#endif
-   if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
-     error(errSyntaxError, getPos(), "Unknown form type");
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj1.free();
-+#endif
- 
-   // get bounding box
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  bboxObj = dict->lookup(const_cast<char*>("BBox"));
-+#else
-   dict->lookup(const_cast<char*>("BBox"), &bboxObj);
-+#endif
-   if (!bboxObj.isArray()) {
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     bboxObj.free();
-+#endif
-     error(errSyntaxError, getPos(), "Bad form bounding box");
-     return;
-   }
-   for (i = 0; i < 4; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    obj1 = bboxObj.arrayGet(i);
-+#else
-     bboxObj.arrayGet(i, &obj1);
-+#endif
-     bbox[i] = obj1.getNum();
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  }
-+#else
-     obj1.free();
-   }
-   bboxObj.free();
-+#endif
- 
-   // get matrix
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  matrixObj = dict->lookup(const_cast<char*>("Matrix"));
-+#else
-   dict->lookup(const_cast<char*>("Matrix"), &matrixObj);
-+#endif
-   if (matrixObj.isArray()) {
-     for (i = 0; i < 6; ++i) {
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      obj1 = matrixObj.arrayGet(i);
-+#else
-       matrixObj.arrayGet(i, &obj1);
-+#endif
-       m[i] = obj1.getNum();
-+#if !defined(POPPLER_NEW_OBJECT_API)
-       obj1.free();
-+#endif
-     }
-   } else {
-     m[0] = 1; m[1] = 0;
-     m[2] = 0; m[3] = 1;
-     m[4] = 0; m[5] = 0;
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   matrixObj.free();
-+#endif
- 
-   // get resources
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  resObj = dict->lookup(const_cast<char*>("Resources"));
-+#else
-   dict->lookup(const_cast<char*>("Resources"), &resObj);
-+#endif
-   resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL;
- 
-   // check for a transparency group
-   transpGroup = isolated = knockout = gFalse;
-   blendingColorSpace = NULL;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  if ((obj1 = dict->lookup(const_cast<char*>("Group"))).isDict()) {
-+    if ((obj2 = obj1.dictLookup(const_cast<char*>("S"))).isName(const_cast<char*>("Transparency"))) {
-+#else
-   if (dict->lookup(const_cast<char*>("Group"), &obj1)->isDict()) {
-     if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) {
-+#endif
-       transpGroup = gTrue;
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      if (!((obj3 = obj1.dictLookup(const_cast<char*>("CS"))).isNull())) {
-+#else
-       if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) {
-+#endif
- #if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
-       blendingColorSpace = GfxColorSpace::parse(NULL, &obj3, NULL, NULL);
- #elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
-@@ -3015,19 +3494,32 @@ void PdfParser::doForm(Object *str) {
-       blendingColorSpace = GfxColorSpace::parse(&obj3, NULL);
- #endif
-       }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      if ((obj3 = obj1.dictLookup(const_cast<char*>("I"))).isBool()) {
-+#else
-       obj3.free();
-       if (obj1.dictLookup(const_cast<char*>("I"), &obj3)->isBool()) {
-+#endif
-       isolated = obj3.getBool();
-       }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      if ((obj3 = obj1.dictLookup(const_cast<char*>("K"))).isBool()) {
-+#else
-       obj3.free();
-       if (obj1.dictLookup(const_cast<char*>("K"), &obj3)->isBool()) {
-+#endif
-       knockout = obj3.getBool();
-       }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+    }
-+  }
-+#else
-       obj3.free();
-     }
-     obj2.free();
-   }
-   obj1.free();
-+#endif
- 
-   // draw it
-   ++formDepth;
-@@ -3038,7 +3530,9 @@ void PdfParser::doForm(Object *str) {
-   if (blendingColorSpace) {
-     delete blendingColorSpace;
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   resObj.free();
-+#endif
- }
- 
- void PdfParser::doForm1(Object *str, Dict *resDict, double *matrix, double *bbox,
-@@ -3166,35 +3660,61 @@ Stream *PdfParser::buildImageStream() {
+@@ -3657,7 +3668,6 @@ void PdfParser::opBeginImage(Object /*ar
+ Stream *PdfParser::buildImageStream() {
+   Object dict;
+   Object obj;
+-  char *key;
    Stream *str;
  
    // build dictionary
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  dict = Object(new Dict(xref));
-+  obj = parser->getObj();
-+#else
-   dict.initDict(xref);
-   parser->getObj(&obj);
-+#endif
-   while (!obj.isCmd(const_cast<char*>("ID")) && !obj.isEOF()) {
-     if (!obj.isName()) {
-       error(errSyntaxError, getPos(), "Inline image dictionary key must be a name object");
-+#if !defined(POPPLER_NEW_OBJECT_API)
+@@ -3675,26 +3685,17 @@ Stream *PdfParser::buildImageStream() {
        obj.free();
-+#endif
+ #endif
      } else {
-       key = copyString(obj.getName());
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      obj = parser->getObj();
-+#else
-       obj.free();
-       parser->getObj(&obj);
-+#endif
-       if (obj.isEOF() || obj.isError()) {
-       gfree(key);
+-      key = copyString(obj.getName());
+-#if defined(POPPLER_NEW_OBJECT_API)
+-      obj = parser->getObj();
+-#else
+-      obj.free();
+-      parser->getObj(&obj);
+-#endif
+-      if (obj.isEOF() || obj.isError()) {
+-      gfree(key);
++      Object obj2;
++      _POPPLER_CALL(obj2, parser->getObj);
++      if (obj2.isEOF() || obj2.isError()) {
++        _POPPLER_FREE(obj);
        break;
        }
-+#if defined(POPPLER_NEW_OBJECT_API)
-+      dict.dictAdd(key, std::move(obj));
-+    }
-+    obj = parser->getObj();
-+#else
-       dict.dictAdd(key, &obj);
-     }
-     parser->getObj(&obj);
-+#endif
+-#if defined(POPPLER_NEW_OBJECT_API)
+-      dict.dictAdd(key, std::move(obj));
+-    }
+-    obj = parser->getObj();
+-#else
+-      dict.dictAdd(key, &obj);
++      _POPPLER_DICTADD(dict, obj.getName(), obj2);
++      _POPPLER_FREE(obj);
++      _POPPLER_FREE(obj2);
+     }
+-    parser->getObj(&obj);
+-#endif
++    _POPPLER_CALL(obj, parser->getObj);
    }
    if (obj.isEOF()) {
      error(errSyntaxError, getPos(), "End of file in inline image");
-+#if !defined(POPPLER_NEW_OBJECT_API)
-     obj.free();
-     dict.free();
-+#endif
-     return NULL;
-   }
-+#if !defined(POPPLER_NEW_OBJECT_API)
-   obj.free();
-+#endif
- 
-   // make stream
-+#if defined(POPPLER_NEW_OBJECT_API)
-+  str = new EmbedStream(parser->getStream(), dict.copy(), gFalse, 0);
-+  str = str->addFilters(dict.getDict());
-+#else
-   str = new EmbedStream(parser->getStream(), &dict, gFalse, 0);
-   str = str->addFilters(&dict);
-+#endif
- 
-   return str;
- }

Index: pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.h
diff -u pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.h:1.3 pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.h:1.4
--- pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.h:1.3     Fri Dec 21 08:46:16 2018
+++ pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser.h Sun Jan  6 08:41:01 2019
@@ -1,27 +1,74 @@
-$NetBSD: patch-src_extension_internal_pdfinput_pdf-parser.h,v 1.3 2018/12/21 08:46:16 wiz Exp $
+$NetBSD: patch-src_extension_internal_pdfinput_pdf-parser.h,v 1.4 2019/01/06 08:41:01 markd Exp $
 
 Explicitly include poppler/Object.h; otherwise Python's Object.h gets included.
+Support for poppler 0.72 from upstream by way of linuxfromscratch 
 
---- src/extension/internal/pdfinput/pdf-parser.h.orig  2017-08-06 20:44:00.000000000 +0000
+--- src/extension/internal/pdfinput/pdf-parser.h.orig  2018-03-11 20:38:09.000000000 +0000
 +++ src/extension/internal/pdfinput/pdf-parser.h
-@@ -25,8 +25,18 @@ namespace Inkscape {
+@@ -9,6 +9,7 @@
+ #define PDF_PARSER_H
+ 
+ #ifdef HAVE_POPPLER
++#include "poppler-transition-api.h"
+ 
+ #ifdef USE_GCC_PRAGMAS
+ #pragma interface
+@@ -25,8 +26,9 @@ namespace Inkscape {
  // TODO clean up and remove using:
  using Inkscape::Extension::Internal::SvgBuilder;
  
--#include "goo/gtypes.h"
++#include "glib/poppler-features.h"
+ #include "goo/gtypes.h"
 -#include "Object.h"
 +#include "poppler/Object.h"
-+
-+// poppler 0.72
-+#define getCString c_str
-+
-+// poppler 0.71
-+typedef bool GBool;
-+#define gTrue true
-+#define gFalse false  
-+
-+// poppler 0.70
-+#define _POPPLER_CONST const
  
  class GooString;
  class XRef;
+@@ -127,11 +129,14 @@ public:
+ 
+   // Constructor for regular output.
+   PdfParser(XRef *xrefA, SvgBuilder *builderA, int pageNum, int rotate,
+-            Dict *resDict, PDFRectangle *box, PDFRectangle *cropBox);
++            Dict *resDict,
++            _POPPLER_CONST PDFRectangle *box,
++            _POPPLER_CONST PDFRectangle *cropBox);
+ 
+   // Constructor for a sub-page object.
+   PdfParser(XRef *xrefA, Inkscape::Extension::Internal::SvgBuilder *builderA,
+-            Dict *resDict, PDFRectangle *box);
++            Dict *resDict,
++            _POPPLER_CONST PDFRectangle *box);
+ 
+   virtual ~PdfParser();
+ 
+@@ -185,7 +190,7 @@ private:
+ 
+   void go(GBool topLevel);
+   void execOp(Object *cmd, Object args[], int numArgs);
+-  PdfOperator *findOp(char *name);
++  PdfOperator *findOp(const char *name);
+   GBool checkArg(Object *arg, TchkType type);
+   int getPos();
+ 
+@@ -256,7 +261,7 @@ private:
+                          double x2, double y2, GfxColor *color2,
+                          int nComps, int depth);
+   void doPatchMeshShFill(GfxPatchMeshShading *shading);
+-  void fillPatch(GfxPatch *patch, int nComps, int depth);
++  void fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth);
+   void doEndPath();
+ 
+   // path clipping operators
+@@ -287,7 +292,12 @@ private:
+   void opMoveShowText(Object args[], int numArgs);
+   void opMoveSetShowText(Object args[], int numArgs);
+   void opShowSpaceText(Object args[], int numArgs);
++#if POPPLER_CHECK_VERSION(0,64,0)
++  void doShowText(const GooString *s);
++#else
+   void doShowText(GooString *s);
++#endif
++  
+ 
+   // XObject operators
+   void opXObject(Object args[], int numArgs);

Added files:

Index: pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.h
diff -u /dev/null pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.h:1.1
--- /dev/null   Sun Jan  6 08:41:01 2019
+++ pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-input.h  Sun Jan  6 08:41:01 2019
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_extension_internal_pdfinput_pdf-input.h,v 1.1 2019/01/06 08:41:01 markd Exp $
+
+support for poppler 0.72 from upstream by way of linuxfromscratch 
+
+--- src/extension/internal/pdfinput/pdf-input.h.orig   2018-03-11 20:38:09.000000000 +0000
++++ src/extension/internal/pdfinput/pdf-input.h
+@@ -15,6 +15,7 @@
+ #endif
+ 
+ #ifdef HAVE_POPPLER
++#include "poppler-transition-api.h"
+ 
+ #include <gtkmm/dialog.h>
+ 
Index: pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_poppler-transition-api.h
diff -u /dev/null pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_poppler-transition-api.h:1.1
--- /dev/null   Sun Jan  6 08:41:01 2019
+++ pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_poppler-transition-api.h     Sun Jan  6 08:41:01 2019
@@ -0,0 +1,50 @@
+$NetBSD: patch-src_extension_internal_pdfinput_poppler-transition-api.h,v 1.1 2019/01/06 08:41:01 markd Exp $
+
+support for poppler 0.72 from upstream by way of linuxfromscratch 
+
+--- /dev/null  2018-11-05 02:51:29.413333349 +0000
++++ src/extension/internal/pdfinput/poppler-transition-api.h
+@@ -0,0 +1,43 @@
++#ifndef SEEN_POPPLER_TRANSITION_API_H
++#define SEEN_POPPLER_TRANSITION_API_H
++
++#include <glib/poppler-features.h>
++
++#if POPPLER_CHECK_VERSION(0,72,0)
++#define getCString c_str
++#endif
++
++#if POPPLER_CHECK_VERSION(0,70,0)
++#define _POPPLER_CONST const
++#else
++#define _POPPLER_CONST
++#endif
++
++#if POPPLER_CHECK_VERSION(0,69,0)
++#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(key, std::move(obj))
++#elif POPPLER_CHECK_VERSION(0,58,0)
++#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), std::move(obj))
++#else
++#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), &obj)
++#endif
++
++#if POPPLER_CHECK_VERSION(0,58,0)
++#define POPPLER_NEW_OBJECT_API
++#define _POPPLER_FREE(obj)
++#define _POPPLER_CALL(ret, func) (ret = func())
++#define _POPPLER_CALL_ARGS(ret, func, ...) (ret = func(__VA_ARGS__))
++#else
++#define _POPPLER_FREE(obj) (obj).free()
++#define _POPPLER_CALL(ret, func) (*func(&ret))
++#define _POPPLER_CALL_ARGS(ret, func, ...) (*func(__VA_ARGS__, &ret))
++#endif
++
++#if POPPLER_CHECK_VERSION(0, 29, 0)
++#define POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API
++#endif
++
++#if POPPLER_CHECK_VERSION(0, 25, 0)
++#define POPPLER_EVEN_NEWER_COLOR_SPACE_API
++#endif
++
++#endif
Index: pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.h
diff -u /dev/null pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.h:1.1
--- /dev/null   Sun Jan  6 08:41:01 2019
+++ pkgsrc/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_svg-builder.h        Sun Jan  6 08:41:01 2019
@@ -0,0 +1,58 @@
+$NetBSD: patch-src_extension_internal_pdfinput_svg-builder.h,v 1.1 2019/01/06 08:41:01 markd Exp $
+
+support for poppler 0.72 from upstream by way of linuxfromscratch 
+
+--- src/extension/internal/pdfinput/svg-builder.h.orig 2018-03-11 20:38:09.000000000 +0000
++++ src/extension/internal/pdfinput/svg-builder.h
+@@ -15,6 +15,7 @@
+ #endif
+ 
+ #ifdef HAVE_POPPLER
++#include "poppler-transition-api.h"
+ 
+ class SPDocument;
+ namespace Inkscape {
+@@ -29,7 +30,6 @@ namespace Inkscape {
+ #include <glibmm/ustring.h>
+ 
+ #include "CharTypes.h"
+-class GooString;
+ class Function;
+ class GfxState;
+ struct GfxColor;
+@@ -81,7 +81,7 @@ struct SvgGlyph {
+     bool style_changed;  // Set to true if style has to be reset
+     SPCSSAttr *style;
+     int render_mode;    // Text render mode
+-    char *font_specification;   // Pointer to current font specification
++    const char *font_specification;   // Pointer to current font specification
+ };
+ 
+ /**
+@@ -136,7 +136,7 @@ public:
+     void clearSoftMask(GfxState *state);
+ 
+     // Text handling
+-    void beginString(GfxState *state, GooString *s);
++    void beginString(GfxState *state);
+     void endString(GfxState *state);
+     void addChar(GfxState *state, double x, double y,
+                  double dx, double dy,
+@@ -175,7 +175,7 @@ private:
+     void _addStopToGradient(Inkscape::XML::Node *gradient, double offset,
+                             GfxRGB *color, double opacity);
+     bool _addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading,
+-                           Function *func);
++                           _POPPLER_CONST Function *func);
+     gchar *_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxState *state,
+                                 bool is_stroke=false);
+     // Image/mask creation
+@@ -203,7 +203,7 @@ private:
+ 
+     SPCSSAttr *_font_style;          // Current font style
+     GfxFont *_current_font;
+-    char *_font_specification;
++    const char *_font_specification;
+     double _font_scaling;
+     bool _need_font_update;
+     Geom::Affine _text_matrix;



Home | Main Index | Thread Index | Old Index