1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

Merge pull request #14 from stephengaito/update-poppler

Update poppler to 0.83.0

Updated poppler dependency to poppler-0.83.0 as well as some minor build script refactoring (alas we can still not build on homebrew)
This commit is contained in:
stephengaito 2019-12-18 10:07:57 +00:00 committed by GitHub
commit ae62ce9762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 284 additions and 129 deletions

View File

@ -2,7 +2,7 @@
[![Build Status](https://travis-ci.org/pdf2htmlEX/pdf2htmlEX.svg?branch=master)](https://travis-ci.org/pdf2htmlEX/pdf2htmlEX) [![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: 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:

View File

@ -16,23 +16,18 @@ echo ""
# #
# see: https://github.com/travis-ci/travis-ci/issues/5301 (unfixed) # 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 ""
echo "PYTHON_CFLAGS:" echo "PYTHON_CFLAGS:"
echo "-------------------------------" echo "-------------------------------"
export PYTHON_CFLAGS="$(python3-config --cflags) $PYTHON_CFLAGS"
echo $PYTHON_CFLAGS echo $PYTHON_CFLAGS
echo "-------------------------------" echo "-------------------------------"
echo "" echo ""
echo "" echo ""
echo "PYTHON_LIBS:" echo "PYTHON_LIBS:"
echo "-------------------------------" echo "-------------------------------"
export PYTHON_LIBS="$(python3-config --ldflags) $PYTHON_LIBS"
echo $PYTHON_LIBS echo $PYTHON_LIBS
echo "-------------------------------" echo "-------------------------------"
echo "" echo ""
@ -45,7 +40,7 @@ cd fontforge
./bootstrap ./bootstrap
./configure \ ./configure \
--prefix=/usr/local \ --prefix=$PDF2HTMLEX_PREFIX \
--enable-python-scripting=3 \ --enable-python-scripting=3 \
--disable-dependency-tracking \ --disable-dependency-tracking \
--disable-silent-rules \ --disable-silent-rules \

View File

@ -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 ; }

View File

@ -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 ; }

View File

@ -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 ; }

View File

@ -11,5 +11,5 @@ echo ""
cd pdf2htmlEX cd pdf2htmlEX
mkdir build mkdir build
cd 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 make $MAKE_PARALLEL

View File

@ -11,5 +11,5 @@ echo ""
cd pdf2htmlEX cd pdf2htmlEX
mkdir build mkdir build
cd 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 make $MAKE_PARALLEL

View File

@ -11,6 +11,6 @@ echo ""
cd poppler cd poppler
mkdir build mkdir build
cd 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 .. -DENABLE_LIBOPENJPEG=none ..
make $MAKE_PARALLEL make $MAKE_PARALLEL

View File

@ -25,7 +25,11 @@ sudo rm -rf install_manifest.txt
make install DESTDIR=../../imageBuild/appDir 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) # 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 chmod a+x $LINUX_DEPLOY_APP_IMAGE
./$LINUX_DEPLOY_APP_IMAGE \ ./$LINUX_DEPLOY_APP_IMAGE \
-e appDir/usr/local/bin/pdf2htmlEX \ -e appDir/$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX \
--create-desktop-file \ --create-desktop-file \
-i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \
--appdir=appDir \ --appdir=appDir \
--output appimage --output appimage

View File

@ -48,7 +48,11 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi
make install DESTDIR=../../imageBuild/dockerDir make install DESTDIR=../../imageBuild/dockerDir
cd ../../imageBuild/dockerDir cd ../../poppler-data
make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/dockerDir
cd ../imageBuild/dockerDir
copy_deps copy_deps
@ -58,7 +62,7 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi
FROM $DOCKER_FROM FROM $DOCKER_FROM
COPY ./ / COPY ./ /
RUN ldconfig RUN ldconfig
ENTRYPOINT ["/usr/local/bin/pdf2htmlEX"] ENTRYPOINT ["$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX"]
DOCKERFILE_HERE_DOC DOCKERFILE_HERE_DOC
cd .. cd ..

24
buildScripts/getBuildToolsBrew Executable file
View File

@ -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

View File

@ -19,7 +19,6 @@ sudo apt-get $UNATTENDED install \
libspiro-dev \ libspiro-dev \
libpng-dev \ libpng-dev \
libjpeg-dev \ libjpeg-dev \
poppler-data \
libpango1.0-dev \ libpango1.0-dev \
liblcms2-dev \ liblcms2-dev \
libxml2-dev \ libxml2-dev \

View File

@ -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 \

View File

