From 66588e866978865e82a41a9bd478c94b2c41e878 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 16 Dec 2016 00:40:18 +0000 Subject: poppler 0.50.0 git-svn-id: svn://tug.org/texlive/trunk@42718 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/poppler/ChangeLog | 5 + Build/source/libs/poppler/configure | 22 +- .../source/libs/poppler/poppler-PATCHES/ChangeLog | 6 + .../source/libs/poppler/poppler-PATCHES/TL-Changes | 2 +- .../poppler/poppler-PATCHES/patch-02-LLONG_MAX | 6 +- .../poppler-PATCHES/patch-03-Object-functions | 6 +- .../source/libs/poppler/poppler-src/CMakeLists.txt | 20 +- Build/source/libs/poppler/poppler-src/ChangeLog | 318 +++++++++++++++++++++ Build/source/libs/poppler/poppler-src/NEWS | 25 ++ Build/source/libs/poppler/poppler-src/configure.ac | 33 +-- .../libs/poppler/poppler-src/fofi/FoFiEncodings.cc | 18 +- .../libs/poppler/poppler-src/fofi/FoFiEncodings.h | 18 +- .../libs/poppler/poppler-src/fofi/FoFiTrueType.cc | 13 +- .../libs/poppler/poppler-src/fofi/FoFiTrueType.h | 2 + .../poppler/poppler-src/poppler/CairoOutputDev.cc | 1 + .../libs/poppler/poppler-src/poppler/GfxState.cc | 8 +- .../libs/poppler/poppler-src/poppler/Hints.cc | 24 +- .../libs/poppler/poppler-src/poppler/Hints.h | 1 - .../libs/poppler/poppler-src/poppler/Makefile.am | 2 +- .../libs/poppler/poppler-src/poppler/Outline.cc | 18 +- .../libs/poppler/poppler-src/poppler/Outline.h | 4 +- .../libs/poppler/poppler-src/poppler/PDFDoc.cc | 4 +- .../poppler/poppler-src/poppler/PSOutputDev.cc | 64 +++-- .../libs/poppler/poppler-src/poppler/PSOutputDev.h | 6 + .../poppler/poppler-src/poppler/SplashOutputDev.cc | 18 +- .../poppler/poppler-src/splash/SplashBitmap.cc | 93 ++++-- .../libs/poppler/poppler-src/splash/SplashBitmap.h | 3 +- Build/source/libs/poppler/version.ac | 2 +- 28 files changed, 612 insertions(+), 130 deletions(-) diff --git a/Build/source/libs/poppler/ChangeLog b/Build/source/libs/poppler/ChangeLog index ef369431471..7faeddaa623 100644 --- a/Build/source/libs/poppler/ChangeLog +++ b/Build/source/libs/poppler/ChangeLog @@ -1,3 +1,8 @@ +2016-12-16 Akira Kakuto + + Import poppler-0.50.0. + * version.ac: Adjust. + 2016-11-15 Akira Kakuto Import poppler-0.49.0. diff --git a/Build/source/libs/poppler/configure b/Build/source/libs/poppler/configure index b8bd430c9c0..488421b4fe4 100755 --- a/Build/source/libs/poppler/configure +++ b/Build/source/libs/poppler/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.49.0. +# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.50.0. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='poppler (TeX Live)' PACKAGE_TARNAME='poppler--tex-live-' -PACKAGE_VERSION='0.49.0' -PACKAGE_STRING='poppler (TeX Live) 0.49.0' +PACKAGE_VERSION='0.50.0' +PACKAGE_STRING='poppler (TeX Live) 0.50.0' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1306,7 +1306,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures poppler (TeX Live) 0.49.0 to adapt to many kinds of systems. +\`configure' configures poppler (TeX Live) 0.50.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1373,7 +1373,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of poppler (TeX Live) 0.49.0:";; + short | recursive ) echo "Configuration of poppler (TeX Live) 0.50.0:";; esac cat <<\_ACEOF @@ -1486,7 +1486,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -poppler (TeX Live) configure 0.49.0 +poppler (TeX Live) configure 0.50.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2076,7 +2076,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by poppler (TeX Live) $as_me 0.49.0, which was +It was created by poppler (TeX Live) $as_me 0.50.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3999,7 +3999,7 @@ fi # Define the identity of the package. PACKAGE='poppler--tex-live-' - VERSION='0.49.0' + VERSION='0.50.0' # Some tools Automake needs. @@ -6578,7 +6578,7 @@ ac_config_headers="$ac_config_headers poppler-config.h:poppler-src/poppler/poppl cat >>confdefs.h <<_ACEOF -#define POPPLER_VERSION "0.49.0" +#define POPPLER_VERSION "0.50.0" _ACEOF @@ -7272,7 +7272,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by poppler (TeX Live) $as_me 0.49.0, which was +This file was extended by poppler (TeX Live) $as_me 0.50.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7338,7 +7338,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -poppler (TeX Live) config.status 0.49.0 +poppler (TeX Live) config.status 0.50.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/poppler/poppler-PATCHES/ChangeLog b/Build/source/libs/poppler/poppler-PATCHES/ChangeLog index df348b0bb1c..8fa00acfe44 100644 --- a/Build/source/libs/poppler/poppler-PATCHES/ChangeLog +++ b/Build/source/libs/poppler/poppler-PATCHES/ChangeLog @@ -1,3 +1,9 @@ +2016-12-16 Akira Kakuto + + Imported poppler-0.50.0 source tree from: + http://poppler.freedesktop.org/ + * patch-02-LLONG_MAX, patch-03-Object-functions: Adapted. + 2016-11-15 Akira Kakuto Imported poppler-0.49.0 source tree from: diff --git a/Build/source/libs/poppler/poppler-PATCHES/TL-Changes b/Build/source/libs/poppler/poppler-PATCHES/TL-Changes index 50d72821437..6884714fb18 100644 --- a/Build/source/libs/poppler/poppler-PATCHES/TL-Changes +++ b/Build/source/libs/poppler/poppler-PATCHES/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the poppler-0.49.0 tree as obtained from: +Changes applied to the poppler-0.50.0 tree as obtained from: http://poppler.freedesktop.org/ Removed: diff --git a/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX b/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX index c8db4bf3278..018c7b56736 100644 --- a/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX +++ b/Build/source/libs/poppler/poppler-PATCHES/patch-02-LLONG_MAX @@ -1,6 +1,6 @@ -diff -ur poppler-0.49.0.orig/goo/GooString.h poppler-0.49.0/goo/GooString.h ---- poppler-0.49.0.orig/goo/GooString.h Mon Oct 24 06:01:46 2016 -+++ poppler-0.49.0/goo/GooString.h Tue Nov 15 17:03:25 2016 +diff -ur poppler-0.50.0.orig/goo/GooString.h poppler-0.50.0/goo/GooString.h +--- poppler-0.50.0.orig/goo/GooString.h Fri Dec 16 04:08:06 2016 ++++ poppler-0.50.0/goo/GooString.h Fri Dec 16 09:22:03 2016 @@ -36,6 +36,21 @@ #endif diff --git a/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions b/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions index ffc0644f9d7..d662823e608 100644 --- a/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions +++ b/Build/source/libs/poppler/poppler-PATCHES/patch-03-Object-functions @@ -1,6 +1,6 @@ -diff -ur poppler-0.49.0.orig/poppler/Object.h poppler-0.49.0/poppler/Object.h ---- poppler-0.49.0.orig/poppler/Object.h Mon Oct 24 02:08:37 2016 -+++ poppler-0.49.0/poppler/Object.h Tue Nov 15 17:06:39 2016 +diff -ur poppler-0.50.0.orig/poppler/Object.h poppler-0.50.0/poppler/Object.h +--- poppler-0.50.0.orig/poppler/Object.h Fri Dec 16 04:08:06 2016 ++++ poppler-0.50.0/poppler/Object.h Fri Dec 16 09:24:54 2016 @@ -148,7 +148,7 @@ Object *initStream(Stream *streamA); Object *initRef(int numA, int genA) diff --git a/Build/source/libs/poppler/poppler-src/CMakeLists.txt b/Build/source/libs/poppler/poppler-src/CMakeLists.txt index c25e961f878..54294e12828 100644 --- a/Build/source/libs/poppler/poppler-src/CMakeLists.txt +++ b/Build/source/libs/poppler/poppler-src/CMakeLists.txt @@ -22,7 +22,7 @@ if (ECM_FOUND) endif() set(POPPLER_MAJOR_VERSION "0") -set(POPPLER_MINOR_VERSION "49") +set(POPPLER_MINOR_VERSION "50") set(POPPLER_MICRO_VERSION "0") set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}") @@ -168,13 +168,13 @@ set(USE_OPENJPEG1 FALSE) set(USE_OPENJPEG2 FALSE) set(WITH_OPENJPEG FALSE) if(ENABLE_LIBOPENJPEG STREQUAL "auto") - find_package(LIBOPENJPEG) - set(USE_OPENJPEG1 ${LIBOPENJPEG_FOUND}) - set(WITH_OPENJPEG ${LIBOPENJPEG_FOUND}) - if(NOT LIBOPENJPEG_FOUND) - find_package(LIBOPENJPEG2) - set(USE_OPENJPEG2 ${LIBOPENJPEG2_FOUND}) - set(WITH_OPENJPEG ${LIBOPENJPEG2_FOUND}) + find_package(LIBOPENJPEG2) + set(USE_OPENJPEG2 ${LIBOPENJPEG2_FOUND}) + set(WITH_OPENJPEG ${LIBOPENJPEG2_FOUND}) + if(NOT LIBOPENJPEG2_FOUND) + find_package(LIBOPENJPEG) + set(USE_OPENJPEG1 ${LIBOPENJPEG_FOUND}) + set(WITH_OPENJPEG ${LIBOPENJPEG_FOUND}) endif() elseif(ENABLE_LIBOPENJPEG STREQUAL "openjpeg1") find_package(LIBOPENJPEG) @@ -502,7 +502,7 @@ add_library(poppler STATIC ${poppler_SRCS}) else(MSVC) add_library(poppler SHARED ${poppler_SRCS}) endif(MSVC) -set_target_properties(poppler PROPERTIES VERSION 65.0.0 SOVERSION 65) +set_target_properties(poppler PROPERTIES VERSION 66.0.0 SOVERSION 66) target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS}) install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}) @@ -779,5 +779,5 @@ if(ENABLE_ZLIB_UNCOMPRESS) endif(ENABLE_ZLIB_UNCOMPRESS) if(NOT WITH_OPENJPEG) - message("Warning: Using libopenjpeg is recommended. The internal JPX decoder is unmaintained.") + message("Warning: Using libopenjpeg2 is recommended. The internal JPX decoder is unmaintained.") endif(NOT WITH_OPENJPEG) diff --git a/Build/source/libs/poppler/poppler-src/ChangeLog b/Build/source/libs/poppler/poppler-src/ChangeLog index a71866b290d..65f10f3facd 100644 --- a/Build/source/libs/poppler/poppler-src/ChangeLog +++ b/Build/source/libs/poppler/poppler-src/ChangeLog @@ -1,3 +1,321 @@ +commit 281f3a2ec4be515a8876a66575341f404a6a0208 +Author: Albert Astals Cid +Date: Thu Dec 15 23:32:41 2016 +0100 + + Poppler 0.50 + + CMakeLists.txt | 4 ++-- + NEWS | 25 +++++++++++++++++++++++++ + configure.ac | 2 +- + cpp/Doxyfile | 2 +- + poppler/Makefile.am | 2 +- + qt4/src/CMakeLists.txt | 2 +- + qt4/src/Doxyfile | 2 +- + qt4/src/Makefile.am | 2 +- + qt5/src/CMakeLists.txt | 2 +- + qt5/src/Doxyfile | 2 +- + qt5/src/Makefile.am | 2 +- + 11 files changed, 36 insertions(+), 11 deletions(-) + +commit 1511523450f40b539fb1d58950a907f3712fd5c7 +Author: Albert Astals Cid +Date: Thu Dec 15 22:04:04 2016 +0100 + + Refine previous fix a bit + + Call GfxColorSpace::setupColorProfiles only when we really need it + + poppler/GfxState.cc | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +commit 9b016440725de086fa87fcbf776e27acee2c01b7 +Author: Marek Kasik +Date: Wed Sep 21 12:28:16 2016 +0200 + + Don't crash when calling cmsGetColorSpace() + + Initialize RGBProfile and displayProfile before their use + if they were not initialized in GfxState's constructor. + + https://bugs.freedesktop.org/show_bug.cgi?id=97870 + + poppler/GfxState.cc | 2 ++ + 1 file changed, 2 insertions(+) + +commit 8321b400adf6c042cd630ceea7f54fcf6862211d +Author: Albert Astals Cid +Date: Thu Dec 15 18:02:30 2016 +0100 + + Add one more const + + Makes clang happier (i.e. gives one warning less) + + fofi/FoFiEncodings.cc | 18 ++++++++++++++++-- + fofi/FoFiEncodings.h | 18 ++++++++++++++++-- + 2 files changed, 32 insertions(+), 4 deletions(-) + +commit 1a6e4b65197391b23c2163b939d4787f2058a2e1 +Author: Jason Crain +Date: Wed Dec 7 09:28:58 2016 -0600 + + cairo: initialize CairoOutputDev::antialias + + Initialize CairoOutputDev::antialias to CAIRO_ANTIALIAS_DEFAULT. + + Bug #98983 + + poppler/CairoOutputDev.cc | 1 + + 1 file changed, 1 insertion(+) + +commit 2cf901c817fc99e1fa57745c11aa79cdfb4e8c99 +Author: William Bader +Date: Thu Dec 8 21:45:18 2016 +0100 + + Fix PS conversion for some files + + Bug #63963 + + fofi/FoFiTrueType.cc | 13 ++++++++++++- + fofi/FoFiTrueType.h | 2 ++ + poppler/PSOutputDev.cc | 26 ++++++++++++++++++++++++++ + poppler/PSOutputDev.h | 1 + + 4 files changed, 41 insertions(+), 1 deletion(-) + +commit 97b801b55b9bd33f20723c7139cf845a1cba5bd3 +Author: Albert Astals Cid +Date: Wed Dec 7 22:52:24 2016 +0100 + + Remove useless include + + utils/pdftohtml.cc | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +commit 7ac94c8f552f0db13334d4d014cfdb54de72c451 +Author: Albert Astals Cid +Date: Wed Dec 7 22:38:48 2016 +0100 + + nSharedGroups doesn't need to be a class member + + And also mark some variables as const to make it easier to see they + don't change + + poppler/Hints.cc | 20 +++++++------------- + poppler/Hints.h | 1 - + 2 files changed, 7 insertions(+), 14 deletions(-) + +commit 4c4b913802c79eb8bf9c0ce72a08842851f1c5bc +Author: Jeffrey Morlan +Date: Wed Dec 7 22:36:26 2016 +0100 + + Bail out if nBitsNumObjects or nBitsDiffGroupLength are greater + than 32 + + Bug #94941 + + poppler/Hints.cc | 6 ++++++ + 1 file changed, 6 insertions(+) + +commit 21cd08e34bd317b2ecc7c8b4e0d122d85bdf6714 +Author: Albert Astals Cid +Date: Sat Dec 3 02:18:58 2016 +0100 + + Default to libopenjpeg2 instead of libopenjpeg1 + + Tested 2.1.1 and it's better or equal than the old libopenjpeg1 + + I thought of doing a version check but i don't think it's common + someone will be building a new poppler with an old libopenjpeg2 + + CMakeLists.txt | 16 ++++++++-------- + configure.ac | 31 ++++++++++++++++--------------- + 2 files changed, 24 insertions(+), 23 deletions(-) + +commit b5f3e935c3a1f4824fcd681e291c35852966bb45 +Author: Albert Astals Cid +Date: Fri Dec 2 00:09:38 2016 +0100 + + Revert "introduced hex string as a new Object type and used it for + file identifier" + + This reverts commit debd1361f4a4cb7811677ab7a8f241b8b6fca5f9. + + poppler/Lexer.cc | 3 +-- + poppler/Object.cc | 15 ++------------- + poppler/Object.h | 16 +++------------- + poppler/PDFDoc.cc | 10 ---------- + 4 files changed, 6 insertions(+), 38 deletions(-) + +commit 3a260ba8b3db99b4c0a956cc615704168db30e56 +Author: Albert Astals Cid +Date: Fri Dec 2 00:09:31 2016 +0100 + + Revert "treat file identifier as a hex string, not a basic string" + + This reverts commit 628299bc02ef825609e1ade539f967bbf052be0c. + + poppler/PDFDoc.cc | 12 ++++++------ + poppler/PSOutputDev.cc | 5 ++--- + poppler/SecurityHandler.cc | 3 +-- + poppler/StructElement.cc | 5 ++--- + 4 files changed, 11 insertions(+), 14 deletions(-) + +commit 42ef2ac51543fabb5f5f5c3a19c79020d4fb1238 +Author: Thomas Freitag +Date: Wed Nov 30 00:14:46 2016 +0100 + + Read softmask into memstrean in case of matte + + In case of matte the softmask has to be read twice. This is not + possible when read from stdin. So this patch allocate a memstream + first and read the softmask into this memstream. + + Bug #97803 + + poppler/SplashOutputDev.cc | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +commit c448e16dc4f2f3c55b06e3f1e098f45f8abacc18 +Author: William Bader +Date: Wed Nov 30 00:00:15 2016 +0100 + + patch to add -passlevel1customcolor + + Bug #97193 + + poppler/PSOutputDev.cc | 38 ++++++++++++++++---------------------- + poppler/PSOutputDev.h | 5 +++++ + utils/pdftops.cc | 6 +++++- + 3 files changed, 26 insertions(+), 23 deletions(-) + +commit 628299bc02ef825609e1ade539f967bbf052be0c +Author: Jakub Alba +Date: Sun Jul 24 22:46:23 2016 +0200 + + treat file identifier as a hex string, not a basic string + + poppler/PDFDoc.cc | 12 ++++++------ + poppler/PSOutputDev.cc | 5 +++-- + poppler/SecurityHandler.cc | 3 ++- + poppler/StructElement.cc | 5 +++-- + 4 files changed, 14 insertions(+), 11 deletions(-) + +commit debd1361f4a4cb7811677ab7a8f241b8b6fca5f9 +Author: Jakub Alba +Date: Sun Jul 24 22:30:30 2016 +0200 + + introduced hex string as a new Object type and used it for file + identifier + + File identifiers are usually written as hex strings (and this is + how the PDF + reference presents them in an example). Until now, poppler was + reading hex + strings properly, but was forgeting about the fact that a given + string is a hex + string, so e.g. file identifier was first read as a hex string and + then printed as + an ordinary string and thanks to that what was printed was actually + junk. This + commit fixes that. + + poppler/Lexer.cc | 3 ++- + poppler/Object.cc | 15 +++++++++++++-- + poppler/Object.h | 16 +++++++++++++--- + poppler/PDFDoc.cc | 10 ++++++++++ + 4 files changed, 38 insertions(+), 6 deletions(-) + +commit 484d9d46e8995f12ce941be1e080e98e2ff4b95d +Author: Albert Astals Cid +Date: Fri Nov 25 20:05:19 2016 +0100 + + Spelling fixes spotted by William Bader + + qt4/src/poppler-optcontent.h | 2 +- + qt5/src/poppler-optcontent.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit bc11784e143d462d62d3f63fc61e58b4b9640da7 +Author: Albert Astals Cid +Date: Fri Nov 25 17:42:27 2016 +0100 + + Qt: Support OCG state change links + + qt4/src/poppler-link-private.h | 57 +++++++++++++++++++ + qt4/src/poppler-link.cc | 33 +++++------ + qt4/src/poppler-link.h | 34 +++++++++++- + qt4/src/poppler-optcontent-private.h | 3 +- + qt4/src/poppler-optcontent.cc | 103 + +++++++++++++++++++++++------------ + qt4/src/poppler-optcontent.h | 8 +++ + qt4/src/poppler-page.cc | 11 +++- + qt5/src/poppler-link-private.h | 57 +++++++++++++++++++ + qt5/src/poppler-link.cc | 33 +++++------ + qt5/src/poppler-link.h | 34 +++++++++++- + qt5/src/poppler-optcontent-private.h | 3 +- + qt5/src/poppler-optcontent.cc | 103 + +++++++++++++++++++++++------------ + qt5/src/poppler-optcontent.h | 8 +++ + qt5/src/poppler-page.cc | 11 +++- + 14 files changed, 382 insertions(+), 116 deletions(-) + +commit b4e93c374deaaf31121a666c987a35bc9554beb3 +Author: Kenji Uno +Date: Thu Nov 3 10:19:06 2016 +0900 + + Fix pdftoppm -tiff -gray/-mono incorrect output. + + - SplashBitmap has imageWriterFormat that ImgWriter + should accept. + + splash/SplashBitmap.cc | 93 + +++++++++++++++++++++++++++++++++++++------------- + splash/SplashBitmap.h | 3 +- + 2 files changed, 71 insertions(+), 25 deletions(-) + +commit 5a04becc4940b926744e64d3b7d0355adcabf282 +Author: Jakub Alba +Date: Fri Jun 17 13:41:39 2016 +0200 + + Fix PDFDoc::saveIncrementalUpdate()'s detection of document being + modified + + Bug 96561 + + poppler/PDFDoc.cc | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +commit 0c9c2089f52de5bb08717518c439fa8bbb99011f +Author: Albert Astals Cid +Date: Wed Nov 23 20:22:17 2016 +0100 + + Fix Outline parsing on broken documents + + Broken documents in which the parent "Last" pointer is earlier than + the siblings "Next" pointer + + This mimics Adobe Reader behaviour. + + Bug #98732 + + poppler/Outline.cc | 18 ++++-------------- + poppler/Outline.h | 4 ++-- + 2 files changed, 6 insertions(+), 16 deletions(-) + +commit e59cbaf9c1ab4a575633ee3263244e03c6d21713 +Author: Jason Crain +Date: Fri Nov 18 15:44:29 2016 -0600 + + glib: Use g_slice_new0 for PopplerActionLayer + + PDFs using PopplerActionLayer will sometimes crash because they are + allocated with g_new0 but freed with g_slice_free. Change the + allocation to use g_slice_new0. + + Bug #98786 + + glib/poppler-action.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 02e2d8e2c3004c36d1f8f798e5a7a30166f48f37 Author: Albert Astals Cid Date: Tue Nov 15 00:10:43 2016 +0100 diff --git a/Build/source/libs/poppler/poppler-src/NEWS b/Build/source/libs/poppler/poppler-src/NEWS index 619d7f40558..bc92685f668 100644 --- a/Build/source/libs/poppler/poppler-src/NEWS +++ b/Build/source/libs/poppler/poppler-src/NEWS @@ -1,3 +1,28 @@ +Release 0.50.0 + core: + * PSOutputDev: Fix PS conversion for some files. Bug #63963 + * Fix Outline parsing on broken documents. Bug #98732 + * Fix PDFDoc::saveIncrementalUpdate()'s detection of document being modified. Bug #96561 + * SplashOutputDev: Read softmask into memstrean in case of matte. Bug #97803 + * Bail out if Hints nBitsNumObjects or nBitsDiffGroupLength are greater than 32. Bug #94941 + * CairoOutputDev: initialize CairoOutputDev::antialias. Bug #98983 + * Fix crash when loading some thumbnails. Bug #97870 + + utils: + * pdftoppm: Fix -tiff -gray/-mono incorrect output. + * pdftops: add -passlevel1customcolor. Bug #97193 + + + build system: + * Default to libopenjpeg2 instead of libopenjpeg1 + + qt: + * Support OCG state change links + + glib: + * Use g_slice_new0 for PopplerActionLayer. Bug #98786 + + Release 0.49.0 core: * Merge type3 glyph handling from xpdf 3.04. Bug #96667 diff --git a/Build/source/libs/poppler/poppler-src/configure.ac b/Build/source/libs/poppler/poppler-src/configure.ac index 0ba420adbee..94dfa062ed5 100644 --- a/Build/source/libs/poppler/poppler-src/configure.ac +++ b/Build/source/libs/poppler/poppler-src/configure.ac @@ -1,5 +1,5 @@ m4_define([poppler_version_major],[0]) -m4_define([poppler_version_minor],[49]) +m4_define([poppler_version_minor],[50]) m4_define([poppler_version_micro],[0]) m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro]) @@ -207,25 +207,26 @@ AC_ARG_ENABLE(libopenjpeg, openjpeg_header=yes -dnl test for libopenjpeg1 -if test x$enable_libopenjpeg = xopenjpeg1 || test x$enable_libopenjpeg = xauto; then - PKG_CHECK_MODULES(LIBOPENJPEG, libopenjpeg, - [openjpeg1="yes"], - [AC_CHECK_LIB([openjpeg], [opj_cio_open], - [openjpeg1="yes" - LIBOPENJPEG_LIBS="-lopenjpeg"],[openjpeg_header=no]) - AC_CHECK_HEADERS([openjpeg.h],, - [openjpeg_header="no"])]) +dnl test for libopenjpeg2 +if test x$enable_libopenjpeg = xopenjpeg2 || test x$enable_libopenjpeg = xauto; then + PKG_CHECK_MODULES(LIBOPENJPEG, libopenjp2, + [openjpeg2=yes],[openjpeg2=no]) fi -dnl test for libopenjpeg2 -if test x$openjpeg1 = xno; then - if test x$enable_libopenjpeg = xopenjpeg2 || test x$enable_libopenjpeg = xauto; then - PKG_CHECK_MODULES(LIBOPENJPEG, libopenjp2, - [openjpeg2=yes],[openjpeg2=no]) +dnl test for libopenjpeg1 +if test x$openjpeg2 = xno; then + if test x$enable_libopenjpeg = xopenjpeg1 || test x$enable_libopenjpeg = xauto; then + PKG_CHECK_MODULES(LIBOPENJPEG, libopenjpeg, + [openjpeg1="yes"], + [AC_CHECK_LIB([openjpeg], [opj_cio_open], + [openjpeg1="yes" + LIBOPENJPEG_LIBS="-lopenjpeg"],[openjpeg_header=no]) + AC_CHECK_HEADERS([openjpeg.h],, + [openjpeg_header="no"])]) fi fi + if test x$enable_libopenjpeg = xopenjpeg1 && test x$openjpeg1 = xno; then if test x$openjpeg_header = xno; then AC_MSG_ERROR("*** libopenjpeg headers not found ***") @@ -1085,5 +1086,5 @@ if test x$enable_zlib_uncompress != xno; then fi if test x$enable_libopenjpeg != xyes; then - echo " Warning: Using libopenjpeg is recommended. The internal JPX decoder is unmaintained." + echo " Warning: Using libopenjpeg2 is recommended. The internal JPX decoder is unmaintained." fi diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc index 5cea6fab7f1..9fad1ebae83 100644 --- a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc +++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.cc @@ -6,6 +6,20 @@ // //======================================================================== +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2016 Albert Astals Cid +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + #include #ifdef USE_GCC_PRAGMAS @@ -19,7 +33,7 @@ // Type 1 and 1C font data //------------------------------------------------------------------------ -const char *fofiType1StandardEncoding[256] = { +const char * const fofiType1StandardEncoding[256] = { NULL, NULL, NULL, @@ -278,7 +292,7 @@ const char *fofiType1StandardEncoding[256] = { NULL }; -const char *fofiType1ExpertEncoding[256] = { +const char * const fofiType1ExpertEncoding[256] = { NULL, NULL, NULL, diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h index ab80ad362a6..e7444906346 100644 --- a/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h +++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiEncodings.h @@ -6,6 +6,20 @@ // //======================================================================== +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2016 Albert Astals Cid +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + #ifndef FOFIENCODINGS_H #define FOFIENCODINGS_H @@ -19,8 +33,8 @@ // Type 1 and 1C font data //------------------------------------------------------------------------ -extern const char *fofiType1StandardEncoding[256]; -extern const char *fofiType1ExpertEncoding[256]; +extern const char * const fofiType1StandardEncoding[256]; +extern const char * const fofiType1ExpertEncoding[256]; //------------------------------------------------------------------------ // Type 1C font data diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc index 49058264bab..f1a15e004da 100644 --- a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc +++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.cc @@ -22,7 +22,7 @@ // Copyright (C) 2012 Adrian Johnson // Copyright (C) 2014 Thomas Freitag // Copyright (C) 2015 Aleksei Volkov -// Copyright (C) 2015 William Bader +// Copyright (C) 2015, 2016 William Bader // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -727,12 +727,15 @@ void FoFiTrueType::convertToCIDType0(char *psName, int *cidMap, int nCIDs, void FoFiTrueType::convertToType0(char *psName, int *cidMap, int nCIDs, GBool needVerticalMetrics, + int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) { GooString *buf; GooString *sfntsName; int maxUsedGlyph, n, i, j; + *maxValidGlyph = -1; + if (openTypeCFF) { return; } @@ -754,6 +757,13 @@ void FoFiTrueType::convertToType0(char *psName, int *cidMap, int nCIDs, // that refers to one of the unused glyphs -- this results in PS // errors if we simply use maxUsedGlyph+1 for the Type 0 font. So // we compromise by always defining at least 256 glyphs.) + // Some fonts have a large nGlyphs but maxUsedGlyph of 0. + // These fonts might reference any glyph. + // Return the last written glyph number in maxValidGlyph. + // PSOutputDev::drawString() can use maxValidGlyph to avoid + // referencing zero-length glyphs that we trimmed. + // This allows pdftops to avoid writing huge files while still + // handling the rare PDF that uses a zero-length glyph. if (cidMap) { n = nCIDs; } else if (nGlyphs > maxUsedGlyph + 256) { @@ -765,6 +775,7 @@ void FoFiTrueType::convertToType0(char *psName, int *cidMap, int nCIDs, } else { n = nGlyphs; } + *maxValidGlyph = n-1; for (i = 0; i < n; i += 256) { (*outputFunc)(outputStream, "10 dict begin\n", 14); (*outputFunc)(outputStream, "/FontName /", 11); diff --git a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h index b40a44a8d70..a4e28f27a4c 100644 --- a/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h +++ b/Build/source/libs/poppler/poppler-src/fofi/FoFiTrueType.h @@ -17,6 +17,7 @@ // Copyright (C) 2007 Koji Otani // Copyright (C) 2011, 2012 Albert Astals Cid // Copyright (C) 2012 Suzuki Toshiya +// Copyright (C) 2016 William Bader // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -144,6 +145,7 @@ public: // entries. (Not useful for OpenType CFF fonts.) void convertToType0(char *psName, int *cidMap, int nCIDs, GBool needVerticalMetrics, + int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream); // Convert to a Type 0 (but non-CID) composite font, suitable for diff --git a/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc index bd18cdeebac..89d0c996872 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/CairoOutputDev.cc @@ -150,6 +150,7 @@ CairoOutputDev::CairoOutputDev() { inType3Char = gFalse; t3_glyph_has_bbox = gFalse; text_matrix_valid = gTrue; + antialias = CAIRO_ANTIALIAS_DEFAULT; groupColorSpaceStack = NULL; maskStack = NULL; diff --git a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc index 368ee2775ec..6ac18748ade 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/GfxState.cc @@ -28,6 +28,7 @@ // Copyright (C) 2013 Hib Eris // Copyright (C) 2013 Fabio D'Urso // Copyright (C) 2015 Adrian Johnson +// Copyright (C) 2016 Marek Kasik // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -2050,7 +2051,12 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, GfxState error(errSyntaxWarning, -1, "read ICCBased color space profile error"); } else { cmsHPROFILE dhp = (state != NULL && state->getDisplayProfile() != NULL) ? state->getDisplayProfile() : displayProfile; - if (dhp == NULL) dhp = RGBProfile; + if (dhp == NULL) { + if (unlikely(RGBProfile == NULL)) { + GfxColorSpace::setupColorProfiles(); + } + dhp = RGBProfile; + } unsigned int cst = getCMSColorSpaceType(cmsGetColorSpace(hp)); unsigned int dNChannels = getCMSNChannels(cmsGetColorSpace(dhp)); unsigned int dcst = getCMSColorSpaceType(cmsGetColorSpace(dhp)); diff --git a/Build/source/libs/poppler/poppler-src/poppler/Hints.cc b/Build/source/libs/poppler/poppler-src/poppler/Hints.cc index 4cca2c88eeb..7f11304edd7 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Hints.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Hints.cc @@ -9,6 +9,7 @@ // Copyright 2010, 2013 Pino Toscano // Copyright 2013 Adrian Johnson // Copyright 2014 Fabio D'Urso +// Copyright 2016 Jeffrey Morlan // //======================================================================== @@ -140,7 +141,6 @@ Hints::Hints(BaseStream *str, Linearization *linearization, XRef *xref, Security memset(numSharedObject, 0, nPages * sizeof(Guint)); memset(pageObjectNum, 0, nPages * sizeof(int)); - nSharedGroups = 0; groupLength = NULL; groupOffset = NULL; groupHasSignature = NULL; @@ -350,29 +350,30 @@ GBool Hints::readSharedObjectsTable(Stream *str) { StreamBitReader sbr(str); - Guint firstSharedObjectNumber = sbr.readBits(32); + const Guint firstSharedObjectNumber = sbr.readBits(32); - Guint firstSharedObjectOffset = sbr.readBits(32); - firstSharedObjectOffset += hintsLength; + const Guint firstSharedObjectOffset = sbr.readBits(32) + hintsLength; - Guint nSharedGroupsFirst = sbr.readBits(32); + const Guint nSharedGroupsFirst = sbr.readBits(32); - Guint nSharedGroups = sbr.readBits(32); + const Guint nSharedGroups = sbr.readBits(32); - Guint nBitsNumObjects = sbr.readBits(16); + const Guint nBitsNumObjects = sbr.readBits(16); - Guint groupLengthLeast = sbr.readBits(32); + const Guint groupLengthLeast = sbr.readBits(32); - Guint nBitsDiffGroupLength = sbr.readBits(16); + const Guint nBitsDiffGroupLength = sbr.readBits(16); if ((!nSharedGroups) || (nSharedGroups >= INT_MAX / (int)sizeof(Guint))) { error(errSyntaxWarning, -1, "Invalid number of shared object groups"); - nSharedGroups = 0; return gFalse; } if ((!nSharedGroupsFirst) || (nSharedGroupsFirst > nSharedGroups)) { error(errSyntaxWarning, -1, "Invalid number of first page shared object groups"); - nSharedGroups = 0; + return gFalse; + } + if (nBitsNumObjects > 32 || nBitsDiffGroupLength > 32) { + error(errSyntaxWarning, -1, "Invalid shared object groups bit length"); return gFalse; } @@ -384,7 +385,6 @@ GBool Hints::readSharedObjectsTable(Stream *str) if (!groupLength || !groupOffset || !groupHasSignature || !groupNumObjects || !groupXRefOffset) { error(errSyntaxWarning, -1, "Failed to allocate memory for shared object groups"); - nSharedGroups = 0; return gFalse; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Hints.h b/Build/source/libs/poppler/poppler-src/poppler/Hints.h index d0a2e7de763..f9d05daefa7 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Hints.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Hints.h @@ -79,7 +79,6 @@ private: Guint *numSharedObject; Guint **sharedObjectId; - Guint nSharedGroups; Guint *groupLength; Guint *groupOffset; Guint *groupHasSignature; diff --git a/Build/source/libs/poppler/poppler-src/poppler/Makefile.am b/Build/source/libs/poppler/poppler-src/poppler/Makefile.am index 15aa5465794..de9c9839988 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Makefile.am +++ b/Build/source/libs/poppler/poppler-src/poppler/Makefile.am @@ -327,7 +327,7 @@ libpoppler_la_LIBADD = \ $(win32_libs) libpoppler_la_LDFLAGS = \ - -version-info 65:0:0 \ + -version-info 66:0:0 \ @create_shared_lib@ \ @auto_import_flags@ diff --git a/Build/source/libs/poppler/poppler-src/poppler/Outline.cc b/Build/source/libs/poppler/poppler-src/poppler/Outline.cc index 707ffdbccc1..bf46be264fe 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Outline.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/Outline.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Marco Pesenti Gritti -// Copyright (C) 2008 Albert Astals Cid +// Copyright (C) 2008, 2016 Albert Astals Cid // Copyright (C) 2009 Nick Jones // Copyright (C) 2016 Jason Crain // @@ -47,9 +47,7 @@ Outline::Outline(Object *outlineObj, XRef *xref) { if (!outlineObj->isDict()) { return; } - items = OutlineItem::readItemList(outlineObj->dictLookupNF("First", &first), - outlineObj->dictLookupNF("Last", &last), - xref); + items = OutlineItem::readItemList(outlineObj->dictLookupNF("First", &first), xref); first.free(); last.free(); } @@ -115,17 +113,13 @@ OutlineItem::~OutlineItem() { nextRef.free(); } -GooList *OutlineItem::readItemList(Object *firstItemRef, Object *lastItemRef, - XRef *xrefA) { +GooList *OutlineItem::readItemList(Object *firstItemRef, XRef *xrefA) { GooList *items; char* alreadyRead; OutlineItem *item; Object obj; Object *p; - if (!lastItemRef->isRef()) - return NULL; - items = new GooList(); alreadyRead = (char *)gmalloc(xrefA->getNumObjects()); @@ -144,10 +138,6 @@ GooList *OutlineItem::readItemList(Object *firstItemRef, Object *lastItemRef, item = new OutlineItem(obj.getDict(), xrefA); obj.free(); items->append(item); - if (p->getRef().num == lastItemRef->getRef().num && - p->getRef().gen == lastItemRef->getRef().gen) { - break; - } p = &item->nextRef; } @@ -163,7 +153,7 @@ GooList *OutlineItem::readItemList(Object *firstItemRef, Object *lastItemRef, void OutlineItem::open() { if (!kids) { - kids = readItemList(&firstRef, &lastRef, xref); + kids = readItemList(&firstRef, xref); } } diff --git a/Build/source/libs/poppler/poppler-src/poppler/Outline.h b/Build/source/libs/poppler/poppler-src/poppler/Outline.h index 90190e69280..46775d597a1 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/Outline.h +++ b/Build/source/libs/poppler/poppler-src/poppler/Outline.h @@ -14,6 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Marco Pesenti Gritti +// Copyright (C) 2016 Albert Astals Cid // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -59,8 +60,7 @@ public: OutlineItem(Dict *dict, XRef *xrefA); ~OutlineItem(); - static GooList *readItemList(Object *firstItemRef, Object *lastItemRef, - XRef *xrefA); + static GooList *readItemList(Object *firstItemRef, XRef *xrefA); void open(); void close(); diff --git a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc index 587b2be278d..f28bdec89cd 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/PDFDoc.cc @@ -1028,7 +1028,9 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr) } } xref->unlock(); - if (uxref->getNumObjects() == 0) { //we have nothing to update + // because of "uxref->add(0, 65535, 0, gFalse);" uxref->getNumObjects() will + // always be >= 1; if it is 1, it means there is nothing to update + if (uxref->getNumObjects() == 1) { delete uxref; return; } diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc index 9124c4932da..246244f8c57 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.cc @@ -1103,6 +1103,7 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, fontIDs = NULL; fontNames = new GooHash(gTrue); + fontMaxValidGlyph = new GooHash(gTrue); t1FontNames = NULL; font8Info = NULL; font16Enc = NULL; @@ -1171,6 +1172,7 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, fontIDs = NULL; fontNames = new GooHash(gTrue); + fontMaxValidGlyph = new GooHash(gTrue); t1FontNames = NULL; font8Info = NULL; font16Enc = NULL; @@ -1247,6 +1249,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, embedCIDTrueType = gTrue; fontPassthrough = gFalse; optimizeColorSpace = gFalse; + passLevel1CustomColor = gFalse; preloadImagesForms = gFalse; generateOPI = gFalse; useASCIIHex = gFalse; @@ -1496,6 +1499,7 @@ PSOutputDev::~PSOutputDev() { gfree(fontIDs); } delete fontNames; + delete fontMaxValidGlyph; if (t1FontNames) { for (i = 0; i < t1FontNameLen; ++i) { delete t1FontNames[i].psName; @@ -1649,6 +1653,7 @@ void PSOutputDev::writeXpdfProcset() { } } else if ((level == psLevel1 && lev1 && nonSep) || (level == psLevel1Sep && lev1 && sep) || + (level == psLevel1Sep && lev2 && sep && getPassLevel1CustomColor()) || (level == psLevel2 && lev2 && nonSep) || (level == psLevel2Sep && lev2 && sep) || (level == psLevel3 && lev3 && nonSep) || @@ -2608,10 +2613,15 @@ void PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font, outputFunc, outputStream); } else { // otherwise: use a non-CID composite font + int maxValidGlyph = -1; ffTT->convertToType0(psName->getCString(), codeToGID, codeToGIDLen, needVerticalMetrics, + &maxValidGlyph, outputFunc, outputStream); + if (maxValidGlyph >= 0 && font->getName()) { + fontMaxValidGlyph->replace(font->getName()->copy(), maxValidGlyph); + } } gfree(codeToGID); } else { @@ -2704,11 +2714,16 @@ void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, outputFunc, outputStream); } else { // otherwise: use a non-CID composite font + int maxValidGlyph = -1; ffTT->convertToType0(psName->getCString(), ((GfxCIDFont *)font)->getCIDToGID(), ((GfxCIDFont *)font)->getCIDToGIDLen(), needVerticalMetrics, + &maxValidGlyph, outputFunc, outputStream); + if (maxValidGlyph > 0 && font->getName()) { + fontMaxValidGlyph->replace(font->getName()->copy(), maxValidGlyph); + } } delete ffTT; } @@ -4123,15 +4138,6 @@ void PSOutputDev::updateFillColor(GfxState *state) { state->getFillGray(&gray); writePSFmt("{0:.4g} g\n", colToDbl(gray)); break; - case psLevel1Sep: - state->getFillCMYK(&cmyk); - c = colToDbl(cmyk.c); - m = colToDbl(cmyk.m); - y = colToDbl(cmyk.y); - k = colToDbl(cmyk.k); - writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} k\n", c, m, y, k); - addProcessColor(c, m, y, k); - break; case psLevel2: case psLevel3: if (state->getFillColorSpace()->getMode() != csPattern) { @@ -4146,9 +4152,10 @@ void PSOutputDev::updateFillColor(GfxState *state) { writePS("] sc\n"); } break; + case psLevel1Sep: case psLevel2Sep: case psLevel3Sep: - if (state->getFillColorSpace()->getMode() == csSeparation) { + if (state->getFillColorSpace()->getMode() == csSeparation && (level > psLevel1Sep || getPassLevel1CustomColor())) { sepCS = (GfxSeparationColorSpace *)state->getFillColorSpace(); color.c[0] = gfxColorComp1; sepCS->getCMYK(&color, &cmyk); @@ -4189,15 +4196,6 @@ void PSOutputDev::updateStrokeColor(GfxState *state) { state->getStrokeGray(&gray); writePSFmt("{0:.4g} G\n", colToDbl(gray)); break; - case psLevel1Sep: - state->getStrokeCMYK(&cmyk); - c = colToDbl(cmyk.c); - m = colToDbl(cmyk.m); - y = colToDbl(cmyk.y); - k = colToDbl(cmyk.k); - writePSFmt("{0:.4g} {1:.4g} {2:.4g} {3:.4g} K\n", c, m, y, k); - addProcessColor(c, m, y, k); - break; case psLevel2: case psLevel3: if (state->getStrokeColorSpace()->getMode() != csPattern) { @@ -4212,9 +4210,10 @@ void PSOutputDev::updateStrokeColor(GfxState *state) { writePS("] SC\n"); } break; + case psLevel1Sep: case psLevel2Sep: case psLevel3Sep: - if (state->getStrokeColorSpace()->getMode() == csSeparation) { + if (state->getStrokeColorSpace()->getMode() == csSeparation && (level > psLevel1Sep || getPassLevel1CustomColor())) { sepCS = (GfxSeparationColorSpace *)state->getStrokeColorSpace(); color.c[0] = gfxColorComp1; sepCS->getCMYK(&color, &cmyk); @@ -5065,6 +5064,8 @@ void PSOutputDev::drawString(GfxState *state, GooString *s) { char buf[8]; double *dxdy; int dxdySize, len, nChars, uLen, n, m, i, j; + int maxGlyphInt; + CharCode maxGlyph; // for pdftohtml, output PS without text if( displayText == gFalse ) @@ -5084,6 +5085,9 @@ void PSOutputDev::drawString(GfxState *state, GooString *s) { if (!(font = state->getFont())) { return; } + maxGlyphInt = (font->getName()? fontMaxValidGlyph->lookupInt(font->getName()): 0); + if (maxGlyphInt < 0) maxGlyphInt = 0; + maxGlyph = (CharCode) maxGlyphInt; wMode = font->getWMode(); // check for a subtitute 16-bit font @@ -5158,6 +5162,14 @@ void PSOutputDev::drawString(GfxState *state, GooString *s) { dxdy[2 * nChars + 1] = dy; ++nChars; } + } else if (maxGlyph > 0 && code > maxGlyph) { + // Ignore this code. + // Using it will exceed the number of glyphs in the font and generate + // /rangecheck in --xyshow-- + if (nChars > 0) { + dxdy[2 * (nChars-1) ] += dx; + dxdy[2 * (nChars-1) + 1 ] += dy; + } } else { if (nChars + 1 > dxdySize) { dxdySize *= 2; @@ -5888,7 +5900,11 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, // color space if (colorMap) { - dumpColorSpaceL2(colorMap->getColorSpace(), gFalse, gTrue, gFalse); + // Do not update the process color list for custom colors + GBool isCustomColor = + (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) && + colorMap->getColorSpace()->getMode() == csDeviceN; + dumpColorSpaceL2(colorMap->getColorSpace(), gFalse, !isCustomColor, gFalse); writePS(" setcolorspace\n"); } @@ -6287,7 +6303,11 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, // color space if (colorMap) { - dumpColorSpaceL2(colorMap->getColorSpace(), gFalse, gTrue, gFalse); + // Do not update the process color list for custom colors + GBool isCustomColor = + (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) && + colorMap->getColorSpace()->getMode() == csDeviceN; + dumpColorSpaceL2(colorMap->getColorSpace(), gFalse, !isCustomColor, gFalse); writePS(" setcolorspace\n"); } diff --git a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h index 3aea22309bb..072608a0a02 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h +++ b/Build/source/libs/poppler/poppler-src/poppler/PSOutputDev.h @@ -320,6 +320,7 @@ public: GBool getEmbedCIDTrueType() const { return embedCIDTrueType; } GBool getFontPassthrough() const { return fontPassthrough; } GBool getOptimizeColorSpace() const { return optimizeColorSpace; } + GBool getPassLevel1CustomColor() const { return passLevel1CustomColor; } GBool getEnableLZW() const { return enableLZW; }; GBool getEnableFlate() const #if ENABLE_ZLIB @@ -333,6 +334,7 @@ public: void setEmbedCIDTrueType(GBool b) { embedCIDTrueType = b; } void setFontPassthrough(GBool b) { fontPassthrough = b; } void setOptimizeColorSpace(GBool b) { optimizeColorSpace = b; } + void setPassLevel1CustomColor(GBool b) { passLevel1CustomColor = b; } void setPreloadImagesForms(GBool b) { preloadImagesForms = b; } void setGenerateOPI(GBool b) { generateOPI = b; } void setUseASCIIHex(GBool b) { useASCIIHex = b; } @@ -471,6 +473,7 @@ private: int fontIDSize; // size of fontIDs array std::set resourceIDs; // list of object IDs of objects containing Resources we've already set up GooHash *fontNames; // all used font names + GooHash *fontMaxValidGlyph; // max valid glyph of each font PST1FontName *t1FontNames; // font names for Type 1/1C fonts int t1FontNameLen; // number of entries in t1FontNames array int t1FontNameSize; // size of t1FontNames array @@ -536,6 +539,9 @@ private: GBool fontPassthrough; // pass all fonts through as-is? GBool optimizeColorSpace; // false to keep gray RGB images in their original color space // true to optimize gray images to DeviceGray color space + GBool passLevel1CustomColor; // false to convert all custom colors to CMYK + // true to pass custom colors + // has effect only when doing a level1sep GBool preloadImagesForms; // preload PostScript images and forms into // memory GBool generateOPI; // generate PostScript OPI comments? diff --git a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc index 7b6e14ae578..093baa94ef9 100644 --- a/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc +++ b/Build/source/libs/poppler/poppler-src/poppler/SplashOutputDev.cc @@ -4015,6 +4015,16 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, //----- set up the soft mask + if (maskColorMap->getMatteColor() != NULL) { + Guchar *data = (Guchar *) gmalloc(maskWidth * maskHeight); + maskStr->reset(); + maskStr->doGetChars(maskWidth * maskHeight, data); + maskStr->close(); + Object *maskDict = new Object(); + maskDict->initDict(maskStr->getDict()); + maskStr = new MemStream((char *)data, 0, maskWidth * maskHeight, maskDict); + ((MemStream *) maskStr)->setNeedFree(gTrue); + } imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, maskColorMap->getNumPixelComps(), maskColorMap->getBits()); @@ -4042,6 +4052,9 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, maskSplash->drawImage(&imageSrc, NULL, &imgMaskData, splashModeMono8, gFalse, maskWidth, maskHeight, mat, maskInterpolate); delete imgMaskData.imgStr; + if (maskColorMap->getMatteColor() == NULL) { + maskStr->close(); + } gfree(imgMaskData.lookup); delete maskSplash; splash->setSoftMask(maskBitmap); @@ -4141,7 +4154,10 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, gfree(imgData.lookup); delete imgData.maskStr; delete imgData.imgStr; - maskStr->close(); + if (maskColorMap->getMatteColor() != NULL) { + maskStr->close(); + delete maskStr; + } str->close(); } diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc index 7c14b3161b1..e9b2be421c8 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc @@ -22,6 +22,7 @@ // Copyright (C) 2011-2013 Thomas Freitag // Copyright (C) 2012 Anthony Wesley // Copyright (C) 2015 Adam Reichold +// Copyright (C) 2016 Kenji Uno // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -354,6 +355,8 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in ImgWriter *writer; SplashError e; + SplashColorMode imageWriterFormat = splashModeRGB8; + switch (format) { #ifdef ENABLE_LIBPNG case splashFormatPng: @@ -377,9 +380,11 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in switch (mode) { case splashModeMono1: writer = new TiffWriter(TiffWriter::MONOCHROME); + imageWriterFormat = splashModeMono1; break; case splashModeMono8: writer = new TiffWriter(TiffWriter::GRAY); + imageWriterFormat = splashModeMono8; break; case splashModeRGB8: case splashModeBGR8: @@ -408,7 +413,7 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in return splashErrGeneric; } - e = writeImgFile(writer, f, hDPI, vDPI); + e = writeImgFile(writer, f, hDPI, vDPI, imageWriterFormat); delete writer; return e; } @@ -617,7 +622,7 @@ void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) { } #endif -SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI) { +SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI, SplashColorMode imageWriterFormat) { if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1 && mode != splashModeXBGR8 && mode != splashModeBGR8 #if SPLASH_CMYK && mode != splashModeCMYK8 && mode != splashModeDeviceN8 @@ -744,41 +749,81 @@ SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int case splashModeMono8: { - unsigned char *row = new unsigned char[3 * width]; - for (int y = 0; y < height; y++) { - // Convert into a PNG row - for (int x = 0; x < width; x++) { - row[3*x] = data[y * rowSize + x]; - row[3*x+1] = data[y * rowSize + x]; - row[3*x+2] = data[y * rowSize + x]; - } + if (imageWriterFormat == splashModeMono8) { + SplashColorPtr row; + unsigned char **row_pointers = new unsigned char*[height]; + row = data; - if (!writer->writeRow(&row)) { - delete[] row; + for (int y = 0; y < height; ++y) { + row_pointers[y] = row; + row += rowSize; + } + if (!writer->writePointers(row_pointers, height)) { + delete[] row_pointers; return splashErrGeneric; } + delete[] row_pointers; + } else if (imageWriterFormat == splashModeRGB8) { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + // Convert into a PNG row + for (int x = 0; x < width; x++) { + row[3*x] = data[y * rowSize + x]; + row[3*x+1] = data[y * rowSize + x]; + row[3*x+2] = data[y * rowSize + x]; + } + + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + else { + // only splashModeMono8 or splashModeRGB8 + return splashErrGeneric; } - delete[] row; } break; case splashModeMono1: { - unsigned char *row = new unsigned char[3 * width]; - for (int y = 0; y < height; y++) { - // Convert into a PNG row - for (int x = 0; x < width; x++) { - getPixel(x, y, &row[3*x]); - row[3*x+1] = row[3*x]; - row[3*x+2] = row[3*x]; - } + if (imageWriterFormat == splashModeMono1) { + SplashColorPtr row; + unsigned char **row_pointers = new unsigned char*[height]; + row = data; - if (!writer->writeRow(&row)) { - delete[] row; + for (int y = 0; y < height; ++y) { + row_pointers[y] = row; + row += rowSize; + } + if (!writer->writePointers(row_pointers, height)) { + delete[] row_pointers; return splashErrGeneric; } + delete[] row_pointers; + } else if (imageWriterFormat == splashModeRGB8) { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + // Convert into a PNG row + for (int x = 0; x < width; x++) { + getPixel(x, y, &row[3*x]); + row[3*x+1] = row[3*x]; + row[3*x+2] = row[3*x]; + } + + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + else { + // only splashModeMono1 or splashModeRGB8 + return splashErrGeneric; } - delete[] row; } break; diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h index 4417af73375..6858f90f357 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h @@ -21,6 +21,7 @@ // Copyright (C) 2010 William Bader // Copyright (C) 2012 Thomas Freitag // Copyright (C) 2015 Adam Reichold +// Copyright (C) 2016 Kenji Uno // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -74,7 +75,7 @@ public: SplashError writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, const char *compressionString = ""); SplashError writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, const char *compressionString = ""); - SplashError writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI); + SplashError writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI, SplashColorMode imageWriterFormat); enum ConversionMode { diff --git a/Build/source/libs/poppler/version.ac b/Build/source/libs/poppler/version.ac index dd08c7c96ae..50b2c163030 100644 --- a/Build/source/libs/poppler/version.ac +++ b/Build/source/libs/poppler/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current poppler version -m4_define([poppler_version], [0.49.0]) +m4_define([poppler_version], [0.50.0]) -- cgit v1.2.3