diff --git a/.travis.yml.off b/.travis.yml similarity index 100% rename from .travis.yml.off rename to .travis.yml diff --git a/README.md b/README.md index e86e6565..c4bd1686 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/pdf2htmlEX/pdf2htmlEX.svg?branch=master)](https://travis-ci.org/pdf2htmlEX/pdf2htmlEX) -# Differences from upstream pdf2htmlEX: +# Differences from upstream pdf2htmlEX: This is my branch of pdf2htmlEX which aims to allow an open collaboration to help keep the project active. A number of changes and improvements have been incorperated from other forks: diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 9df90019..c41fd680 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -16,23 +16,18 @@ echo "" # # see: https://github.com/travis-ci/travis-ci/issues/5301 (unfixed) # -if [ -n "$PYTHON_CFLAGS" ] ; then - export PYTHON_CFLAGS="$(python3-config --cflags) $PYTHON_CFLAGS" -fi - -if [ -n "$PYTHON_LIBS" ] ; then - export PYTHON_LIBS="$(python3-config --ldflags) $PYTHON_LIBS" -fi echo "" echo "PYTHON_CFLAGS:" echo "-------------------------------" +export PYTHON_CFLAGS="$(python3-config --cflags) $PYTHON_CFLAGS" echo $PYTHON_CFLAGS echo "-------------------------------" echo "" echo "" echo "PYTHON_LIBS:" echo "-------------------------------" +export PYTHON_LIBS="$(python3-config --ldflags) $PYTHON_LIBS" echo $PYTHON_LIBS echo "-------------------------------" echo "" @@ -45,7 +40,7 @@ cd fontforge ./bootstrap ./configure \ - --prefix=/usr/local \ + --prefix=$PDF2HTMLEX_PREFIX \ --enable-python-scripting=3 \ --disable-dependency-tracking \ --disable-silent-rules \ diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally deleted file mode 100755 index 4c15ffe9..00000000 --- a/buildScripts/buildInstallLocally +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# This bash script builds the complete pdf2htmlEX application LOCALLY -# (It does not create the AppImage or Docker images) - -# Adjust the following two environment variables to suit your needs -# -export UNATTENDED="--assume-yes" -export MAKE_PARALLEL="-j $(nproc)" - -# choose one of the following... -# -export PDF2HTMLEX_BRANCH=fontforge-update -# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" - -################ -# do the build - -./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } - -./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } - -./buildScripts/getBuildTools || { echo 'getBuildTools FAILED' ; exit 1 ; } - -./buildScripts/getDevLibraries || { echo 'getDevLibraries FAILED' ; exit 1 ; } - -./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } - -./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } - -./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } - -./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } - -./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } - -./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } - -./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } - -./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt new file mode 100755 index 00000000..72aeced5 --- /dev/null +++ b/buildScripts/buildInstallLocallyApt @@ -0,0 +1,47 @@ +#!/bin/bash + +# This bash script builds the complete pdf2htmlEX application LOCALLY +# (It does not create the AppImage or Docker images) + +# Adjust the following two environment variables to suit your needs +# +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +# choose one of the following... +# +export PDF2HTMLEX_BRANCH=update-poppler +# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +# The following environment variable determines where the poppler, +# poppler-data, fontforge and pdf2htmlEX packages are installed. +# CHANGE IT TO SUIT YOUR NEEDS: +# +export PDF2HTMLEX_PREFIX=/usr/local + +################ +# do the build + +./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } + +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } + +./buildScripts/getBuildToolsApt || { echo 'getBuildToolsApt FAILED' ; exit 1 ; } + +./buildScripts/getDevLibrariesApt || { echo 'getDevLibrariesApt FAILED' ; exit 1 ; } + +./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } + +./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } + +./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } + +./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } + +./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } + +./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew new file mode 100755 index 00000000..1cb4849e --- /dev/null +++ b/buildScripts/buildInstallLocallyBrew @@ -0,0 +1,43 @@ +#!/bin/bash + +# This bash script builds the complete pdf2htmlEX application LOCALLY +# (It does not create the AppImage or Docker images) + +# Adjust the following two environment variables to suit your needs +# +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +# choose one of the following... +# +export PDF2HTMLEX_BRANCH=update-poppler +# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +export PDF2HTMLEX_PREFIX=toBeDetermined + +################ +# do the build + +./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } + +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } + +./buildScripts/getBuildToolsBrew || { echo 'getBuildToolsBrew FAILED' ; exit 1 ; } + +./buildScripts/getDevLibrariesBrew || { echo 'getDevLibrariesBrew FAILED' ; exit 1 ; } + +./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } + +./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } + +./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } + +./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } + +./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } + +./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } + +./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index 1d49382f..cf6dd005 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -11,5 +11,5 @@ echo "" cd pdf2htmlEX mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX .. make $MAKE_PARALLEL diff --git a/buildScripts/buildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang index 3ea3a3f3..eb65509d 100755 --- a/buildScripts/buildPdf2htmlEXClang +++ b/buildScripts/buildPdf2htmlEXClang @@ -11,5 +11,5 @@ echo "" cd pdf2htmlEX mkdir build cd build -CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. +CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX .. make $MAKE_PARALLEL diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 52df3e9b..9845412c 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -11,6 +11,6 @@ echo "" cd poppler mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX \ -DENABLE_LIBOPENJPEG=none .. make $MAKE_PARALLEL diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 4ebebd6d..360d0fdb 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -25,7 +25,11 @@ sudo rm -rf install_manifest.txt make install DESTDIR=../../imageBuild/appDir -cd ../../imageBuild +cd ../../poppler-data + +make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/appDir + +cd ../imageBuild # force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig) # @@ -37,11 +41,11 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LI chmod a+x $LINUX_DEPLOY_APP_IMAGE -./$LINUX_DEPLOY_APP_IMAGE \ - -e appDir/usr/local/bin/pdf2htmlEX \ - --create-desktop-file \ - -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ - --appdir=appDir \ +./$LINUX_DEPLOY_APP_IMAGE \ + -e appDir/$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX \ + --create-desktop-file \ + -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ + --appdir=appDir \ --output appimage diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 71e22879..aca0d3a0 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -48,7 +48,11 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi make install DESTDIR=../../imageBuild/dockerDir - cd ../../imageBuild/dockerDir + cd ../../poppler-data + + make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/dockerDir + + cd ../imageBuild/dockerDir copy_deps @@ -58,7 +62,7 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi FROM $DOCKER_FROM COPY ./ / RUN ldconfig -ENTRYPOINT ["/usr/local/bin/pdf2htmlEX"] +ENTRYPOINT ["$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX"] DOCKERFILE_HERE_DOC cd .. diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildToolsApt similarity index 100% rename from buildScripts/getBuildTools rename to buildScripts/getBuildToolsApt diff --git a/buildScripts/getBuildToolsBrew b/buildScripts/getBuildToolsBrew new file mode 100755 index 00000000..1ee11e15 --- /dev/null +++ b/buildScripts/getBuildToolsBrew @@ -0,0 +1,24 @@ +#!/bin/bash + +# This bash script automates getting the required build tools (brew install) + +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING Build Tools (using Home/Linux Brew)" +echo "-------------------------------------------------------------------" +echo "" + +brew update +brew install \ + git \ + pkg-config \ + ruby \ + autoconf \ + libtool \ + cmake \ + make \ + gcc \ + gettext \ + openjdk \ + jq \ + tree diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibrariesApt similarity index 97% rename from buildScripts/getDevLibraries rename to buildScripts/getDevLibrariesApt index dadc2e4b..ce518a2f 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibrariesApt @@ -19,7 +19,6 @@ sudo apt-get $UNATTENDED install \ libspiro-dev \ libpng-dev \ libjpeg-dev \ - poppler-data \ libpango1.0-dev \ liblcms2-dev \ libxml2-dev \ diff --git a/buildScripts/getDevLibrariesBrew b/buildScripts/getDevLibrariesBrew new file mode 100755 index 00000000..0938300d --- /dev/null +++ b/buildScripts/getDevLibrariesBrew @@ -0,0 +1,21 @@ +#!/bin/bash + +# This bash script automates getting the development libraries required to +# build poppler and fontforge (using Home/Linux Brew) + +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING development libraries (using Home/Linux Brew)" +echo "-------------------------------------------------------------------" +echo "" + +brew update +brew install \ + cairo \ + libspiro \ + libpng \ + jpeg \ + pango \ + little-cms2 \ + libxml2 \ + libuninameslist \ diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEXApt similarity index 94% rename from buildScripts/getPdf2htmlEX rename to buildScripts/getPdf2htmlEXApt index 70756014..abc7e182 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEXApt @@ -3,7 +3,7 @@ # This bash script automates the process of getting the original pdf2htmlEX # source -PDF2HTMLEX_BRANCH=fontforge-update +PDF2HTMLEX_BRANCH=update-poppler echo "" echo "-------------------------------------------------------------------" diff --git a/buildScripts/getPdf2htmlEXBrew b/buildScripts/getPdf2htmlEXBrew new file mode 100755 index 00000000..4754fe04 --- /dev/null +++ b/buildScripts/getPdf2htmlEXBrew @@ -0,0 +1,24 @@ +#!/bin/bash + +# This bash script automates the process of getting the original pdf2htmlEX +# source + +PDF2HTMLEX_BRANCH=update-poppler + +echo "" +echo "-------------------------------------------------------------------" +echo "GETTING pdf2htmlEX sources (using wget)" +echo " (PDF2HTMLEX_BRANCH: [$PDF2HTMLEX_BRANCH])" +echo "-------------------------------------------------------------------" +echo "" + + +wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_BRANCH + +mv $PDF2HTMLEX_BRANCH $PDF2HTMLEX_BRANCH.zip + +brew install unzip + +unzip $PDF2HTMLEX_BRANCH.zip + +mv pdf2htmlEX-$PDF2HTMLEX_BRANCH pdf2htmlEX diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index ca25e1c7..528cfe43 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -21,4 +21,12 @@ wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz tar xvf $POPPLER_VERSION.tar.xz +echo "Getting poppler-data version: 0.4.9" + mv $POPPLER_VERSION poppler + +wget https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz + +tar xvf poppler-data-0.4.9.tar.gz + +mv poppler-data-0.4.9 poppler-data diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler index 2ae5b158..42ce6ce4 100755 --- a/buildScripts/installPoppler +++ b/buildScripts/installPoppler @@ -26,17 +26,22 @@ sudo make install cd .. -sudo mkdir -p /usr/local/include/poppler -sudo cp poppler/*.h /usr/local/include/poppler +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler +sudo cp poppler/*.h $PDF2HTMLEX_PREFIX/include/poppler -sudo mkdir -p /usr/local/include/poppler/goo -sudo cp goo/*.h /usr/local/include/poppler/goo +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/goo +sudo cp goo/*.h $PDF2HTMLEX_PREFIX/include/poppler/goo -sudo mkdir -p /usr/local/include/poppler/fofi -sudo cp fofi/*.h /usr/local/include/poppler/fofi +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/fofi +sudo cp fofi/*.h $PDF2HTMLEX_PREFIX/include/poppler/fofi -sudo mkdir -p /usr/local/include/poppler/splash -sudo cp splash/*.h /usr/local/include/poppler/splash +sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/splash +sudo cp splash/*.h $PDF2HTMLEX_PREFIX/include/poppler/splash sudo cp build/poppler/poppler-config.h \ - /usr/local/include/poppler + $PDF2HTMLEX_PREFIX/include/poppler + +cd ../poppler-data + +sudo make install prefix=$PDF2HTMLEX_PREFIX + diff --git a/buildScripts/listFilesByChangeTime b/buildScripts/listFilesByChangeTime new file mode 100755 index 00000000..e88213f3 --- /dev/null +++ b/buildScripts/listFilesByChangeTime @@ -0,0 +1,9 @@ +#!/bin/bash + +# see:https://stackoverflow.com/a/7448828 + +find . -type f -print0 | \ + xargs -0 stat --format '%Y :%y %n' | \ + sort -nr | \ + grep -v build | \ + cut -d: -f2- diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index 941d5382..d49fedf2 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -10,9 +10,9 @@ echo " build dir: [$TRAVIS_BUILD_DIR]" echo " repo slug: [$TRAVIS_REPO_SLUG]" echo "Build env:" +echo " prefix: [$PDF2HTMLEX_PREFIX]" echo " unattended: [$UNATTENDED]" echo " make parallel: [$MAKE_PARALLEL]" - source ./buildScripts/reSourceVersionEnvs echo "pdf2htmlEX env:" diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index cbc2879f..d04f76d8 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -26,23 +26,23 @@ echo $LDFLAGS echo $CPPFLAGS which clang echo "-------------------------------------------------" -brew install llvm -brew install -v python@2 -brew install jq +#brew install llvm +#brew install -v python@2 +#brew install jq echo "-------------------------------------------------" echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang -export llvmVersion=$(brew info --json=v1 llvm | jq '.[].installed[].version' | tr -d '"') +#export llvmVersion=$(brew info --json=v1 llvm | jq '.[].installed[].version' | tr -d '"') echo $llvmVersion -export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version' | tr -d '"') +#export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version' | tr -d '"') echo $python2Version echo "-------------------------------------------------" -brew info llvm -brew switch llvm $llvmVersion -brew info python@2 -brew switch python@2 $python2Version +#brew info llvm +#brew switch llvm $llvmVersion +#brew info python@2 +#brew switch python@2 $python2Version echo "-------------------------------------------------" echo $PATH echo $LDFLAGS diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 54b12f48..77b3597b 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -3,8 +3,9 @@ # This bash script exports environment variables for the latest software # versions +export POPPLER_VERSION=poppler-0.83.0 #export POPPLER_VERSION=poppler-0.82.0 -export POPPLER_VERSION=poppler-0.81.0 +#export POPPLER_VERSION=poppler-0.81.0 export FONTFORGE_VERSION=20190801 #export FONTFORGE_VERSION=20170731 @@ -31,4 +32,4 @@ echo "export FONTFORGE_VERSION=\"$FONTFORGE_VERSION\"" >> buildScripts/reSourceV echo "export PDF2HTMLEX_BRANCH=\"$PDF2HTMLEX_BRANCH\"" >> buildScripts/reSourceVersionEnvs echo "export MACHINE_ARCH=\"$MACHINE_ARCH\"" >> buildScripts/reSourceVersionEnvs echo "export BUILD_TIME=\"$BUILD_TIME\"" >> buildScripts/reSourceVersionEnvs - +echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc index 3a479e4f..776b6de8 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc @@ -90,7 +90,7 @@ CairoFont::getFontFace(void) { unsigned long CairoFont::getGlyph(CharCode code, - Unicode *u, int uLen) { + const Unicode *u, int uLen) { FT_UInt gid; if (codeToGID && code < codeToGIDLen) { diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h index 2a55af15..34802c1f 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h @@ -15,7 +15,7 @@ // under GPL version 2 or later // // Copyright (C) 2005, 2006 Kristian Høgsberg -// Copyright (C) 2005, 2018 Albert Astals Cid +// Copyright (C) 2005, 2018, 2019 Albert Astals Cid // Copyright (C) 2006, 2007 Jeff Muizelaar // Copyright (C) 2006, 2010 Carlos Garcia Campos // Copyright (C) 2008, 2017 Adrian Johnson @@ -54,7 +54,7 @@ class CairoFont { virtual bool matches(Ref &other, bool printing); cairo_font_face_t *getFontFace(void); - unsigned long getGlyph(CharCode code, Unicode *u, int uLen); + unsigned long getGlyph(CharCode code, const Unicode *u, int uLen); double getSubstitutionCorrection(GfxFont *gfxFont); bool isSubstitute() { return substitute; } diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc index 846c81ab..0f3c156d 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc @@ -712,7 +712,7 @@ void CairoOutputDev::updateFont(GfxState *state) { /* Align stroke coordinate i if the point is the start or end of a * horizontal or vertical line */ -void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y) +void CairoOutputDev::alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y) { double x1, y1, x2, y2; bool align = false; @@ -752,13 +752,12 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do #undef STROKE_COORD_TOLERANCE -void CairoOutputDev::doPath(cairo_t *c, GfxState *state, GfxPath *path) { - GfxSubpath *subpath; +void CairoOutputDev::doPath(cairo_t *c, GfxState *state, const GfxPath *path) { int i, j; double x, y; cairo_new_path (c); for (i = 0; i < path->getNumSubpaths(); ++i) { - subpath = path->getSubpath(i); + const GfxSubpath *subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { if (align_stroke_coords) { alignStrokeCoords(subpath, 0, &x, &y); @@ -1395,7 +1394,7 @@ void CairoOutputDev::beginString(GfxState *state, const GooString *s) void CairoOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { if (currentFont) { glyphs[glyphCount].index = currentFont->getGlyph (code, u, uLen); @@ -1512,7 +1511,7 @@ void CairoOutputDev::endString(GfxState *state) bool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, - CharCode code, Unicode *u, int uLen) { + CharCode code, const Unicode *u, int uLen) { cairo_save (cairo); cairo_matrix_t matrix; @@ -3068,7 +3067,7 @@ class RescaleDrawImage : public CairoRescaleBox { GfxRGB *lookup; int width; GfxImageColorMap *colorMap; - int *maskColors; + const int *maskColors; int current_row; bool imageError; @@ -3078,7 +3077,7 @@ class RescaleDrawImage : public CairoRescaleBox { int scaledWidth, int scaledHeight, bool printing, GfxImageColorMap *colorMapA, - int *maskColorsA) { + const int *maskColorsA) { cairo_surface_t *image = nullptr; int i; @@ -3253,7 +3252,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int widthA, int heightA, GfxImageColorMap *colorMap, bool interpolate, - int *maskColors, bool inlineImg) + const int *maskColors, bool inlineImg) { cairo_surface_t *image; cairo_pattern_t *pattern, *maskPattern; @@ -3474,7 +3473,7 @@ void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - bool interpolate, int *maskColors, bool inlineImg) + bool interpolate, const int *maskColors, bool inlineImg) { cairo_t *cr; cairo_surface_t *surface; diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h index 0fbbf0d5..9e6f497c 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h @@ -192,13 +192,13 @@ class CairoOutputDev: public OutputDev { void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) override; + CharCode code, int nBytes, const Unicode *u, int uLen) override; void beginActualText(GfxState *state, const GooString *text) override; void endActualText(GfxState *state) override; bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, - CharCode code, Unicode *u, int uLen) override; + CharCode code, const Unicode *u, int uLen) override; void endType3Char(GfxState *state) override; void beginTextObject(GfxState *state) override; void endTextObject(GfxState *state) override; @@ -221,7 +221,7 @@ class CairoOutputDev: public OutputDev { void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - bool interpolate, int *maskColors, bool inlineImg) override; + bool interpolate, const int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, @@ -274,7 +274,7 @@ class CairoOutputDev: public OutputDev { double *getType3GlyphBBox () { return t3_glyph_bbox; } protected: - void doPath(cairo_t *cairo, GfxState *state, GfxPath *path); + void doPath(cairo_t *cairo, GfxState *state, const GfxPath *path); cairo_surface_t *downscaleSurface(cairo_surface_t *orig_surface); void getScaledSize(const cairo_matrix_t *matrix, int orig_width, int orig_height, @@ -285,7 +285,7 @@ class CairoOutputDev: public OutputDev { void setMimeData(GfxState *state, Stream *str, Object *ref, GfxImageColorMap *colorMap, cairo_surface_t *image, int height); void fillToStrokePathClip(GfxState *state); - void alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y); + void alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y); #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) bool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); #endif @@ -469,7 +469,7 @@ class CairoImageOutputDev: public CairoOutputDev { bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - bool interpolate, int *maskColors, bool inlineImg) override; + bool interpolate, const int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc index 2c0e1ed8..1c7ccd18 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc @@ -62,8 +62,8 @@ static void downsample_row_box_filter ( int start, int width, - uint32_t *src, uint32_t *src_limit, uint32_t *dest, - int coverage[], int pixel_coverage) + uint32_t *src, const uint32_t *src_limit, uint32_t *dest, + const int coverage[], int pixel_coverage) { /* we need an array of the pixel contribution of each destination pixel on the boundaries. * we invert the value to get the value on the other size of the box */ diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 68d77c71..3f65ae72 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -82,9 +82,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual") # CYGWIN or GCC 4.5.x bug if(CYGWIN) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") +# was: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") +# the following change is untested: +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14") else() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -pthread") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread") endif() # check the C++11 features we need diff --git a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc index a7eaed89..ae5c8091 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc @@ -46,7 +46,7 @@ CairoBackgroundRenderer::~CairoBackgroundRenderer() void CairoBackgroundRenderer::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { // draw characters as image when // - in fallback mode diff --git a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h index d5c86371..f8bbc07b 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h +++ b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h @@ -42,7 +42,7 @@ class CairoBackgroundRenderer : public BackgroundRenderer, CairoOutputDev virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen); + CharCode code, int nBytes, const Unicode *u, int uLen); //for proof void beginTextObject(GfxState *state); diff --git a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc index be14222d..757f0a1c 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -65,7 +65,7 @@ void SplashBackgroundRenderer::startPage(int pageNum, GfxState *state, XRef *xre void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { if (param.proof || html_renderer->is_char_covered(drawn_char_count)) { SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen); diff --git a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h index 55baeb30..b8e07c06 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h @@ -44,7 +44,7 @@ class SplashBackgroundRenderer : public BackgroundRenderer, SplashOutputDev virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen); + CharCode code, int nBytes, const Unicode *u, int uLen); //for proof void beginTextObject(GfxState *state); diff --git a/pdf2htmlEX/src/DrawingTracer.cc b/pdf2htmlEX/src/DrawingTracer.cc index 70865650..5d23d421 100644 --- a/pdf2htmlEX/src/DrawingTracer.cc +++ b/pdf2htmlEX/src/DrawingTracer.cc @@ -136,10 +136,10 @@ void DrawingTracer::restore() #endif } -void DrawingTracer::do_path(GfxState * state, GfxPath * path) +void DrawingTracer::do_path(GfxState * state, const GfxPath * path) { //copy from CairoOutputDev::doPath - GfxSubpath *subpath; + const GfxSubpath *subpath; int i, j; double x, y; cairo_new_path(cairo); @@ -220,9 +220,9 @@ void DrawingTracer::stroke(GfxState * state) break; } - GfxPath * path = state->getPath(); + const GfxPath * path = state->getPath(); for (int i = 0; i < path->getNumSubpaths(); ++i) { - GfxSubpath * subpath = path->getSubpath(i); + const GfxSubpath * subpath = path->getSubpath(i); if (subpath->getNumPoints() <= 0) continue; double x = subpath->getX(0); diff --git a/pdf2htmlEX/src/DrawingTracer.h b/pdf2htmlEX/src/DrawingTracer.h index 3a0bc885..0d186d04 100644 --- a/pdf2htmlEX/src/DrawingTracer.h +++ b/pdf2htmlEX/src/DrawingTracer.h @@ -65,7 +65,7 @@ class DrawingTracer private: void finish(); // Following methods operate in user space (just before CTM is applied) - void do_path(GfxState * state, GfxPath * path); + void do_path(GfxState * state, const GfxPath * path); void draw_non_char_bbox(GfxState * state, double * bbox, int what); void draw_char_bbox(GfxState * state, double * bbox, int inTransparencyGroup); // If cairo is available, parameter state is ignored diff --git a/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h b/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h index c71d2826..6f2c24c9 100644 --- a/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h +++ b/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h @@ -156,7 +156,9 @@ struct HTMLRenderer : OutputDev virtual void drawString(GfxState * state, const GooString * s); - virtual void drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, bool interpolate, int *maskColors, bool inlineImg); + virtual void drawImage(GfxState * state, Object * ref, Stream * str, + int width, int height, GfxImageColorMap * colorMap, + bool interpolate, const int *maskColors, bool inlineImg); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, diff --git a/pdf2htmlEX/src/HTMLRenderer/font.cc b/pdf2htmlEX/src/HTMLRenderer/font.cc index 3392a9e3..466f691b 100644 --- a/pdf2htmlEX/src/HTMLRenderer/font.cc +++ b/pdf2htmlEX/src/HTMLRenderer/font.cc @@ -636,7 +636,8 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo if(mapped_code > max_key) max_key = mapped_code; - Unicode u, *pu=&u; + Unicode u; + Unicode const *pu=&u; if(info.use_tounicode) { int n = ctu ? diff --git a/pdf2htmlEX/src/HTMLRenderer/image.cc b/pdf2htmlEX/src/HTMLRenderer/image.cc index ef51ffcb..b4d84cc0 100644 --- a/pdf2htmlEX/src/HTMLRenderer/image.cc +++ b/pdf2htmlEX/src/HTMLRenderer/image.cc @@ -12,7 +12,9 @@ namespace pdf2htmlEX { -void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, bool interpolate, int *maskColors, bool inlineImg) +void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, + int width, int height, GfxImageColorMap * colorMap, + bool interpolate, const int *maskColors, bool inlineImg) { tracer.draw_image(state); diff --git a/pdf2htmlEX/src/HTMLRenderer/text.cc b/pdf2htmlEX/src/HTMLRenderer/text.cc index 06df7aa6..506f9474 100644 --- a/pdf2htmlEX/src/HTMLRenderer/text.cc +++ b/pdf2htmlEX/src/HTMLRenderer/text.cc @@ -74,7 +74,7 @@ void HTMLRenderer::drawString(GfxState * state, const GooString * s) int uLen; CharCode code; - Unicode *u = nullptr; + Unicode const *u = nullptr; HR_DEBUG(printf("HTMLRenderer::drawString:len=%d\n", len)); diff --git a/pdf2htmlEX/src/Preprocessor.cc b/pdf2htmlEX/src/Preprocessor.cc index 42318b20..643bbc73 100644 --- a/pdf2htmlEX/src/Preprocessor.cc +++ b/pdf2htmlEX/src/Preprocessor.cc @@ -65,7 +65,7 @@ void Preprocessor::process(PDFDoc * doc) void Preprocessor::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen) + CharCode code, int nBytes, const Unicode *u, int uLen) { GfxFont * font = state->getFont(); if(!font) return; diff --git a/pdf2htmlEX/src/Preprocessor.h b/pdf2htmlEX/src/Preprocessor.h index d121b599..756993d8 100644 --- a/pdf2htmlEX/src/Preprocessor.h +++ b/pdf2htmlEX/src/Preprocessor.h @@ -39,7 +39,7 @@ class Preprocessor : public OutputDev { virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen); + CharCode code, int nBytes, const Unicode *u, int uLen); // Start a page. // UGLY: These 2 versions are for different versions of poppler diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index 32237520..edf32eee 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -407,8 +407,11 @@ int main(int argc, char **argv) param.tmp_dir.c_str()); bool finished = false; - // read config file - globalParams = new GlobalParams(!param.poppler_data_dir.empty() ? param.poppler_data_dir.c_str() : NULL); + // read poppler config file + globalParams = std::make_unique( + !param.poppler_data_dir.empty() ? param.poppler_data_dir.c_str() : NULL + ); + // open PDF file PDFDoc * doc = nullptr; try @@ -435,8 +438,11 @@ int main(int argc, char **argv) cerr << "Document has copy-protection bit set." << endl; } - param.first_page = min(max(param.first_page, 1), doc->getNumPages()); - param.last_page = min(max(param.last_page, param.first_page), doc->getNumPages()); + param.first_page = + min(max(param.first_page, 1), doc->getNumPages()); + param.last_page = + min(max(param.last_page, param.first_page), + doc->getNumPages()); unique_ptr(new HTMLRenderer(argv[0], param))->process(doc); @@ -454,7 +460,7 @@ int main(int argc, char **argv) // clean up delete doc; - delete globalParams; + globalParams.reset(); // check for memory leaks // Poppler Object class (Object.h) no longer has memCheck diff --git a/pdf2htmlEX/src/util/unicode.cc b/pdf2htmlEX/src/util/unicode.cc index 31ec4f80..2ebc88e6 100644 --- a/pdf2htmlEX/src/util/unicode.cc +++ b/pdf2htmlEX/src/util/unicode.cc @@ -55,7 +55,7 @@ Unicode unicode_from_font (CharCode code, GfxFont * font) return map_to_private(code); } -Unicode check_unicode(Unicode * u, int len, CharCode code, GfxFont * font) +Unicode check_unicode(Unicode const * u, int len, CharCode code, GfxFont * font) { if(len == 0) return map_to_private(code); diff --git a/pdf2htmlEX/src/util/unicode.h b/pdf2htmlEX/src/util/unicode.h index c789dea4..d4a5d481 100644 --- a/pdf2htmlEX/src/util/unicode.h +++ b/pdf2htmlEX/src/util/unicode.h @@ -83,7 +83,7 @@ Unicode unicode_from_font (CharCode code, GfxFont * font); * if we got multi-unicode values, it might be expanded ligature, try to restore it * if we cannot figure it out at the end, use a private mapping */ -Unicode check_unicode(Unicode * u, int len, CharCode code, GfxFont * font); +Unicode check_unicode(Unicode const * u, int len, CharCode code, GfxFont * font); } // namespace pdf2htmlEX