@ -3,7 +3,7 @@
# This bash script automates the process of getting the original pdf2htmlEX # This bash script automates the process of getting the original pdf2htmlEX
# source # source
PDF2HTMLEX_BRANCH=fontforge-update PDF2HTMLEX_BRANCH=update-poppler
echo "" echo ""
echo "-------------------------------------------------------------------" echo "-------------------------------------------------------------------"

24
buildScripts/getPdf2htmlEXBrew Executable file
View File

@ -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

View File

@ -21,4 +21,12 @@ wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz
tar xvf $POPPLER_VERSION.tar.xz tar xvf $POPPLER_VERSION.tar.xz
echo "Getting poppler-data version: 0.4.9"
mv $POPPLER_VERSION poppler 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

View File

@ -26,17 +26,22 @@ sudo make install
cd .. cd ..
sudo mkdir -p /usr/local/include/poppler sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler
sudo cp poppler/*.h /usr/local/include/poppler sudo cp poppler/*.h $PDF2HTMLEX_PREFIX/include/poppler
sudo mkdir -p /usr/local/include/poppler/goo sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/goo
sudo cp goo/*.h /usr/local/include/poppler/goo sudo cp goo/*.h $PDF2HTMLEX_PREFIX/include/poppler/goo
sudo mkdir -p /usr/local/include/poppler/fofi sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/fofi
sudo cp fofi/*.h /usr/local/include/poppler/fofi sudo cp fofi/*.h $PDF2HTMLEX_PREFIX/include/poppler/fofi
sudo mkdir -p /usr/local/include/poppler/splash sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/splash
sudo cp splash/*.h /usr/local/include/poppler/splash sudo cp splash/*.h $PDF2HTMLEX_PREFIX/include/poppler/splash
sudo cp build/poppler/poppler-config.h \ sudo cp build/poppler/poppler-config.h \
/usr/local/include/poppler $PDF2HTMLEX_PREFIX/include/poppler
cd ../poppler-data
sudo make install prefix=$PDF2HTMLEX_PREFIX

View File

@ -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-

View File

@ -10,9 +10,9 @@ echo " build dir: [$TRAVIS_BUILD_DIR]"
echo " repo slug: [$TRAVIS_REPO_SLUG]" echo " repo slug: [$TRAVIS_REPO_SLUG]"
echo "Build env:" echo "Build env:"
echo " prefix: [$PDF2HTMLEX_PREFIX]"
echo " unattended: [$UNATTENDED]" echo " unattended: [$UNATTENDED]"
echo " make parallel: [$MAKE_PARALLEL]" echo " make parallel: [$MAKE_PARALLEL]"
source ./buildScripts/reSourceVersionEnvs source ./buildScripts/reSourceVersionEnvs
echo "pdf2htmlEX env:" echo "pdf2htmlEX env:"

View File

@ -26,23 +26,23 @@ echo $LDFLAGS
echo $CPPFLAGS echo $CPPFLAGS
which clang which clang
echo "-------------------------------------------------" echo "-------------------------------------------------"
brew install llvm #brew install llvm
brew install -v python@2 #brew install -v python@2
brew install jq #brew install jq
echo "-------------------------------------------------" echo "-------------------------------------------------"
echo $PATH echo $PATH
echo $LDFLAGS echo $LDFLAGS
echo $CPPFLAGS echo $CPPFLAGS
which clang 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 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 $python2Version
echo "-------------------------------------------------" echo "-------------------------------------------------"
brew info llvm #brew info llvm
brew switch llvm $llvmVersion #brew switch llvm $llvmVersion
brew info python@2 #brew info python@2
brew switch python@2 $python2Version #brew switch python@2 $python2Version
echo "-------------------------------------------------" echo "-------------------------------------------------"
echo $PATH echo $PATH
echo $LDFLAGS echo $LDFLAGS

View File

@ -3,8 +3,9 @@
# This bash script exports environment variables for the latest software # This bash script exports environment variables for the latest software
# versions # versions
export POPPLER_VERSION=poppler-0.83.0
#export POPPLER_VERSION=poppler-0.82.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=20190801
#export FONTFORGE_VERSION=20170731 #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 PDF2HTMLEX_BRANCH=\"$PDF2HTMLEX_BRANCH\"" >> buildScripts/reSourceVersionEnvs
echo "export MACHINE_ARCH=\"$MACHINE_ARCH\"" >> buildScripts/reSourceVersionEnvs echo "export MACHINE_ARCH=\"$MACHINE_ARCH\"" >> buildScripts/reSourceVersionEnvs
echo "export BUILD_TIME=\"$BUILD_TIME\"" >> buildScripts/reSourceVersionEnvs echo "export BUILD_TIME=\"$BUILD_TIME\"" >> buildScripts/reSourceVersionEnvs
echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs

View File

@ -90,7 +90,7 @@ CairoFont::getFontFace(void) {
unsigned long unsigned long
CairoFont::getGlyph(CharCode code, CairoFont::getGlyph(CharCode code,
Unicode *u, int uLen) { const Unicode *u, int uLen) {
FT_UInt gid; FT_UInt gid;
if (codeToGID && code < codeToGIDLen) { if (codeToGID && code < codeToGIDLen) {

View File

@ -15,7 +15,7 @@
// under GPL version 2 or later // under GPL version 2 or later
// //
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2005, 2018 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2005, 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2008, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2008, 2017 Adrian Johnson <ajohnson@redneon.com>
@ -54,7 +54,7 @@ public:
virtual bool matches(Ref &other, bool printing); virtual bool matches(Ref &other, bool printing);
cairo_font_face_t *getFontFace(void); 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); double getSubstitutionCorrection(GfxFont *gfxFont);
bool isSubstitute() { return substitute; } bool isSubstitute() { return substitute; }

View File

@ -712,7 +712,7 @@ void CairoOutputDev::updateFont(GfxState *state) {
/* Align stroke coordinate i if the point is the start or end of a /* Align stroke coordinate i if the point is the start or end of a
* horizontal or vertical line */ * 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; double x1, y1, x2, y2;
bool align = false; bool align = false;
@ -752,13 +752,12 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do
#undef STROKE_COORD_TOLERANCE #undef STROKE_COORD_TOLERANCE
void CairoOutputDev::doPath(cairo_t *c, GfxState *state, GfxPath *path) { void CairoOutputDev::doPath(cairo_t *c, GfxState *state, const GfxPath *path) {
GfxSubpath *subpath;
int i, j; int i, j;
double x, y; double x, y;
cairo_new_path (c); cairo_new_path (c);
for (i = 0; i < path->getNumSubpaths(); ++i) { for (i = 0; i < path->getNumSubpaths(); ++i) {
subpath = path->getSubpath(i); const GfxSubpath *subpath = path->getSubpath(i);
if (subpath->getNumPoints() > 0) { if (subpath->getNumPoints() > 0) {
if (align_stroke_coords) { if (align_stroke_coords) {
alignStrokeCoords(subpath, 0, &x, &y); 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, void CairoOutputDev::drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen) CharCode code, int nBytes, const Unicode *u, int uLen)
{ {
if (currentFont) { if (currentFont) {
glyphs[glyphCount].index = currentFont->getGlyph (code, u, uLen); glyphs[glyphCount].index = currentFont->getGlyph (code, u, uLen);
@ -1512,7 +1511,7 @@ finish:
bool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, bool CairoOutputDev::beginType3Char(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
CharCode code, Unicode *u, int uLen) { CharCode code, const Unicode *u, int uLen) {
cairo_save (cairo); cairo_save (cairo);
cairo_matrix_t matrix; cairo_matrix_t matrix;
@ -3068,7 +3067,7 @@ private:
GfxRGB *lookup; GfxRGB *lookup;
int width; int width;
GfxImageColorMap *colorMap; GfxImageColorMap *colorMap;
int *maskColors; const int *maskColors;
int current_row; int current_row;
bool imageError; bool imageError;
@ -3078,7 +3077,7 @@ public:
int scaledWidth, int scaledHeight, int scaledWidth, int scaledHeight,
bool printing, bool printing,
GfxImageColorMap *colorMapA, GfxImageColorMap *colorMapA,
int *maskColorsA) { const int *maskColorsA) {
cairo_surface_t *image = nullptr; cairo_surface_t *image = nullptr;
int i; int i;
@ -3253,7 +3252,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
int widthA, int heightA, int widthA, int heightA,
GfxImageColorMap *colorMap, GfxImageColorMap *colorMap,
bool interpolate, bool interpolate,
int *maskColors, bool inlineImg) const int *maskColors, bool inlineImg)
{ {
cairo_surface_t *image; cairo_surface_t *image;
cairo_pattern_t *pattern, *maskPattern; 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, void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap, int width, int height, GfxImageColorMap *colorMap,
bool interpolate, int *maskColors, bool inlineImg) bool interpolate, const int *maskColors, bool inlineImg)
{ {
cairo_t *cr; cairo_t *cr;
cairo_surface_t *surface; cairo_surface_t *surface;

View File

@ -192,13 +192,13 @@ public:
void drawChar(GfxState *state, double x, double y, void drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, 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 beginActualText(GfxState *state, const GooString *text) override;
void endActualText(GfxState *state) override; void endActualText(GfxState *state) override;
bool beginType3Char(GfxState *state, double x, double y, bool beginType3Char(GfxState *state, double x, double y,
double dx, double dy, 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 endType3Char(GfxState *state) override;
void beginTextObject(GfxState *state) override; void beginTextObject(GfxState *state) override;
void endTextObject(GfxState *state) override; void endTextObject(GfxState *state) override;
@ -221,7 +221,7 @@ public:
void drawImage(GfxState *state, Object *ref, Stream *str, void drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap, 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, void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height, int width, int height,
GfxImageColorMap *colorMap, GfxImageColorMap *colorMap,
@ -274,7 +274,7 @@ public:
double *getType3GlyphBBox () { return t3_glyph_bbox; } double *getType3GlyphBBox () { return t3_glyph_bbox; }
protected: 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); cairo_surface_t *downscaleSurface(cairo_surface_t *orig_surface);
void getScaledSize(const cairo_matrix_t *matrix, void getScaledSize(const cairo_matrix_t *matrix,
int orig_width, int orig_height, int orig_width, int orig_height,
@ -285,7 +285,7 @@ protected:
void setMimeData(GfxState *state, Stream *str, Object *ref, void setMimeData(GfxState *state, Stream *str, Object *ref,
GfxImageColorMap *colorMap, cairo_surface_t *image, int height); GfxImageColorMap *colorMap, cairo_surface_t *image, int height);
void fillToStrokePathClip(GfxState *state); 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) #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
bool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); bool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image);
#endif #endif
@ -469,7 +469,7 @@ public:
bool interpolate, bool inlineImg) override; bool interpolate, bool inlineImg) override;
void drawImage(GfxState *state, Object *ref, Stream *str, void drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap, 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, void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height, int width, int height,
GfxImageColorMap *colorMap, GfxImageColorMap *colorMap,

View File

@ -62,8 +62,8 @@
static void downsample_row_box_filter ( static void downsample_row_box_filter (
int start, int width, int start, int width,
uint32_t *src, uint32_t *src_limit, uint32_t *dest, uint32_t *src, const uint32_t *src_limit, uint32_t *dest,
int coverage[], int pixel_coverage) const int coverage[], int pixel_coverage)
{ {
/* we need an array of the pixel contribution of each destination pixel on the boundaries. /* 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 */ * we invert the value to get the value on the other size of the box */

View File

@ -82,9 +82,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual")
# CYGWIN or GCC 4.5.x bug # CYGWIN or GCC 4.5.x bug
if(CYGWIN) 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() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread")
endif() endif()
# check the C++11 features we need # check the C++11 features we need

View File

@ -46,7 +46,7 @@ CairoBackgroundRenderer::~CairoBackgroundRenderer()
void CairoBackgroundRenderer::drawChar(GfxState *state, double x, double y, void CairoBackgroundRenderer::drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, 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 // draw characters as image when
// - in fallback mode // - in fallback mode

View File

@ -42,7 +42,7 @@ public:
virtual void drawChar(GfxState *state, double x, double y, virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen); CharCode code, int nBytes, const Unicode *u, int uLen);
//for proof //for proof
void beginTextObject(GfxState *state); void beginTextObject(GfxState *state);

View File

@ -65,7 +65,7 @@ void SplashBackgroundRenderer::startPage(int pageNum, GfxState *state, XRef *xre
void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y, void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, 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)) { if (param.proof || html_renderer->is_char_covered(drawn_char_count)) {
SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen); SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code,nBytes,u,uLen);

View File

@ -44,7 +44,7 @@ public:
virtual void drawChar(GfxState *state, double x, double y, virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen); CharCode code, int nBytes, const Unicode *u, int uLen);
//for proof //for proof
void beginTextObject(GfxState *state); void beginTextObject(GfxState *state);

View File

@ -136,10 +136,10 @@ void DrawingTracer::restore()
#endif #endif
} }
void DrawingTracer::do_path(GfxState * state, GfxPath * path) void DrawingTracer::do_path(GfxState * state, const GfxPath * path)
{ {
//copy from CairoOutputDev::doPath //copy from CairoOutputDev::doPath
GfxSubpath *subpath; const GfxSubpath *subpath;
int i, j; int i, j;
double x, y; double x, y;
cairo_new_path(cairo); cairo_new_path(cairo);
@ -220,9 +220,9 @@ void DrawingTracer::stroke(GfxState * state)
break; break;
} }
GfxPath * path = state->getPath(); const GfxPath * path = state->getPath();
for (int i = 0; i < path->getNumSubpaths(); ++i) { for (int i = 0; i < path->getNumSubpaths(); ++i) {
GfxSubpath * subpath = path->getSubpath(i); const GfxSubpath * subpath = path->getSubpath(i);
if (subpath->getNumPoints() <= 0) if (subpath->getNumPoints() <= 0)
continue; continue;
double x = subpath->getX(0); double x = subpath->getX(0);

View File

@ -65,7 +65,7 @@ public:
private: private:
void finish(); void finish();
// Following methods operate in user space (just before CTM is applied) // 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_non_char_bbox(GfxState * state, double * bbox, int what);
void draw_char_bbox(GfxState * state, double * bbox, int inTransparencyGroup); void draw_char_bbox(GfxState * state, double * bbox, int inTransparencyGroup);
// If cairo is available, parameter state is ignored // If cairo is available, parameter state is ignored

View File

@ -156,7 +156,9 @@ struct HTMLRenderer : OutputDev
virtual void drawString(GfxState * state, const GooString * s); 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, virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height, int width, int height,

View File

@ -636,7 +636,8 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
if(mapped_code > max_key) if(mapped_code > max_key)
max_key = mapped_code; max_key = mapped_code;
Unicode u, *pu=&u; Unicode u;
Unicode const *pu=&u;
if(info.use_tounicode) if(info.use_tounicode)
{ {
int n = ctu ? int n = ctu ?

View File

@ -12,7 +12,9 @@
namespace pdf2htmlEX { 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); tracer.draw_image(state);

View File

@ -74,7 +74,7 @@ void HTMLRenderer::drawString(GfxState * state, const GooString * s)
int uLen; int uLen;
CharCode code; CharCode code;
Unicode *u = nullptr; Unicode const *u = nullptr;
HR_DEBUG(printf("HTMLRenderer::drawString:len=%d\n", len)); HR_DEBUG(printf("HTMLRenderer::drawString:len=%d\n", len));

View File

@ -65,7 +65,7 @@ void Preprocessor::process(PDFDoc * doc)
void Preprocessor::drawChar(GfxState *state, double x, double y, void Preprocessor::drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, 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(); GfxFont * font = state->getFont();
if(!font) return; if(!font) return;

View File

@ -39,7 +39,7 @@ public:
virtual void drawChar(GfxState *state, double x, double y, virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen); CharCode code, int nBytes, const Unicode *u, int uLen);
// Start a page. // Start a page.
// UGLY: These 2 versions are for different versions of poppler // UGLY: These 2 versions are for different versions of poppler

View File

@ -407,8 +407,11 @@ int main(int argc, char **argv)
param.tmp_dir.c_str()); param.tmp_dir.c_str());
bool finished = false; bool finished = false;
// read config file // read poppler config file
globalParams = new GlobalParams(!param.poppler_data_dir.empty() ? param.poppler_data_dir.c_str() : NULL); globalParams = std::make_unique<GlobalParams>(
!param.poppler_data_dir.empty() ? param.poppler_data_dir.c_str() : NULL
);
// open PDF file // open PDF file
PDFDoc * doc = nullptr; PDFDoc * doc = nullptr;
try try
@ -435,8 +438,11 @@ int main(int argc, char **argv)
cerr << "Document has copy-protection bit set." << endl; cerr << "Document has copy-protection bit set." << endl;
} }
param.first_page = min<int>(max<int>(param.first_page, 1), doc->getNumPages()); param.first_page =
param.last_page = min<int>(max<int>(param.last_page, param.first_page), doc->getNumPages()); min<int>(max<int>(param.first_page, 1), doc->getNumPages());
param.last_page =
min<int>(max<int>(param.last_page, param.first_page),
doc->getNumPages());
unique_ptr<HTMLRenderer>(new HTMLRenderer(argv[0], param))->process(doc); unique_ptr<HTMLRenderer>(new HTMLRenderer(argv[0], param))->process(doc);
@ -454,7 +460,7 @@ int main(int argc, char **argv)
// clean up // clean up
delete doc; delete doc;
delete globalParams; globalParams.reset();
// check for memory leaks // check for memory leaks
// Poppler Object class (Object.h) no longer has memCheck // Poppler Object class (Object.h) no longer has memCheck

View File

@ -55,7 +55,7 @@ Unicode unicode_from_font (CharCode code, GfxFont * font)
return map_to_private(code); 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) if(len == 0)
return map_to_private(code); return map_to_private(code);

View File

@ -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 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 * 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 } // namespace pdf2htmlEX