From 4e4f15282889adf65dfc84e1e4beae3f32831bcb Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 12:35:10 +0000 Subject: [PATCH 001/269] initial restructure of directories --- build_for_ppa.py => archive/build_for_ppa.py | 0 dobuild => buildScripts/dobuildPdf2htmlEX | 0 dobuildClang => buildScripts/dobuildPdf2htmlEXClang | 0 doclean => buildScripts/docleanPdf2htmlEX | 0 doinstall => buildScripts/doinstallPdf2htmlEX | 0 {3rdparty => pdf2htmlEX/3rdparty}/PDF.js/LICENSE | 0 {3rdparty => pdf2htmlEX/3rdparty}/PDF.js/build.sh | 0 .../3rdparty}/PDF.js/compatibility.js | 0 .../3rdparty}/PDF.js/compatibility.min.js | 0 .../3rdparty}/closure-compiler/COPYING | 0 .../3rdparty}/closure-compiler/README | 0 .../3rdparty}/closure-compiler/compiler.jar | Bin {3rdparty => pdf2htmlEX/3rdparty}/poppler/COPYING3 | 0 .../3rdparty}/poppler/git/CairoFontEngine.cc | 0 .../3rdparty}/poppler/git/CairoFontEngine.h | 0 .../3rdparty}/poppler/git/CairoOutputDev.cc | 0 .../3rdparty}/poppler/git/CairoOutputDev.h | 0 .../3rdparty}/poppler/git/CairoRescaleBox.cc | 0 .../3rdparty}/poppler/git/CairoRescaleBox.h | 0 .../3rdparty}/yuicompressor/LICENSE.TXT | 0 .../3rdparty}/yuicompressor/yuicompressor-2.4.8.jar | Bin CMakeLists.txt => pdf2htmlEX/CMakeLists.txt | 0 .../CMakeLists.txt.patch | 0 {logo => pdf2htmlEX/logo}/LICENSE | 0 {logo => pdf2htmlEX/logo}/LICENSE_CC-BY-3.0 | 0 {logo => pdf2htmlEX/logo}/design.svg | 0 {logo => pdf2htmlEX/logo}/notes.txt | 0 {logo => pdf2htmlEX/logo}/pdf2htmlEX-256x256.png | Bin {logo => pdf2htmlEX/logo}/pdf2htmlEX-64x64.png | Bin {logo => pdf2htmlEX/logo}/pdf2htmlEX.svg | 0 {logo => pdf2htmlEX/logo}/update_png.sh | 0 pdf2htmlEX.1.in => pdf2htmlEX/pdf2htmlEX.1.in | 0 {share => pdf2htmlEX/share}/LICENSE | 0 {share => pdf2htmlEX/share}/base.css.in | 0 {share => pdf2htmlEX/share}/build_css.sh | 0 {share => pdf2htmlEX/share}/build_js.sh | 0 {share => pdf2htmlEX/share}/fancy.css.in | 0 {share => pdf2htmlEX/share}/manifest | 0 {share => pdf2htmlEX/share}/pdf2htmlEX-64x64.png | Bin {share => pdf2htmlEX/share}/pdf2htmlEX.js.in | 0 {src => pdf2htmlEX/src}/ArgParser.cc | 0 {src => pdf2htmlEX/src}/ArgParser.h | 0 .../src}/BackgroundRenderer/BackgroundRenderer.cc | 0 .../src}/BackgroundRenderer/BackgroundRenderer.h | 0 .../BackgroundRenderer/CairoBackgroundRenderer.cc | 0 .../BackgroundRenderer/CairoBackgroundRenderer.h | 0 .../BackgroundRenderer/SplashBackgroundRenderer.cc | 0 .../BackgroundRenderer/SplashBackgroundRenderer.h | 0 {src => pdf2htmlEX/src}/Base64Stream.cc | 0 {src => pdf2htmlEX/src}/Base64Stream.h | 0 {src => pdf2htmlEX/src}/Color.cc | 0 {src => pdf2htmlEX/src}/Color.h | 0 {src => pdf2htmlEX/src}/CoveredTextDetector.cc | 0 {src => pdf2htmlEX/src}/CoveredTextDetector.h | 0 {src => pdf2htmlEX/src}/DrawingTracer.cc | 0 {src => pdf2htmlEX/src}/DrawingTracer.h | 0 {src => pdf2htmlEX/src}/HTMLRenderer/HTMLRenderer.h | 0 {src => pdf2htmlEX/src}/HTMLRenderer/draw.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/font.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/form.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/general.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/image.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/link.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/outline.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/state.cc | 0 {src => pdf2htmlEX/src}/HTMLRenderer/text.cc | 0 {src => pdf2htmlEX/src}/HTMLState.h | 0 {src => pdf2htmlEX/src}/HTMLTextLine.cc | 0 {src => pdf2htmlEX/src}/HTMLTextLine.h | 0 {src => pdf2htmlEX/src}/HTMLTextPage.cc | 0 {src => pdf2htmlEX/src}/HTMLTextPage.h | 0 {src => pdf2htmlEX/src}/Param.h | 0 {src => pdf2htmlEX/src}/Preprocessor.cc | 0 {src => pdf2htmlEX/src}/Preprocessor.h | 0 {src => pdf2htmlEX/src}/StateManager.h | 0 {src => pdf2htmlEX/src}/StringFormatter.cc | 0 {src => pdf2htmlEX/src}/StringFormatter.h | 0 {src => pdf2htmlEX/src}/TmpFiles.cc | 0 {src => pdf2htmlEX/src}/TmpFiles.h | 0 .../src}/css_class_names.cmakelists.txt | 0 {src => pdf2htmlEX/src}/pdf2htmlEX-config.h.in | 0 {src => pdf2htmlEX/src}/pdf2htmlEX.cc | 0 {src => pdf2htmlEX/src}/util/const.cc | 0 {src => pdf2htmlEX/src}/util/const.h | 0 {src => pdf2htmlEX/src}/util/css_const.h.in | 0 {src => pdf2htmlEX/src}/util/encoding.cc | 0 {src => pdf2htmlEX/src}/util/encoding.h | 0 {src => pdf2htmlEX/src}/util/ffw.c | 0 {src => pdf2htmlEX/src}/util/ffw.h | 0 .../src}/util/fontforge-2.0.20170731/autowidth.h | 0 .../src}/util/fontforge-2.0.20170731/bitmapchar.h | 0 .../src}/util/fontforge-2.0.20170731/cvimages.h | 0 .../src}/util/fontforge-2.0.20170731/encoding.h | 0 .../src}/util/fontforge-2.0.20170731/fvfonts.h | 0 .../src}/util/fontforge-2.0.20170731/namelist.h | 0 .../src}/util/fontforge-2.0.20170731/savefont.h | 0 .../src}/util/fontforge-2.0.20170731/splineorder2.h | 0 .../src}/util/fontforge-2.0.20170731/splineutil.h | 0 .../src}/util/fontforge-2.0.20170731/splineutil2.h | 0 .../src}/util/fontforge-2.0.20170731/start.h | 0 .../src}/util/fontforge-2.0.20170731/tottf.h | 0 .../src}/util/fontforge-2.0.20170731/views.h | 0 {src => pdf2htmlEX/src}/util/math.cc | 0 {src => pdf2htmlEX/src}/util/math.h | 0 {src => pdf2htmlEX/src}/util/mingw.cc | 0 {src => pdf2htmlEX/src}/util/mingw.h | 0 {src => pdf2htmlEX/src}/util/misc.cc | 0 {src => pdf2htmlEX/src}/util/misc.h | 0 {src => pdf2htmlEX/src}/util/namespace.h | 0 {src => pdf2htmlEX/src}/util/path.cc | 0 {src => pdf2htmlEX/src}/util/path.h | 0 {src => pdf2htmlEX/src}/util/unicode.cc | 0 {src => pdf2htmlEX/src}/util/unicode.h | 0 {test => pdf2htmlEX/test}/.gitattributes | 0 {test => pdf2htmlEX/test}/README.md | 0 {test => pdf2htmlEX/test}/browser_tests.py | 0 .../test}/browser_tests/basic_text.pdf | Bin .../test}/browser_tests/basic_text.tex | 0 .../test}/browser_tests/basic_text/basic_text.html | 0 .../test}/browser_tests/fontfile3_opentype.pdf | Bin .../fontfile3_opentype/fontfile3_opentype.html | 0 .../test}/browser_tests/geneve_1564.pdf | Bin .../browser_tests/geneve_1564/geneve_1564.html | 0 .../browser_tests/invalid_unicode_issue477.pdf | Bin .../invalid_unicode_issue477.html | 0 .../svg_background_with_page_rotation_issue402.pdf | Bin .../svg_background_with_page_rotation_issue402.html | 0 .../test}/browser_tests/test_fail.pdf | Bin .../test}/browser_tests/test_fail.tex | 0 .../test_fail/THIS_FOLDER_SHOULD_BE_EMPTY | 0 .../test}/browser_tests/text_visibility.pdf | Bin .../text_visibility/text_visibility.html | 0 .../test}/browser_tests/with_form.pdf | Bin .../test}/browser_tests/with_form/with_form.html | 0 {test => pdf2htmlEX/test}/fancy.min.css | 0 .../test}/old/convert_to_woff.fontforge | 0 {test => pdf2htmlEX/test}/old/test.py | 0 {test => pdf2htmlEX/test}/start_xvfb.sh | 0 {test => pdf2htmlEX/test}/test.py.in | 0 {test => pdf2htmlEX/test}/test_local_browser.py | 0 {test => pdf2htmlEX/test}/test_output.py | 0 {test => pdf2htmlEX/test}/test_output/1-page.pdf | Bin {test => pdf2htmlEX/test}/test_output/2-pages.pdf | Bin {test => pdf2htmlEX/test}/test_output/3-pages.pdf | Bin {test => pdf2htmlEX/test}/test_output/issue501 | Bin {test => pdf2htmlEX/test}/test_remote_browser.py | 0 146 files changed, 0 insertions(+), 0 deletions(-) rename build_for_ppa.py => archive/build_for_ppa.py (100%) rename dobuild => buildScripts/dobuildPdf2htmlEX (100%) rename dobuildClang => buildScripts/dobuildPdf2htmlEXClang (100%) rename doclean => buildScripts/docleanPdf2htmlEX (100%) rename doinstall => buildScripts/doinstallPdf2htmlEX (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/PDF.js/LICENSE (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/PDF.js/build.sh (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/PDF.js/compatibility.js (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/PDF.js/compatibility.min.js (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/closure-compiler/COPYING (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/closure-compiler/README (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/closure-compiler/compiler.jar (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/poppler/COPYING3 (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/poppler/git/CairoFontEngine.cc (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/poppler/git/CairoFontEngine.h (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/poppler/git/CairoOutputDev.cc (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/poppler/git/CairoOutputDev.h (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/poppler/git/CairoRescaleBox.cc (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/poppler/git/CairoRescaleBox.h (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/yuicompressor/LICENSE.TXT (100%) rename {3rdparty => pdf2htmlEX/3rdparty}/yuicompressor/yuicompressor-2.4.8.jar (100%) rename CMakeLists.txt => pdf2htmlEX/CMakeLists.txt (100%) rename CMakeLists.txt.patch => pdf2htmlEX/CMakeLists.txt.patch (100%) rename {logo => pdf2htmlEX/logo}/LICENSE (100%) rename {logo => pdf2htmlEX/logo}/LICENSE_CC-BY-3.0 (100%) rename {logo => pdf2htmlEX/logo}/design.svg (100%) rename {logo => pdf2htmlEX/logo}/notes.txt (100%) rename {logo => pdf2htmlEX/logo}/pdf2htmlEX-256x256.png (100%) rename {logo => pdf2htmlEX/logo}/pdf2htmlEX-64x64.png (100%) rename {logo => pdf2htmlEX/logo}/pdf2htmlEX.svg (100%) rename {logo => pdf2htmlEX/logo}/update_png.sh (100%) rename pdf2htmlEX.1.in => pdf2htmlEX/pdf2htmlEX.1.in (100%) rename {share => pdf2htmlEX/share}/LICENSE (100%) rename {share => pdf2htmlEX/share}/base.css.in (100%) rename {share => pdf2htmlEX/share}/build_css.sh (100%) rename {share => pdf2htmlEX/share}/build_js.sh (100%) rename {share => pdf2htmlEX/share}/fancy.css.in (100%) rename {share => pdf2htmlEX/share}/manifest (100%) rename {share => pdf2htmlEX/share}/pdf2htmlEX-64x64.png (100%) rename {share => pdf2htmlEX/share}/pdf2htmlEX.js.in (100%) rename {src => pdf2htmlEX/src}/ArgParser.cc (100%) rename {src => pdf2htmlEX/src}/ArgParser.h (100%) rename {src => pdf2htmlEX/src}/BackgroundRenderer/BackgroundRenderer.cc (100%) rename {src => pdf2htmlEX/src}/BackgroundRenderer/BackgroundRenderer.h (100%) rename {src => pdf2htmlEX/src}/BackgroundRenderer/CairoBackgroundRenderer.cc (100%) rename {src => pdf2htmlEX/src}/BackgroundRenderer/CairoBackgroundRenderer.h (100%) rename {src => pdf2htmlEX/src}/BackgroundRenderer/SplashBackgroundRenderer.cc (100%) rename {src => pdf2htmlEX/src}/BackgroundRenderer/SplashBackgroundRenderer.h (100%) rename {src => pdf2htmlEX/src}/Base64Stream.cc (100%) rename {src => pdf2htmlEX/src}/Base64Stream.h (100%) rename {src => pdf2htmlEX/src}/Color.cc (100%) rename {src => pdf2htmlEX/src}/Color.h (100%) rename {src => pdf2htmlEX/src}/CoveredTextDetector.cc (100%) rename {src => pdf2htmlEX/src}/CoveredTextDetector.h (100%) rename {src => pdf2htmlEX/src}/DrawingTracer.cc (100%) rename {src => pdf2htmlEX/src}/DrawingTracer.h (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/HTMLRenderer.h (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/draw.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/font.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/form.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/general.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/image.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/link.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/outline.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/state.cc (100%) rename {src => pdf2htmlEX/src}/HTMLRenderer/text.cc (100%) rename {src => pdf2htmlEX/src}/HTMLState.h (100%) rename {src => pdf2htmlEX/src}/HTMLTextLine.cc (100%) rename {src => pdf2htmlEX/src}/HTMLTextLine.h (100%) rename {src => pdf2htmlEX/src}/HTMLTextPage.cc (100%) rename {src => pdf2htmlEX/src}/HTMLTextPage.h (100%) rename {src => pdf2htmlEX/src}/Param.h (100%) rename {src => pdf2htmlEX/src}/Preprocessor.cc (100%) rename {src => pdf2htmlEX/src}/Preprocessor.h (100%) rename {src => pdf2htmlEX/src}/StateManager.h (100%) rename {src => pdf2htmlEX/src}/StringFormatter.cc (100%) rename {src => pdf2htmlEX/src}/StringFormatter.h (100%) rename {src => pdf2htmlEX/src}/TmpFiles.cc (100%) rename {src => pdf2htmlEX/src}/TmpFiles.h (100%) rename {src => pdf2htmlEX/src}/css_class_names.cmakelists.txt (100%) rename {src => pdf2htmlEX/src}/pdf2htmlEX-config.h.in (100%) rename {src => pdf2htmlEX/src}/pdf2htmlEX.cc (100%) rename {src => pdf2htmlEX/src}/util/const.cc (100%) rename {src => pdf2htmlEX/src}/util/const.h (100%) rename {src => pdf2htmlEX/src}/util/css_const.h.in (100%) rename {src => pdf2htmlEX/src}/util/encoding.cc (100%) rename {src => pdf2htmlEX/src}/util/encoding.h (100%) rename {src => pdf2htmlEX/src}/util/ffw.c (100%) rename {src => pdf2htmlEX/src}/util/ffw.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/autowidth.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/bitmapchar.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/cvimages.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/encoding.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/fvfonts.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/namelist.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/savefont.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/splineorder2.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/splineutil.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/splineutil2.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/start.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/tottf.h (100%) rename {src => pdf2htmlEX/src}/util/fontforge-2.0.20170731/views.h (100%) rename {src => pdf2htmlEX/src}/util/math.cc (100%) rename {src => pdf2htmlEX/src}/util/math.h (100%) rename {src => pdf2htmlEX/src}/util/mingw.cc (100%) rename {src => pdf2htmlEX/src}/util/mingw.h (100%) rename {src => pdf2htmlEX/src}/util/misc.cc (100%) rename {src => pdf2htmlEX/src}/util/misc.h (100%) rename {src => pdf2htmlEX/src}/util/namespace.h (100%) rename {src => pdf2htmlEX/src}/util/path.cc (100%) rename {src => pdf2htmlEX/src}/util/path.h (100%) rename {src => pdf2htmlEX/src}/util/unicode.cc (100%) rename {src => pdf2htmlEX/src}/util/unicode.h (100%) rename {test => pdf2htmlEX/test}/.gitattributes (100%) rename {test => pdf2htmlEX/test}/README.md (100%) rename {test => pdf2htmlEX/test}/browser_tests.py (100%) rename {test => pdf2htmlEX/test}/browser_tests/basic_text.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/basic_text.tex (100%) rename {test => pdf2htmlEX/test}/browser_tests/basic_text/basic_text.html (100%) rename {test => pdf2htmlEX/test}/browser_tests/fontfile3_opentype.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/fontfile3_opentype/fontfile3_opentype.html (100%) rename {test => pdf2htmlEX/test}/browser_tests/geneve_1564.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/geneve_1564/geneve_1564.html (100%) rename {test => pdf2htmlEX/test}/browser_tests/invalid_unicode_issue477.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/invalid_unicode_issue477/invalid_unicode_issue477.html (100%) rename {test => pdf2htmlEX/test}/browser_tests/svg_background_with_page_rotation_issue402.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/svg_background_with_page_rotation_issue402/svg_background_with_page_rotation_issue402.html (100%) rename {test => pdf2htmlEX/test}/browser_tests/test_fail.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/test_fail.tex (100%) rename {test => pdf2htmlEX/test}/browser_tests/test_fail/THIS_FOLDER_SHOULD_BE_EMPTY (100%) rename {test => pdf2htmlEX/test}/browser_tests/text_visibility.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/text_visibility/text_visibility.html (100%) rename {test => pdf2htmlEX/test}/browser_tests/with_form.pdf (100%) rename {test => pdf2htmlEX/test}/browser_tests/with_form/with_form.html (100%) rename {test => pdf2htmlEX/test}/fancy.min.css (100%) rename {test => pdf2htmlEX/test}/old/convert_to_woff.fontforge (100%) rename {test => pdf2htmlEX/test}/old/test.py (100%) rename {test => pdf2htmlEX/test}/start_xvfb.sh (100%) rename {test => pdf2htmlEX/test}/test.py.in (100%) rename {test => pdf2htmlEX/test}/test_local_browser.py (100%) rename {test => pdf2htmlEX/test}/test_output.py (100%) rename {test => pdf2htmlEX/test}/test_output/1-page.pdf (100%) rename {test => pdf2htmlEX/test}/test_output/2-pages.pdf (100%) rename {test => pdf2htmlEX/test}/test_output/3-pages.pdf (100%) rename {test => pdf2htmlEX/test}/test_output/issue501 (100%) rename {test => pdf2htmlEX/test}/test_remote_browser.py (100%) diff --git a/build_for_ppa.py b/archive/build_for_ppa.py similarity index 100% rename from build_for_ppa.py rename to archive/build_for_ppa.py diff --git a/dobuild b/buildScripts/dobuildPdf2htmlEX similarity index 100% rename from dobuild rename to buildScripts/dobuildPdf2htmlEX diff --git a/dobuildClang b/buildScripts/dobuildPdf2htmlEXClang similarity index 100% rename from dobuildClang rename to buildScripts/dobuildPdf2htmlEXClang diff --git a/doclean b/buildScripts/docleanPdf2htmlEX similarity index 100% rename from doclean rename to buildScripts/docleanPdf2htmlEX diff --git a/doinstall b/buildScripts/doinstallPdf2htmlEX similarity index 100% rename from doinstall rename to buildScripts/doinstallPdf2htmlEX diff --git a/3rdparty/PDF.js/LICENSE b/pdf2htmlEX/3rdparty/PDF.js/LICENSE similarity index 100% rename from 3rdparty/PDF.js/LICENSE rename to pdf2htmlEX/3rdparty/PDF.js/LICENSE diff --git a/3rdparty/PDF.js/build.sh b/pdf2htmlEX/3rdparty/PDF.js/build.sh similarity index 100% rename from 3rdparty/PDF.js/build.sh rename to pdf2htmlEX/3rdparty/PDF.js/build.sh diff --git a/3rdparty/PDF.js/compatibility.js b/pdf2htmlEX/3rdparty/PDF.js/compatibility.js similarity index 100% rename from 3rdparty/PDF.js/compatibility.js rename to pdf2htmlEX/3rdparty/PDF.js/compatibility.js diff --git a/3rdparty/PDF.js/compatibility.min.js b/pdf2htmlEX/3rdparty/PDF.js/compatibility.min.js similarity index 100% rename from 3rdparty/PDF.js/compatibility.min.js rename to pdf2htmlEX/3rdparty/PDF.js/compatibility.min.js diff --git a/3rdparty/closure-compiler/COPYING b/pdf2htmlEX/3rdparty/closure-compiler/COPYING similarity index 100% rename from 3rdparty/closure-compiler/COPYING rename to pdf2htmlEX/3rdparty/closure-compiler/COPYING diff --git a/3rdparty/closure-compiler/README b/pdf2htmlEX/3rdparty/closure-compiler/README similarity index 100% rename from 3rdparty/closure-compiler/README rename to pdf2htmlEX/3rdparty/closure-compiler/README diff --git a/3rdparty/closure-compiler/compiler.jar b/pdf2htmlEX/3rdparty/closure-compiler/compiler.jar similarity index 100% rename from 3rdparty/closure-compiler/compiler.jar rename to pdf2htmlEX/3rdparty/closure-compiler/compiler.jar diff --git a/3rdparty/poppler/COPYING3 b/pdf2htmlEX/3rdparty/poppler/COPYING3 similarity index 100% rename from 3rdparty/poppler/COPYING3 rename to pdf2htmlEX/3rdparty/poppler/COPYING3 diff --git a/3rdparty/poppler/git/CairoFontEngine.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc similarity index 100% rename from 3rdparty/poppler/git/CairoFontEngine.cc rename to pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc diff --git a/3rdparty/poppler/git/CairoFontEngine.h b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h similarity index 100% rename from 3rdparty/poppler/git/CairoFontEngine.h rename to pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h diff --git a/3rdparty/poppler/git/CairoOutputDev.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc similarity index 100% rename from 3rdparty/poppler/git/CairoOutputDev.cc rename to pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc diff --git a/3rdparty/poppler/git/CairoOutputDev.h b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h similarity index 100% rename from 3rdparty/poppler/git/CairoOutputDev.h rename to pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h diff --git a/3rdparty/poppler/git/CairoRescaleBox.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc similarity index 100% rename from 3rdparty/poppler/git/CairoRescaleBox.cc rename to pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc diff --git a/3rdparty/poppler/git/CairoRescaleBox.h b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.h similarity index 100% rename from 3rdparty/poppler/git/CairoRescaleBox.h rename to pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.h diff --git a/3rdparty/yuicompressor/LICENSE.TXT b/pdf2htmlEX/3rdparty/yuicompressor/LICENSE.TXT similarity index 100% rename from 3rdparty/yuicompressor/LICENSE.TXT rename to pdf2htmlEX/3rdparty/yuicompressor/LICENSE.TXT diff --git a/3rdparty/yuicompressor/yuicompressor-2.4.8.jar b/pdf2htmlEX/3rdparty/yuicompressor/yuicompressor-2.4.8.jar similarity index 100% rename from 3rdparty/yuicompressor/yuicompressor-2.4.8.jar rename to pdf2htmlEX/3rdparty/yuicompressor/yuicompressor-2.4.8.jar diff --git a/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt similarity index 100% rename from CMakeLists.txt rename to pdf2htmlEX/CMakeLists.txt diff --git a/CMakeLists.txt.patch b/pdf2htmlEX/CMakeLists.txt.patch similarity index 100% rename from CMakeLists.txt.patch rename to pdf2htmlEX/CMakeLists.txt.patch diff --git a/logo/LICENSE b/pdf2htmlEX/logo/LICENSE similarity index 100% rename from logo/LICENSE rename to pdf2htmlEX/logo/LICENSE diff --git a/logo/LICENSE_CC-BY-3.0 b/pdf2htmlEX/logo/LICENSE_CC-BY-3.0 similarity index 100% rename from logo/LICENSE_CC-BY-3.0 rename to pdf2htmlEX/logo/LICENSE_CC-BY-3.0 diff --git a/logo/design.svg b/pdf2htmlEX/logo/design.svg similarity index 100% rename from logo/design.svg rename to pdf2htmlEX/logo/design.svg diff --git a/logo/notes.txt b/pdf2htmlEX/logo/notes.txt similarity index 100% rename from logo/notes.txt rename to pdf2htmlEX/logo/notes.txt diff --git a/logo/pdf2htmlEX-256x256.png b/pdf2htmlEX/logo/pdf2htmlEX-256x256.png similarity index 100% rename from logo/pdf2htmlEX-256x256.png rename to pdf2htmlEX/logo/pdf2htmlEX-256x256.png diff --git a/logo/pdf2htmlEX-64x64.png b/pdf2htmlEX/logo/pdf2htmlEX-64x64.png similarity index 100% rename from logo/pdf2htmlEX-64x64.png rename to pdf2htmlEX/logo/pdf2htmlEX-64x64.png diff --git a/logo/pdf2htmlEX.svg b/pdf2htmlEX/logo/pdf2htmlEX.svg similarity index 100% rename from logo/pdf2htmlEX.svg rename to pdf2htmlEX/logo/pdf2htmlEX.svg diff --git a/logo/update_png.sh b/pdf2htmlEX/logo/update_png.sh similarity index 100% rename from logo/update_png.sh rename to pdf2htmlEX/logo/update_png.sh diff --git a/pdf2htmlEX.1.in b/pdf2htmlEX/pdf2htmlEX.1.in similarity index 100% rename from pdf2htmlEX.1.in rename to pdf2htmlEX/pdf2htmlEX.1.in diff --git a/share/LICENSE b/pdf2htmlEX/share/LICENSE similarity index 100% rename from share/LICENSE rename to pdf2htmlEX/share/LICENSE diff --git a/share/base.css.in b/pdf2htmlEX/share/base.css.in similarity index 100% rename from share/base.css.in rename to pdf2htmlEX/share/base.css.in diff --git a/share/build_css.sh b/pdf2htmlEX/share/build_css.sh similarity index 100% rename from share/build_css.sh rename to pdf2htmlEX/share/build_css.sh diff --git a/share/build_js.sh b/pdf2htmlEX/share/build_js.sh similarity index 100% rename from share/build_js.sh rename to pdf2htmlEX/share/build_js.sh diff --git a/share/fancy.css.in b/pdf2htmlEX/share/fancy.css.in similarity index 100% rename from share/fancy.css.in rename to pdf2htmlEX/share/fancy.css.in diff --git a/share/manifest b/pdf2htmlEX/share/manifest similarity index 100% rename from share/manifest rename to pdf2htmlEX/share/manifest diff --git a/share/pdf2htmlEX-64x64.png b/pdf2htmlEX/share/pdf2htmlEX-64x64.png similarity index 100% rename from share/pdf2htmlEX-64x64.png rename to pdf2htmlEX/share/pdf2htmlEX-64x64.png diff --git a/share/pdf2htmlEX.js.in b/pdf2htmlEX/share/pdf2htmlEX.js.in similarity index 100% rename from share/pdf2htmlEX.js.in rename to pdf2htmlEX/share/pdf2htmlEX.js.in diff --git a/src/ArgParser.cc b/pdf2htmlEX/src/ArgParser.cc similarity index 100% rename from src/ArgParser.cc rename to pdf2htmlEX/src/ArgParser.cc diff --git a/src/ArgParser.h b/pdf2htmlEX/src/ArgParser.h similarity index 100% rename from src/ArgParser.h rename to pdf2htmlEX/src/ArgParser.h diff --git a/src/BackgroundRenderer/BackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/BackgroundRenderer.cc similarity index 100% rename from src/BackgroundRenderer/BackgroundRenderer.cc rename to pdf2htmlEX/src/BackgroundRenderer/BackgroundRenderer.cc diff --git a/src/BackgroundRenderer/BackgroundRenderer.h b/pdf2htmlEX/src/BackgroundRenderer/BackgroundRenderer.h similarity index 100% rename from src/BackgroundRenderer/BackgroundRenderer.h rename to pdf2htmlEX/src/BackgroundRenderer/BackgroundRenderer.h diff --git a/src/BackgroundRenderer/CairoBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc similarity index 100% rename from src/BackgroundRenderer/CairoBackgroundRenderer.cc rename to pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.cc diff --git a/src/BackgroundRenderer/CairoBackgroundRenderer.h b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h similarity index 100% rename from src/BackgroundRenderer/CairoBackgroundRenderer.h rename to pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h diff --git a/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc similarity index 100% rename from src/BackgroundRenderer/SplashBackgroundRenderer.cc rename to pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc diff --git a/src/BackgroundRenderer/SplashBackgroundRenderer.h b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h similarity index 100% rename from src/BackgroundRenderer/SplashBackgroundRenderer.h rename to pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h diff --git a/src/Base64Stream.cc b/pdf2htmlEX/src/Base64Stream.cc similarity index 100% rename from src/Base64Stream.cc rename to pdf2htmlEX/src/Base64Stream.cc diff --git a/src/Base64Stream.h b/pdf2htmlEX/src/Base64Stream.h similarity index 100% rename from src/Base64Stream.h rename to pdf2htmlEX/src/Base64Stream.h diff --git a/src/Color.cc b/pdf2htmlEX/src/Color.cc similarity index 100% rename from src/Color.cc rename to pdf2htmlEX/src/Color.cc diff --git a/src/Color.h b/pdf2htmlEX/src/Color.h similarity index 100% rename from src/Color.h rename to pdf2htmlEX/src/Color.h diff --git a/src/CoveredTextDetector.cc b/pdf2htmlEX/src/CoveredTextDetector.cc similarity index 100% rename from src/CoveredTextDetector.cc rename to pdf2htmlEX/src/CoveredTextDetector.cc diff --git a/src/CoveredTextDetector.h b/pdf2htmlEX/src/CoveredTextDetector.h similarity index 100% rename from src/CoveredTextDetector.h rename to pdf2htmlEX/src/CoveredTextDetector.h diff --git a/src/DrawingTracer.cc b/pdf2htmlEX/src/DrawingTracer.cc similarity index 100% rename from src/DrawingTracer.cc rename to pdf2htmlEX/src/DrawingTracer.cc diff --git a/src/DrawingTracer.h b/pdf2htmlEX/src/DrawingTracer.h similarity index 100% rename from src/DrawingTracer.h rename to pdf2htmlEX/src/DrawingTracer.h diff --git a/src/HTMLRenderer/HTMLRenderer.h b/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h similarity index 100% rename from src/HTMLRenderer/HTMLRenderer.h rename to pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h diff --git a/src/HTMLRenderer/draw.cc b/pdf2htmlEX/src/HTMLRenderer/draw.cc similarity index 100% rename from src/HTMLRenderer/draw.cc rename to pdf2htmlEX/src/HTMLRenderer/draw.cc diff --git a/src/HTMLRenderer/font.cc b/pdf2htmlEX/src/HTMLRenderer/font.cc similarity index 100% rename from src/HTMLRenderer/font.cc rename to pdf2htmlEX/src/HTMLRenderer/font.cc diff --git a/src/HTMLRenderer/form.cc b/pdf2htmlEX/src/HTMLRenderer/form.cc similarity index 100% rename from src/HTMLRenderer/form.cc rename to pdf2htmlEX/src/HTMLRenderer/form.cc diff --git a/src/HTMLRenderer/general.cc b/pdf2htmlEX/src/HTMLRenderer/general.cc similarity index 100% rename from src/HTMLRenderer/general.cc rename to pdf2htmlEX/src/HTMLRenderer/general.cc diff --git a/src/HTMLRenderer/image.cc b/pdf2htmlEX/src/HTMLRenderer/image.cc similarity index 100% rename from src/HTMLRenderer/image.cc rename to pdf2htmlEX/src/HTMLRenderer/image.cc diff --git a/src/HTMLRenderer/link.cc b/pdf2htmlEX/src/HTMLRenderer/link.cc similarity index 100% rename from src/HTMLRenderer/link.cc rename to pdf2htmlEX/src/HTMLRenderer/link.cc diff --git a/src/HTMLRenderer/outline.cc b/pdf2htmlEX/src/HTMLRenderer/outline.cc similarity index 100% rename from src/HTMLRenderer/outline.cc rename to pdf2htmlEX/src/HTMLRenderer/outline.cc diff --git a/src/HTMLRenderer/state.cc b/pdf2htmlEX/src/HTMLRenderer/state.cc similarity index 100% rename from src/HTMLRenderer/state.cc rename to pdf2htmlEX/src/HTMLRenderer/state.cc diff --git a/src/HTMLRenderer/text.cc b/pdf2htmlEX/src/HTMLRenderer/text.cc similarity index 100% rename from src/HTMLRenderer/text.cc rename to pdf2htmlEX/src/HTMLRenderer/text.cc diff --git a/src/HTMLState.h b/pdf2htmlEX/src/HTMLState.h similarity index 100% rename from src/HTMLState.h rename to pdf2htmlEX/src/HTMLState.h diff --git a/src/HTMLTextLine.cc b/pdf2htmlEX/src/HTMLTextLine.cc similarity index 100% rename from src/HTMLTextLine.cc rename to pdf2htmlEX/src/HTMLTextLine.cc diff --git a/src/HTMLTextLine.h b/pdf2htmlEX/src/HTMLTextLine.h similarity index 100% rename from src/HTMLTextLine.h rename to pdf2htmlEX/src/HTMLTextLine.h diff --git a/src/HTMLTextPage.cc b/pdf2htmlEX/src/HTMLTextPage.cc similarity index 100% rename from src/HTMLTextPage.cc rename to pdf2htmlEX/src/HTMLTextPage.cc diff --git a/src/HTMLTextPage.h b/pdf2htmlEX/src/HTMLTextPage.h similarity index 100% rename from src/HTMLTextPage.h rename to pdf2htmlEX/src/HTMLTextPage.h diff --git a/src/Param.h b/pdf2htmlEX/src/Param.h similarity index 100% rename from src/Param.h rename to pdf2htmlEX/src/Param.h diff --git a/src/Preprocessor.cc b/pdf2htmlEX/src/Preprocessor.cc similarity index 100% rename from src/Preprocessor.cc rename to pdf2htmlEX/src/Preprocessor.cc diff --git a/src/Preprocessor.h b/pdf2htmlEX/src/Preprocessor.h similarity index 100% rename from src/Preprocessor.h rename to pdf2htmlEX/src/Preprocessor.h diff --git a/src/StateManager.h b/pdf2htmlEX/src/StateManager.h similarity index 100% rename from src/StateManager.h rename to pdf2htmlEX/src/StateManager.h diff --git a/src/StringFormatter.cc b/pdf2htmlEX/src/StringFormatter.cc similarity index 100% rename from src/StringFormatter.cc rename to pdf2htmlEX/src/StringFormatter.cc diff --git a/src/StringFormatter.h b/pdf2htmlEX/src/StringFormatter.h similarity index 100% rename from src/StringFormatter.h rename to pdf2htmlEX/src/StringFormatter.h diff --git a/src/TmpFiles.cc b/pdf2htmlEX/src/TmpFiles.cc similarity index 100% rename from src/TmpFiles.cc rename to pdf2htmlEX/src/TmpFiles.cc diff --git a/src/TmpFiles.h b/pdf2htmlEX/src/TmpFiles.h similarity index 100% rename from src/TmpFiles.h rename to pdf2htmlEX/src/TmpFiles.h diff --git a/src/css_class_names.cmakelists.txt b/pdf2htmlEX/src/css_class_names.cmakelists.txt similarity index 100% rename from src/css_class_names.cmakelists.txt rename to pdf2htmlEX/src/css_class_names.cmakelists.txt diff --git a/src/pdf2htmlEX-config.h.in b/pdf2htmlEX/src/pdf2htmlEX-config.h.in similarity index 100% rename from src/pdf2htmlEX-config.h.in rename to pdf2htmlEX/src/pdf2htmlEX-config.h.in diff --git a/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc similarity index 100% rename from src/pdf2htmlEX.cc rename to pdf2htmlEX/src/pdf2htmlEX.cc diff --git a/src/util/const.cc b/pdf2htmlEX/src/util/const.cc similarity index 100% rename from src/util/const.cc rename to pdf2htmlEX/src/util/const.cc diff --git a/src/util/const.h b/pdf2htmlEX/src/util/const.h similarity index 100% rename from src/util/const.h rename to pdf2htmlEX/src/util/const.h diff --git a/src/util/css_const.h.in b/pdf2htmlEX/src/util/css_const.h.in similarity index 100% rename from src/util/css_const.h.in rename to pdf2htmlEX/src/util/css_const.h.in diff --git a/src/util/encoding.cc b/pdf2htmlEX/src/util/encoding.cc similarity index 100% rename from src/util/encoding.cc rename to pdf2htmlEX/src/util/encoding.cc diff --git a/src/util/encoding.h b/pdf2htmlEX/src/util/encoding.h similarity index 100% rename from src/util/encoding.h rename to pdf2htmlEX/src/util/encoding.h diff --git a/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c similarity index 100% rename from src/util/ffw.c rename to pdf2htmlEX/src/util/ffw.c diff --git a/src/util/ffw.h b/pdf2htmlEX/src/util/ffw.h similarity index 100% rename from src/util/ffw.h rename to pdf2htmlEX/src/util/ffw.h diff --git a/src/util/fontforge-2.0.20170731/autowidth.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/autowidth.h similarity index 100% rename from src/util/fontforge-2.0.20170731/autowidth.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/autowidth.h diff --git a/src/util/fontforge-2.0.20170731/bitmapchar.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/bitmapchar.h similarity index 100% rename from src/util/fontforge-2.0.20170731/bitmapchar.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/bitmapchar.h diff --git a/src/util/fontforge-2.0.20170731/cvimages.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/cvimages.h similarity index 100% rename from src/util/fontforge-2.0.20170731/cvimages.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/cvimages.h diff --git a/src/util/fontforge-2.0.20170731/encoding.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/encoding.h similarity index 100% rename from src/util/fontforge-2.0.20170731/encoding.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/encoding.h diff --git a/src/util/fontforge-2.0.20170731/fvfonts.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/fvfonts.h similarity index 100% rename from src/util/fontforge-2.0.20170731/fvfonts.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/fvfonts.h diff --git a/src/util/fontforge-2.0.20170731/namelist.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/namelist.h similarity index 100% rename from src/util/fontforge-2.0.20170731/namelist.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/namelist.h diff --git a/src/util/fontforge-2.0.20170731/savefont.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/savefont.h similarity index 100% rename from src/util/fontforge-2.0.20170731/savefont.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/savefont.h diff --git a/src/util/fontforge-2.0.20170731/splineorder2.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/splineorder2.h similarity index 100% rename from src/util/fontforge-2.0.20170731/splineorder2.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/splineorder2.h diff --git a/src/util/fontforge-2.0.20170731/splineutil.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil.h similarity index 100% rename from src/util/fontforge-2.0.20170731/splineutil.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil.h diff --git a/src/util/fontforge-2.0.20170731/splineutil2.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil2.h similarity index 100% rename from src/util/fontforge-2.0.20170731/splineutil2.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil2.h diff --git a/src/util/fontforge-2.0.20170731/start.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/start.h similarity index 100% rename from src/util/fontforge-2.0.20170731/start.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/start.h diff --git a/src/util/fontforge-2.0.20170731/tottf.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/tottf.h similarity index 100% rename from src/util/fontforge-2.0.20170731/tottf.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/tottf.h diff --git a/src/util/fontforge-2.0.20170731/views.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/views.h similarity index 100% rename from src/util/fontforge-2.0.20170731/views.h rename to pdf2htmlEX/src/util/fontforge-2.0.20170731/views.h diff --git a/src/util/math.cc b/pdf2htmlEX/src/util/math.cc similarity index 100% rename from src/util/math.cc rename to pdf2htmlEX/src/util/math.cc diff --git a/src/util/math.h b/pdf2htmlEX/src/util/math.h similarity index 100% rename from src/util/math.h rename to pdf2htmlEX/src/util/math.h diff --git a/src/util/mingw.cc b/pdf2htmlEX/src/util/mingw.cc similarity index 100% rename from src/util/mingw.cc rename to pdf2htmlEX/src/util/mingw.cc diff --git a/src/util/mingw.h b/pdf2htmlEX/src/util/mingw.h similarity index 100% rename from src/util/mingw.h rename to pdf2htmlEX/src/util/mingw.h diff --git a/src/util/misc.cc b/pdf2htmlEX/src/util/misc.cc similarity index 100% rename from src/util/misc.cc rename to pdf2htmlEX/src/util/misc.cc diff --git a/src/util/misc.h b/pdf2htmlEX/src/util/misc.h similarity index 100% rename from src/util/misc.h rename to pdf2htmlEX/src/util/misc.h diff --git a/src/util/namespace.h b/pdf2htmlEX/src/util/namespace.h similarity index 100% rename from src/util/namespace.h rename to pdf2htmlEX/src/util/namespace.h diff --git a/src/util/path.cc b/pdf2htmlEX/src/util/path.cc similarity index 100% rename from src/util/path.cc rename to pdf2htmlEX/src/util/path.cc diff --git a/src/util/path.h b/pdf2htmlEX/src/util/path.h similarity index 100% rename from src/util/path.h rename to pdf2htmlEX/src/util/path.h diff --git a/src/util/unicode.cc b/pdf2htmlEX/src/util/unicode.cc similarity index 100% rename from src/util/unicode.cc rename to pdf2htmlEX/src/util/unicode.cc diff --git a/src/util/unicode.h b/pdf2htmlEX/src/util/unicode.h similarity index 100% rename from src/util/unicode.h rename to pdf2htmlEX/src/util/unicode.h diff --git a/test/.gitattributes b/pdf2htmlEX/test/.gitattributes similarity index 100% rename from test/.gitattributes rename to pdf2htmlEX/test/.gitattributes diff --git a/test/README.md b/pdf2htmlEX/test/README.md similarity index 100% rename from test/README.md rename to pdf2htmlEX/test/README.md diff --git a/test/browser_tests.py b/pdf2htmlEX/test/browser_tests.py similarity index 100% rename from test/browser_tests.py rename to pdf2htmlEX/test/browser_tests.py diff --git a/test/browser_tests/basic_text.pdf b/pdf2htmlEX/test/browser_tests/basic_text.pdf similarity index 100% rename from test/browser_tests/basic_text.pdf rename to pdf2htmlEX/test/browser_tests/basic_text.pdf diff --git a/test/browser_tests/basic_text.tex b/pdf2htmlEX/test/browser_tests/basic_text.tex similarity index 100% rename from test/browser_tests/basic_text.tex rename to pdf2htmlEX/test/browser_tests/basic_text.tex diff --git a/test/browser_tests/basic_text/basic_text.html b/pdf2htmlEX/test/browser_tests/basic_text/basic_text.html similarity index 100% rename from test/browser_tests/basic_text/basic_text.html rename to pdf2htmlEX/test/browser_tests/basic_text/basic_text.html diff --git a/test/browser_tests/fontfile3_opentype.pdf b/pdf2htmlEX/test/browser_tests/fontfile3_opentype.pdf similarity index 100% rename from test/browser_tests/fontfile3_opentype.pdf rename to pdf2htmlEX/test/browser_tests/fontfile3_opentype.pdf diff --git a/test/browser_tests/fontfile3_opentype/fontfile3_opentype.html b/pdf2htmlEX/test/browser_tests/fontfile3_opentype/fontfile3_opentype.html similarity index 100% rename from test/browser_tests/fontfile3_opentype/fontfile3_opentype.html rename to pdf2htmlEX/test/browser_tests/fontfile3_opentype/fontfile3_opentype.html diff --git a/test/browser_tests/geneve_1564.pdf b/pdf2htmlEX/test/browser_tests/geneve_1564.pdf similarity index 100% rename from test/browser_tests/geneve_1564.pdf rename to pdf2htmlEX/test/browser_tests/geneve_1564.pdf diff --git a/test/browser_tests/geneve_1564/geneve_1564.html b/pdf2htmlEX/test/browser_tests/geneve_1564/geneve_1564.html similarity index 100% rename from test/browser_tests/geneve_1564/geneve_1564.html rename to pdf2htmlEX/test/browser_tests/geneve_1564/geneve_1564.html diff --git a/test/browser_tests/invalid_unicode_issue477.pdf b/pdf2htmlEX/test/browser_tests/invalid_unicode_issue477.pdf similarity index 100% rename from test/browser_tests/invalid_unicode_issue477.pdf rename to pdf2htmlEX/test/browser_tests/invalid_unicode_issue477.pdf diff --git a/test/browser_tests/invalid_unicode_issue477/invalid_unicode_issue477.html b/pdf2htmlEX/test/browser_tests/invalid_unicode_issue477/invalid_unicode_issue477.html similarity index 100% rename from test/browser_tests/invalid_unicode_issue477/invalid_unicode_issue477.html rename to pdf2htmlEX/test/browser_tests/invalid_unicode_issue477/invalid_unicode_issue477.html diff --git a/test/browser_tests/svg_background_with_page_rotation_issue402.pdf b/pdf2htmlEX/test/browser_tests/svg_background_with_page_rotation_issue402.pdf similarity index 100% rename from test/browser_tests/svg_background_with_page_rotation_issue402.pdf rename to pdf2htmlEX/test/browser_tests/svg_background_with_page_rotation_issue402.pdf diff --git a/test/browser_tests/svg_background_with_page_rotation_issue402/svg_background_with_page_rotation_issue402.html b/pdf2htmlEX/test/browser_tests/svg_background_with_page_rotation_issue402/svg_background_with_page_rotation_issue402.html similarity index 100% rename from test/browser_tests/svg_background_with_page_rotation_issue402/svg_background_with_page_rotation_issue402.html rename to pdf2htmlEX/test/browser_tests/svg_background_with_page_rotation_issue402/svg_background_with_page_rotation_issue402.html diff --git a/test/browser_tests/test_fail.pdf b/pdf2htmlEX/test/browser_tests/test_fail.pdf similarity index 100% rename from test/browser_tests/test_fail.pdf rename to pdf2htmlEX/test/browser_tests/test_fail.pdf diff --git a/test/browser_tests/test_fail.tex b/pdf2htmlEX/test/browser_tests/test_fail.tex similarity index 100% rename from test/browser_tests/test_fail.tex rename to pdf2htmlEX/test/browser_tests/test_fail.tex diff --git a/test/browser_tests/test_fail/THIS_FOLDER_SHOULD_BE_EMPTY b/pdf2htmlEX/test/browser_tests/test_fail/THIS_FOLDER_SHOULD_BE_EMPTY similarity index 100% rename from test/browser_tests/test_fail/THIS_FOLDER_SHOULD_BE_EMPTY rename to pdf2htmlEX/test/browser_tests/test_fail/THIS_FOLDER_SHOULD_BE_EMPTY diff --git a/test/browser_tests/text_visibility.pdf b/pdf2htmlEX/test/browser_tests/text_visibility.pdf similarity index 100% rename from test/browser_tests/text_visibility.pdf rename to pdf2htmlEX/test/browser_tests/text_visibility.pdf diff --git a/test/browser_tests/text_visibility/text_visibility.html b/pdf2htmlEX/test/browser_tests/text_visibility/text_visibility.html similarity index 100% rename from test/browser_tests/text_visibility/text_visibility.html rename to pdf2htmlEX/test/browser_tests/text_visibility/text_visibility.html diff --git a/test/browser_tests/with_form.pdf b/pdf2htmlEX/test/browser_tests/with_form.pdf similarity index 100% rename from test/browser_tests/with_form.pdf rename to pdf2htmlEX/test/browser_tests/with_form.pdf diff --git a/test/browser_tests/with_form/with_form.html b/pdf2htmlEX/test/browser_tests/with_form/with_form.html similarity index 100% rename from test/browser_tests/with_form/with_form.html rename to pdf2htmlEX/test/browser_tests/with_form/with_form.html diff --git a/test/fancy.min.css b/pdf2htmlEX/test/fancy.min.css similarity index 100% rename from test/fancy.min.css rename to pdf2htmlEX/test/fancy.min.css diff --git a/test/old/convert_to_woff.fontforge b/pdf2htmlEX/test/old/convert_to_woff.fontforge similarity index 100% rename from test/old/convert_to_woff.fontforge rename to pdf2htmlEX/test/old/convert_to_woff.fontforge diff --git a/test/old/test.py b/pdf2htmlEX/test/old/test.py similarity index 100% rename from test/old/test.py rename to pdf2htmlEX/test/old/test.py diff --git a/test/start_xvfb.sh b/pdf2htmlEX/test/start_xvfb.sh similarity index 100% rename from test/start_xvfb.sh rename to pdf2htmlEX/test/start_xvfb.sh diff --git a/test/test.py.in b/pdf2htmlEX/test/test.py.in similarity index 100% rename from test/test.py.in rename to pdf2htmlEX/test/test.py.in diff --git a/test/test_local_browser.py b/pdf2htmlEX/test/test_local_browser.py similarity index 100% rename from test/test_local_browser.py rename to pdf2htmlEX/test/test_local_browser.py diff --git a/test/test_output.py b/pdf2htmlEX/test/test_output.py similarity index 100% rename from test/test_output.py rename to pdf2htmlEX/test/test_output.py diff --git a/test/test_output/1-page.pdf b/pdf2htmlEX/test/test_output/1-page.pdf similarity index 100% rename from test/test_output/1-page.pdf rename to pdf2htmlEX/test/test_output/1-page.pdf diff --git a/test/test_output/2-pages.pdf b/pdf2htmlEX/test/test_output/2-pages.pdf similarity index 100% rename from test/test_output/2-pages.pdf rename to pdf2htmlEX/test/test_output/2-pages.pdf diff --git a/test/test_output/3-pages.pdf b/pdf2htmlEX/test/test_output/3-pages.pdf similarity index 100% rename from test/test_output/3-pages.pdf rename to pdf2htmlEX/test/test_output/3-pages.pdf diff --git a/test/test_output/issue501 b/pdf2htmlEX/test/test_output/issue501 similarity index 100% rename from test/test_output/issue501 rename to pdf2htmlEX/test/test_output/issue501 diff --git a/test/test_remote_browser.py b/pdf2htmlEX/test/test_remote_browser.py similarity index 100% rename from test/test_remote_browser.py rename to pdf2htmlEX/test/test_remote_browser.py From 87ecadd58969d93dc1ed205db067d2069d4ee248 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 13:31:28 +0000 Subject: [PATCH 002/269] added buildScripts --- .gitignore | 1 + buildScripts/buildFontforge | 4 +++ .../{dobuildPdf2htmlEX => buildPdf2htmlEX} | 0 ...ldPdf2htmlEXClang => buildPdf2htmlEXClang} | 0 buildScripts/buildPoppler | 10 ++++++ .../{docleanPdf2htmlEX => cleanPdf2htmlEX} | 0 buildScripts/getFontforge | 8 +++++ buildScripts/getPoppler | 15 +++++++++ buildScripts/installFontforge | 26 +++++++++++++++ ...{doinstallPdf2htmlEX => installPdf2htmlEX} | 0 buildScripts/installPoppler | 32 +++++++++++++++++++ buildScripts/versionEnvs | 9 ++++++ 12 files changed, 105 insertions(+) create mode 100755 buildScripts/buildFontforge rename buildScripts/{dobuildPdf2htmlEX => buildPdf2htmlEX} (100%) rename buildScripts/{dobuildPdf2htmlEXClang => buildPdf2htmlEXClang} (100%) create mode 100755 buildScripts/buildPoppler rename buildScripts/{docleanPdf2htmlEX => cleanPdf2htmlEX} (100%) create mode 100755 buildScripts/getFontforge create mode 100755 buildScripts/getPoppler create mode 100755 buildScripts/installFontforge rename buildScripts/{doinstallPdf2htmlEX => installPdf2htmlEX} (100%) create mode 100755 buildScripts/installPoppler create mode 100644 buildScripts/versionEnvs diff --git a/.gitignore b/.gitignore index c49977f..fb14b58 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +poppler* build compile_commands.json CMakeCache.txt diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge new file mode 100755 index 0000000..2177738 --- /dev/null +++ b/buildScripts/buildFontforge @@ -0,0 +1,4 @@ +cd fontforge; +./bootstrap; +./configure; +make; diff --git a/buildScripts/dobuildPdf2htmlEX b/buildScripts/buildPdf2htmlEX similarity index 100% rename from buildScripts/dobuildPdf2htmlEX rename to buildScripts/buildPdf2htmlEX diff --git a/buildScripts/dobuildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang similarity index 100% rename from buildScripts/dobuildPdf2htmlEXClang rename to buildScripts/buildPdf2htmlEXClang diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler new file mode 100755 index 0000000..2cda28c --- /dev/null +++ b/buildScripts/buildPoppler @@ -0,0 +1,10 @@ +#!/bin/bash + +# This bash script builds the latest poppler + +cd poppler +mkdir build +cd build +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ + -DENABLE_LIBOPENJPEG=none .. +make diff --git a/buildScripts/docleanPdf2htmlEX b/buildScripts/cleanPdf2htmlEX similarity index 100% rename from buildScripts/docleanPdf2htmlEX rename to buildScripts/cleanPdf2htmlEX diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge new file mode 100755 index 0000000..d1094f7 --- /dev/null +++ b/buildScripts/getFontforge @@ -0,0 +1,8 @@ +#!/bin/bash + +# This bash script gets and unpacks the latest fontforge AppImage + +sudo add-apt-repository ppa:fontforge/fontforge +sudo apt-get update +sudo apt-get install libfontforge-dev + diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler new file mode 100755 index 0000000..1fce35d --- /dev/null +++ b/buildScripts/getPoppler @@ -0,0 +1,15 @@ +#!/bin/bash + +# This bash script gets and unpacks the latest Poppler source code + +source buildScripts/versionEnvs + +echo "Getting poppler version: $POPPLER_VERSION" + +rm -rf $POPPLER_VERSION.tar.xz + +wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz + +tar xvf $POPPLER_VERSION.tar.xz + +mv $POPPLER_VERSION poppler diff --git a/buildScripts/installFontforge b/buildScripts/installFontforge new file mode 100755 index 0000000..7c57186 --- /dev/null +++ b/buildScripts/installFontforge @@ -0,0 +1,26 @@ +#!/bin/bash + +echo "This installation assumes you have 'sudo' privileges" +echo "Type ctrl-c now if DO NOT want to continue" +read -p "Type anything else to continue: " + +cd poppler +sudo make install +sudo ldconfig; + +#cd +# +#sudo mkdir -p /usr/include/poppler +#sudo cp poppler/poppler/*.h /usr/include/poppler +# +#sudo mkdir -p /usr/include/poppler/goo +#sudo cp poppler/goo/*.h /usr/include/poppler/goo +# +#sudo mkdir -p /usr/include/poppler/fofi +#sudo cp poppler/fofi/*.h /usr/include/poppler/fofi +# +#sudo mkdir -p /usr/include/poppler/splash +#sudo cp poppler/splash/*.h /usr/include/poppler/splash +# +#sudo cp poppler/build/poppler/poppler-config.h \ +# /usr/include/poppler diff --git a/buildScripts/doinstallPdf2htmlEX b/buildScripts/installPdf2htmlEX similarity index 100% rename from buildScripts/doinstallPdf2htmlEX rename to buildScripts/installPdf2htmlEX diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler new file mode 100755 index 0000000..605e0b3 --- /dev/null +++ b/buildScripts/installPoppler @@ -0,0 +1,32 @@ +#!/bin/bash + +# This bash script installs Poppler into the local system + +echo "WARNING: this will over-write any existing" +echo "Poppler version you have installed on your system." +echo "This may break other packages/applications." +echo "" +echo "This installation assumes you have 'sudo' privileges." +echo "" +echo "Type ctrl-c now if DO NOT want to continue" +read -p "Type anything else to continue: " + +cd poppler/build +sudo make install + +cd + +sudo mkdir -p /usr/include/poppler +sudo cp poppler/poppler/*.h /usr/include/poppler + +sudo mkdir -p /usr/include/poppler/goo +sudo cp poppler/goo/*.h /usr/include/poppler/goo + +sudo mkdir -p /usr/include/poppler/fofi +sudo cp poppler/fofi/*.h /usr/include/poppler/fofi + +sudo mkdir -p /usr/include/poppler/splash +sudo cp poppler/splash/*.h /usr/include/poppler/splash + +sudo cp poppler/build/poppler/poppler-config.h \ + /usr/include/poppler diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs new file mode 100644 index 0000000..4a97bb0 --- /dev/null +++ b/buildScripts/versionEnvs @@ -0,0 +1,9 @@ +#!/bin/bash + +# This bash script exports environment variables for the latest software +# versions + +export POPPLER_VERSION=poppler-0.82.0 +export FONTFORGE_VERSION=20190801 + +export FONTFORGE_APPIMAGE=https://github.com/fontforge/fontforge/releases/download/20190801/FontForge-2019-08-01-ac635b8-x86_64.AppImage From 3f943cddeb1c1b82d57b2482c7f337c0032a9cb7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 14:13:14 +0000 Subject: [PATCH 003/269] updated getFontForge --- .gitignore | 2 ++ buildScripts/getFontforge | 21 ++++++++++++++++++--- buildScripts/getPoppler | 1 + buildScripts/versionEnvs | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index fb14b58..d2f4091 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +fontforge* +FontForge* poppler* build compile_commands.json diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index d1094f7..90caf9d 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -2,7 +2,22 @@ # This bash script gets and unpacks the latest fontforge AppImage -sudo add-apt-repository ppa:fontforge/fontforge -sudo apt-get update -sudo apt-get install libfontforge-dev +# The ppa is "rather old" ;-( +#sudo add-apt-repository ppa:fontforge/fontforge +#sudo apt-get update +#sudo apt-get install libfontforge-dev + +source buildScripts/versionEnvs + +rm -rf $FONTFORGE_APPIMAGE +rm -rf squashfs-root +rm -rf fontforge + +wget https://github.com/fontforge/fontforge/releases/download/$FONTFORGE_VERSION/$FONTFORGE_APPIMAGE + +chmod a+x $FONTFORGE_APPIMAGE + +./$FONTFORGE_APPIMAGE --appimage-extract + +mv squashfs-root fontforge diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index 1fce35d..ce9474f 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -7,6 +7,7 @@ source buildScripts/versionEnvs echo "Getting poppler version: $POPPLER_VERSION" rm -rf $POPPLER_VERSION.tar.xz +rm -rf poppler wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 4a97bb0..e53354a 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -6,4 +6,4 @@ export POPPLER_VERSION=poppler-0.82.0 export FONTFORGE_VERSION=20190801 -export FONTFORGE_APPIMAGE=https://github.com/fontforge/fontforge/releases/download/20190801/FontForge-2019-08-01-ac635b8-x86_64.AppImage +export FONTFORGE_APPIMAGE=FontForge-2019-08-01-ac635b8-x86_64.AppImage From 4a6f578e55668ffe4f250e1c19c3ce9fcfe72743 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 14:24:29 +0000 Subject: [PATCH 004/269] updated getFontForge to simply get the source --- buildScripts/getFontforge | 19 ++++++------------- buildScripts/versionEnvs | 4 +--- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 90caf9d..b5790a2 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -2,22 +2,15 @@ # This bash script gets and unpacks the latest fontforge AppImage -# The ppa is "rather old" ;-( -#sudo add-apt-repository ppa:fontforge/fontforge -#sudo apt-get update -#sudo apt-get install libfontforge-dev - source buildScripts/versionEnvs -rm -rf $FONTFORGE_APPIMAGE -rm -rf squashfs-root +FONTFORGE_SRC=fontforge-$FONTFORGE_VERSION.tar.gz + +rm -rf $FONTFORGE_SRC rm -rf fontforge -wget https://github.com/fontforge/fontforge/releases/download/$FONTFORGE_VERSION/$FONTFORGE_APPIMAGE +wget https://github.com/fontforge/fontforge/releases/download/$FONTFORGE_VERSION/$FONTFORGE_SRC -chmod a+x $FONTFORGE_APPIMAGE - -./$FONTFORGE_APPIMAGE --appimage-extract - -mv squashfs-root fontforge +tar xvf $FONTFORGE_SRC +mv fontforge-$FONTFORGE_VERSION fontforge diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index e53354a..2a6e589 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -1,9 +1,7 @@ #!/bin/bash -# This bash script exports environment variables for the latest software +# This bash script exports environment variables for the latest software # versions export POPPLER_VERSION=poppler-0.82.0 export FONTFORGE_VERSION=20190801 - -export FONTFORGE_APPIMAGE=FontForge-2019-08-01-ac635b8-x86_64.AppImage From 4a29b8bc1503f0a2a6b63accafd65fc05259a7f6 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 15:36:04 +0000 Subject: [PATCH 005/269] added apt based get scripts --- buildScripts/getBuildTools | 15 +++++++++++++++ buildScripts/getDevLibraries | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 buildScripts/getBuildTools create mode 100644 buildScripts/getDevLibraries diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools new file mode 100644 index 0000000..34cfb5a --- /dev/null +++ b/buildScripts/getBuildTools @@ -0,0 +1,15 @@ +#!/bin/bash + +# This bash script automates getting the required build tools (apt install) + +sudo apt install \ + aptitude \ + git \ + pkg-config \ + ruby \ + cmake \ + make \ + gcc \ + g++ \ + tree + diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries new file mode 100644 index 0000000..5c76724 --- /dev/null +++ b/buildScripts/getDevLibraries @@ -0,0 +1,14 @@ +#!/bin/bash + +# This bash script automates the getting of the development libraries +# required to build poppler and fontforge + +sudo apt install \ + libcairo-dev \ + libspiro-dev \ + libpng-dev \ + libjpeg-dev \ + poppler-data \ + libpango1.0-dev \ + liblcms2-dev + From 1bf18efff91451a783b6b9fddccb3bbd36c91b0f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 15:37:18 +0000 Subject: [PATCH 006/269] added apt based get scripts --- buildScripts/getBuildTools | 0 buildScripts/getDevLibraries | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 buildScripts/getBuildTools mode change 100644 => 100755 buildScripts/getDevLibraries diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools old mode 100644 new mode 100755 diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries old mode 100644 new mode 100755 From 42244c55b74b8adf243c0e4ca816e9255d4508ef Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 15:42:49 +0000 Subject: [PATCH 007/269] added getPdf2htmlEX --- buildScripts/getPdf2htmlEX | 16 ++++++++++++++++ buildScripts/versionEnvs | 1 + 2 files changed, 17 insertions(+) create mode 100755 buildScripts/getPdf2htmlEX diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX new file mode 100755 index 0000000..ff311bd --- /dev/null +++ b/buildScripts/getPdf2htmlEX @@ -0,0 +1,16 @@ +#!/bin/bash + +# This bash script automates the process of getting the original pdf2htmlEX +# source + +PDF2HTMLEX_VERSION=newBuildSystem + +wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_VERSION + +mv $PDF2HTMLEX_VERSION $PDF2HTMLEX_VERSION.zip + +sudo apt get unzip + +unzip $PDF2HTMLEX_VERSION.zip + +mv pdf2htmlEX-$PDF2HTMLEX_VERSION pdf2htmlEX diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 2a6e589..c4e9ed4 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -5,3 +5,4 @@ export POPPLER_VERSION=poppler-0.82.0 export FONTFORGE_VERSION=20190801 +export PDF2HTMLEX_VERSION=newBuildSystem From 2e618dbac4e2d25a5d29f0fb70a443d4f99cf0ac Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 15:45:52 +0000 Subject: [PATCH 008/269] turned travis off for the moment --- .travis.yml => .travis.yml.off | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml => .travis.yml.off (100%) diff --git a/.travis.yml b/.travis.yml.off similarity index 100% rename from .travis.yml rename to .travis.yml.off From f82e1cbd585fb28432f03c8339ed19216fa8a9ed Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 15:54:21 +0000 Subject: [PATCH 009/269] corrected the apt get scripts --- buildScripts/getBuildTools | 23 +++++++++++++---------- buildScripts/getDevLibraries | 21 ++++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools index 34cfb5a..711532d 100755 --- a/buildScripts/getBuildTools +++ b/buildScripts/getBuildTools @@ -2,14 +2,17 @@ # This bash script automates getting the required build tools (apt install) -sudo apt install \ - aptitude \ - git \ - pkg-config \ - ruby \ - cmake \ - make \ - gcc \ - g++ \ - tree +# set the bash environment variable 'UNATTENDED' to '--assume-yes' for +# unattended use (for example in the .travis.yml script) + +sudo apt $UNATTENDED install \ + aptitude \ + git \ + pkg-config \ + ruby \ + cmake \ + make \ + gcc \ + g++ \ + tree diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index 5c76724..63d7a68 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -1,14 +1,17 @@ #!/bin/bash -# This bash script automates the getting of the development libraries -# required to build poppler and fontforge +# This bash script automates getting the development libraries required to +# build poppler and fontforge -sudo apt install \ - libcairo-dev \ - libspiro-dev \ - libpng-dev \ - libjpeg-dev \ - poppler-data \ - libpango1.0-dev \ +# set the bash environment variable 'UNATTENDED' to '--assume-yes' for +# unattended use (for example in the .travis.yml script) + +sudo apt $UNATTENDED install \ + libcairo-dev \ + libspiro-dev \ + libpng-dev \ + libjpeg-dev \ + poppler-data \ + libpango1.0-dev \ liblcms2-dev From 9f48bcd107310b80b8140ee11d6c897aecce5244 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 16:03:35 +0000 Subject: [PATCH 010/269] updated build scripts --- buildScripts/buildFontforge | 8 ++++---- buildScripts/buildPdf2htmlEX | 4 ++-- buildScripts/buildPoppler | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 2177738..8168b08 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -1,4 +1,4 @@ -cd fontforge; -./bootstrap; -./configure; -make; +cd fontforge +./bootstrap +./configure +make -j `nproc` diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index 97e5ac1..399912c 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -1,4 +1,4 @@ mkdir build cd build -cmake .. -make +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. +make -j `nproc` diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 2cda28c..c9e6a98 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -7,4 +7,4 @@ mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ -DENABLE_LIBOPENJPEG=none .. -make +make -j `nproc` From 03bdc9bda76d35707f12bb8d5ed1c8566a4e414c Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 16:33:24 +0000 Subject: [PATCH 011/269] continued correcting buildscripts --- buildScripts/getBuildTools | 1 + buildScripts/getDevLibraries | 4 +++- buildScripts/installFontforge | 9 +++++++-- buildScripts/installPoppler | 12 ++++++------ buildScripts/versionEnvs | 6 ++++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools index 711532d..5d02109 100755 --- a/buildScripts/getBuildTools +++ b/buildScripts/getBuildTools @@ -14,5 +14,6 @@ sudo apt $UNATTENDED install \ make \ gcc \ g++ \ + gettext \ tree diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index 63d7a68..eab6818 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -13,5 +13,7 @@ sudo apt $UNATTENDED install \ libjpeg-dev \ poppler-data \ libpango1.0-dev \ - liblcms2-dev + liblcms2-dev \ + libxml2-dev \ + libuninameslist-dev diff --git a/buildScripts/installFontforge b/buildScripts/installFontforge index 7c57186..e5eb120 100755 --- a/buildScripts/installFontforge +++ b/buildScripts/installFontforge @@ -1,10 +1,15 @@ #!/bin/bash -echo "This installation assumes you have 'sudo' privileges" +echo "WARNING: this will over-write any existing" +echo "FontForge version you have installed on your system." +echo "This may break other packages/applications." +echo "" +echo "This installation assumes you have 'sudo' privileges." +echo "" echo "Type ctrl-c now if DO NOT want to continue" read -p "Type anything else to continue: " -cd poppler +cd fontforge sudo make install sudo ldconfig; diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler index 605e0b3..6b5f540 100755 --- a/buildScripts/installPoppler +++ b/buildScripts/installPoppler @@ -14,19 +14,19 @@ read -p "Type anything else to continue: " cd poppler/build sudo make install -cd +cd .. sudo mkdir -p /usr/include/poppler -sudo cp poppler/poppler/*.h /usr/include/poppler +sudo cp poppler/*.h /usr/include/poppler sudo mkdir -p /usr/include/poppler/goo -sudo cp poppler/goo/*.h /usr/include/poppler/goo +sudo cp goo/*.h /usr/include/poppler/goo sudo mkdir -p /usr/include/poppler/fofi -sudo cp poppler/fofi/*.h /usr/include/poppler/fofi +sudo cp fofi/*.h /usr/include/poppler/fofi sudo mkdir -p /usr/include/poppler/splash -sudo cp poppler/splash/*.h /usr/include/poppler/splash +sudo cp splash/*.h /usr/include/poppler/splash -sudo cp poppler/build/poppler/poppler-config.h \ +sudo cp build/poppler/poppler-config.h \ /usr/include/poppler diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index c4e9ed4..30f7465 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -3,6 +3,8 @@ # This bash script exports environment variables for the latest software # versions -export POPPLER_VERSION=poppler-0.82.0 -export FONTFORGE_VERSION=20190801 +#export POPPLER_VERSION=poppler-0.82.0 +export POPPLER_VERSION=poppler-0.81.0 +#export FONTFORGE_VERSION=20190801 +export FONTFORGE_VERSION=20170731 export PDF2HTMLEX_VERSION=newBuildSystem From 5a1a090a5e295d1c9f8c6ee8b1617cfb5a30f359 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 16:38:40 +0000 Subject: [PATCH 012/269] corrected getFontForge --- buildScripts/getFontforge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index b5790a2..0dc10e5 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -9,7 +9,7 @@ FONTFORGE_SRC=fontforge-$FONTFORGE_VERSION.tar.gz rm -rf $FONTFORGE_SRC rm -rf fontforge -wget https://github.com/fontforge/fontforge/releases/download/$FONTFORGE_VERSION/$FONTFORGE_SRC +wget https://github.com/fontforge/fontforge/archive/$FONTFORGE_SRC tar xvf $FONTFORGE_SRC From 0eecbed932238ee31b5224f354fcb4e0f98f54d3 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 18:43:26 +0000 Subject: [PATCH 013/269] corrected build scripts to reflect those on virtual machine --- buildScripts/buildFontforge | 4 ++++ buildScripts/buildPdf2htmlEX | 5 +++++ buildScripts/buildPdf2htmlEXClang | 5 +++++ buildScripts/cleanPdf2htmlEX | 6 ++++++ buildScripts/getBuildTools | 3 +++ buildScripts/getFontforge | 8 +++++++- buildScripts/installPdf2htmlEX | 3 ++- 7 files changed, 32 insertions(+), 2 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 8168b08..b8ba71a 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -1,3 +1,7 @@ +#!/bin/bash + +# This bash script build FontForge + cd fontforge ./bootstrap ./configure diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index 399912c..6dbef4e 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -1,3 +1,8 @@ +#!/bin/bash + +# This bash script builds pdf2htmlEX + +cd pdf2html mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. diff --git a/buildScripts/buildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang index 4a9914a..95a4574 100755 --- a/buildScripts/buildPdf2htmlEXClang +++ b/buildScripts/buildPdf2htmlEXClang @@ -1,3 +1,8 @@ +#!/bin/bash + +# This bash script builds pdf2htmlEX using Clang (if it is installed) + +cd pdf2htmlEX mkdir build cd build CC=clang CXX=clang++ cmake .. diff --git a/buildScripts/cleanPdf2htmlEX b/buildScripts/cleanPdf2htmlEX index 97f8946..0b44a63 100755 --- a/buildScripts/cleanPdf2htmlEX +++ b/buildScripts/cleanPdf2htmlEX @@ -1 +1,7 @@ +#!/bin/bash + +# This bash script clean all pdf2htmlEX build products + + +cd pdf2htmlEX rm -rf build pdf2htmlEX.1 share/*.css share/*.js share/*.min.* src/pdf2htmlEX-config.h src/util/css_const.h diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools index 5d02109..9219bb8 100755 --- a/buildScripts/getBuildTools +++ b/buildScripts/getBuildTools @@ -10,10 +10,13 @@ sudo apt $UNATTENDED install \ git \ pkg-config \ ruby \ + autoconf \ + libtool \ cmake \ make \ gcc \ g++ \ gettext \ + openjdk-8-jre-headless \ tree diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 0dc10e5..193eca4 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -4,7 +4,7 @@ source buildScripts/versionEnvs -FONTFORGE_SRC=fontforge-$FONTFORGE_VERSION.tar.gz +FONTFORGE_SRC=$FONTFORGE_VERSION.tar.gz rm -rf $FONTFORGE_SRC rm -rf fontforge @@ -14,3 +14,9 @@ wget https://github.com/fontforge/fontforge/archive/$FONTFORGE_SRC tar xvf $FONTFORGE_SRC mv fontforge-$FONTFORGE_VERSION fontforge + +# FIX required for fontforge 20170731 raw sources +# +cd fontforge +# +patch -p 1 < ../patches/fontforge-20170731-fixGDraw.patch diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index de19338..4102e29 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -8,5 +8,6 @@ if [[ $# -eq 0 ]] ; then fi -cd build +cd pdf2htmlEX/build + sudo make install From 0b8bcf565c26086f73cb51d3bb1151e3853cffdc Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 19:06:46 +0000 Subject: [PATCH 014/269] added patches --- .gitignore | 6 ++--- buildScripts/getPdf2htmlEX | 2 +- patches/fontforge-20170731-fixGDraw.patch | 32 +++++++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 patches/fontforge-20170731-fixGDraw.patch diff --git a/.gitignore b/.gitignore index d2f4091..f1f1335 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -fontforge* -FontForge* -poppler* +fontforge +*.tar.* +poppler build compile_commands.json CMakeCache.txt diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX index ff311bd..a3a375d 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEX @@ -9,7 +9,7 @@ wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_VERSION mv $PDF2HTMLEX_VERSION $PDF2HTMLEX_VERSION.zip -sudo apt get unzip +sudo apt install unzip unzip $PDF2HTMLEX_VERSION.zip diff --git a/patches/fontforge-20170731-fixGDraw.patch b/patches/fontforge-20170731-fixGDraw.patch new file mode 100644 index 0000000..8d162d2 --- /dev/null +++ b/patches/fontforge-20170731-fixGDraw.patch @@ -0,0 +1,32 @@ +diff --git a/gdraw/drawboxborder.c b/gdraw/drawboxborder.c +index 629968608..0b00e9dd5 100644 +--- a/gdraw/drawboxborder.c ++++ b/gdraw/drawboxborder.c +@@ -24,6 +24,7 @@ + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ ++#include + #include + #include + #include +diff --git a/gdraw/gpsdraw.c b/gdraw/gpsdraw.c +index 5e58b6208..099e41bbd 100644 +--- a/gdraw/gpsdraw.c ++++ b/gdraw/gpsdraw.c +@@ -24,6 +24,7 @@ + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ ++#include "fontforge-config.h" + #include + #include + #include +@@ -31,7 +32,6 @@ + #if !defined(__MINGW32__) + #include + #endif +-#include "fontforge-config.h" + #include + + #include "gpsdrawP.h" From 73d379e4072c47028bbc09543c96900c1b25610e Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 21 Nov 2019 20:34:17 +0000 Subject: [PATCH 015/269] begun work on assembling images --- buildScripts/assembleAppImage | 22 ++++++++++++++++++++++ buildScripts/buildPdf2htmlEX | 2 +- buildScripts/pdf2htmlEX.desktop | 11 +++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 buildScripts/assembleAppImage create mode 100644 buildScripts/pdf2htmlEX.desktop diff --git a/buildScripts/assembleAppImage b/buildScripts/assembleAppImage new file mode 100755 index 0000000..e48c1fe --- /dev/null +++ b/buildScripts/assembleAppImage @@ -0,0 +1,22 @@ +#!/bin/bash + +# This bash script automates the creation of an AppImage for pdf2htmlEX +# It is based upon code taken from +# https://github.com/AppImage/pkg2appimage +# and +# https://github.com/AppImage/AppImages + +mkdir -p buildAppImage + +cd buildAppImage + +wget -q https://github.com/AppImage/AppImages/raw/master/functions.sh \ + -O ./functions.sh + +. ./functions.sh + +apt download -y apt libapt-pkg5.0 libbz2-1.0 liblzma5 \ + multiarch-support zlib1g dpkg + +mkdir -p pdf2htmlEX.AppImage + diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index 6dbef4e..ad47a2d 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -2,7 +2,7 @@ # This bash script builds pdf2htmlEX -cd pdf2html +cd pdf2htmlEX mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. diff --git a/buildScripts/pdf2htmlEX.desktop b/buildScripts/pdf2htmlEX.desktop new file mode 100644 index 0000000..81f4508 --- /dev/null +++ b/buildScripts/pdf2htmlEX.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=pdf2htmlEX +Comment=pdf2htmlEX +Exec=/usr/local/bin/pdf2htmlEX +Icon=/usr/local/share/pdf2htmlEX/pdf2htmlEX-64x64 +Categories=Office; +Terminal=false +StartupNotify=false +X-AppImage-Version=try1 From 65e674db4227b3c99ef009d088a68e4a2664824a Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 22 Nov 2019 12:08:20 +0000 Subject: [PATCH 016/269] alpha version of build scripts --- buildScripts/assembleAppImage | 22 -------------------- buildScripts/buildPoppler | 2 +- buildScripts/createAppImage | 26 +++++++++++++++++++++++ buildScripts/doItAll | 26 +++++++++++++++++++++++ buildScripts/installFontforge | 35 +++++++++---------------------- buildScripts/installPdf2htmlEX | 3 ++- buildScripts/installPoppler | 37 ++++++++++++++++++--------------- buildScripts/pdf2htmlEX.desktop | 11 ---------- pdf2htmlEX/src/pdf2htmlEX.cc | 7 +++++++ 9 files changed, 92 insertions(+), 77 deletions(-) delete mode 100755 buildScripts/assembleAppImage create mode 100755 buildScripts/createAppImage create mode 100755 buildScripts/doItAll delete mode 100644 buildScripts/pdf2htmlEX.desktop diff --git a/buildScripts/assembleAppImage b/buildScripts/assembleAppImage deleted file mode 100755 index e48c1fe..0000000 --- a/buildScripts/assembleAppImage +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# This bash script automates the creation of an AppImage for pdf2htmlEX -# It is based upon code taken from -# https://github.com/AppImage/pkg2appimage -# and -# https://github.com/AppImage/AppImages - -mkdir -p buildAppImage - -cd buildAppImage - -wget -q https://github.com/AppImage/AppImages/raw/master/functions.sh \ - -O ./functions.sh - -. ./functions.sh - -apt download -y apt libapt-pkg5.0 libbz2-1.0 liblzma5 \ - multiarch-support zlib1g dpkg - -mkdir -p pdf2htmlEX.AppImage - diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index c9e6a98..458697b 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -5,6 +5,6 @@ cd poppler mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ -DENABLE_LIBOPENJPEG=none .. make -j `nproc` diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage new file mode 100755 index 0000000..f6abbc1 --- /dev/null +++ b/buildScripts/createAppImage @@ -0,0 +1,26 @@ +#!/bin/bash + +# This bash script creates an AppImage for pdf2htmlEX + + +mkdir -p imageBuild/pdf2htmlEX.AppDir + +cd pdf2htmlEX/build + +sudo rm -rf install_manifest.txt + +make install DESTDIR=../../imageBuild/pdf2htmlEX.AppDir + +cd ../../imageBuild + +wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + +chmod a+x linuxdeploy-x86_64.AppImage + +./linuxdeploy-x86_64.AppImage \ + -e pdf2htmlEX.AppDir/usr/bin/pdf2htmlEX \ + --create-desktop-file \ + -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ + --appdir=pdf2htmlEX.AppDir \ + --output appimage + diff --git a/buildScripts/doItAll b/buildScripts/doItAll new file mode 100755 index 0000000..e18b385 --- /dev/null +++ b/buildScripts/doItAll @@ -0,0 +1,26 @@ +#!/bin/bash + +# This bash script builds the complete pdf2htmlEX application LOCALLY +# (It does not create the AppImage or Docker images) + +export UNATTENDED=--assume-yes + +getBuildTools + +getDevLibraries + +getPoppler + +buildPoppler + +installPoppler + +getFontForge + +buildFontForge + +installFontForge + +buildPdf2htmlEX + +installPdf2htmlEX diff --git a/buildScripts/installFontforge b/buildScripts/installFontforge index e5eb120..77c2058 100755 --- a/buildScripts/installFontforge +++ b/buildScripts/installFontforge @@ -1,31 +1,16 @@ #!/bin/bash -echo "WARNING: this will over-write any existing" -echo "FontForge version you have installed on your system." -echo "This may break other packages/applications." -echo "" -echo "This installation assumes you have 'sudo' privileges." -echo "" -echo "Type ctrl-c now if DO NOT want to continue" -read -p "Type anything else to continue: " +if [ -z "$UNATTENDED" ] ; then + echo "WARNING: this may over-write any existing" + echo "FontForge version you have installed on your system." + echo "This may break other packages/applications." + echo "" + echo "This installation assumes you have 'sudo' privileges." + echo "" + echo "Type ctrl-c now if DO NOT want to continue" + read -p "Type anything else to continue: " +fi cd fontforge sudo make install sudo ldconfig; - -#cd -# -#sudo mkdir -p /usr/include/poppler -#sudo cp poppler/poppler/*.h /usr/include/poppler -# -#sudo mkdir -p /usr/include/poppler/goo -#sudo cp poppler/goo/*.h /usr/include/poppler/goo -# -#sudo mkdir -p /usr/include/poppler/fofi -#sudo cp poppler/fofi/*.h /usr/include/poppler/fofi -# -#sudo mkdir -p /usr/include/poppler/splash -#sudo cp poppler/splash/*.h /usr/include/poppler/splash -# -#sudo cp poppler/build/poppler/poppler-config.h \ -# /usr/include/poppler diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index 4102e29..4193c6b 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -1,8 +1,9 @@ #!/bin/bash -if [[ $# -eq 0 ]] ; then +if [ -z "$UNATTENDED" ] ; then echo "This installation assumes you have 'sudo' privileges" + echo "" echo "Type ctrl-c now if DO NOT want to continue" read -p "Type anything else to continue: " diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler index 6b5f540..ec97f26 100755 --- a/buildScripts/installPoppler +++ b/buildScripts/installPoppler @@ -2,31 +2,34 @@ # This bash script installs Poppler into the local system -echo "WARNING: this will over-write any existing" -echo "Poppler version you have installed on your system." -echo "This may break other packages/applications." -echo "" -echo "This installation assumes you have 'sudo' privileges." -echo "" -echo "Type ctrl-c now if DO NOT want to continue" -read -p "Type anything else to continue: " + +if [ -z "$UNATTENDED" ] ; then + echo "WARNING: this may over-write any existing" + echo "Poppler version you have installed on your system." + echo "This may break other packages/applications." + echo "" + echo "This installation assumes you have 'sudo' privileges." + echo "" + echo "Type ctrl-c now if DO NOT want to continue" + read -p "Type anything else to continue: " +fi cd poppler/build sudo make install cd .. -sudo mkdir -p /usr/include/poppler -sudo cp poppler/*.h /usr/include/poppler +sudo mkdir -p /usr/local/include/poppler +sudo cp poppler/*.h /usr/local/include/poppler -sudo mkdir -p /usr/include/poppler/goo -sudo cp goo/*.h /usr/include/poppler/goo +sudo mkdir -p /usr/local/include/poppler/goo +sudo cp goo/*.h /usr/local/include/poppler/goo -sudo mkdir -p /usr/include/poppler/fofi -sudo cp fofi/*.h /usr/include/poppler/fofi +sudo mkdir -p /usr/local/include/poppler/fofi +sudo cp fofi/*.h /usr/local/include/poppler/fofi -sudo mkdir -p /usr/include/poppler/splash -sudo cp splash/*.h /usr/include/poppler/splash +sudo mkdir -p /usr/local/include/poppler/splash +sudo cp splash/*.h /usr/local/include/poppler/splash sudo cp build/poppler/poppler-config.h \ - /usr/include/poppler + /usr/local/include/poppler diff --git a/buildScripts/pdf2htmlEX.desktop b/buildScripts/pdf2htmlEX.desktop deleted file mode 100644 index 81f4508..0000000 --- a/buildScripts/pdf2htmlEX.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=pdf2htmlEX -Comment=pdf2htmlEX -Exec=/usr/local/bin/pdf2htmlEX -Icon=/usr/local/share/pdf2htmlEX/pdf2htmlEX-64x64 -Categories=Office; -Terminal=false -StartupNotify=false -X-AppImage-Version=try1 diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index bdc56aa..d08bc6c 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -368,6 +368,13 @@ int main(int argc, char **argv) param.data_dir = PDF2HTMLEX_DATA_PATH; #endif + if (getenv("APPDIR")) { + // we are running inside an AppImage so we need to adjust the data_dir + // however the user can supply some other absolute path later + // + param.data_dir = string(getenv("APPDIR")) + param.data_dir; + } + parse_options(argc, argv); check_param(); From d70cf0aceb2823af49380653b3a3bedcdc708901 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 22 Nov 2019 12:20:08 +0000 Subject: [PATCH 017/269] corrected doItAll --- buildScripts/doItAll | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/buildScripts/doItAll b/buildScripts/doItAll index e18b385..1b74d01 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -5,22 +5,22 @@ export UNATTENDED=--assume-yes -getBuildTools +./buildScripts/getBuildTools -getDevLibraries +./buildScripts/getDevLibraries -getPoppler +./buildScripts/getPoppler -buildPoppler +./buildScripts/buildPoppler -installPoppler +./buildScripts/installPoppler -getFontForge +./buildScripts/getFontForge -buildFontForge +./buildScripts/buildFontForge -installFontForge +./buildScripts/installFontForge -buildPdf2htmlEX +./buildScripts/buildPdf2htmlEX -installPdf2htmlEX +./buildScripts/installPdf2htmlEX From 0bc60ce7261fa1aecd6047b7298297034df58477 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 22 Nov 2019 12:27:33 +0000 Subject: [PATCH 018/269] corrected doItAll --- buildScripts/doItAll | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildScripts/doItAll b/buildScripts/doItAll index 1b74d01..114d01d 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -15,11 +15,11 @@ export UNATTENDED=--assume-yes ./buildScripts/installPoppler -./buildScripts/getFontForge +./buildScripts/getFontforge -./buildScripts/buildFontForge +./buildScripts/buildFontforge -./buildScripts/installFontForge +./buildScripts/installFontforge ./buildScripts/buildPdf2htmlEX From 7e270ab49729145095e517f74828e2f78cdafff1 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 22 Nov 2019 17:25:05 +0000 Subject: [PATCH 019/269] force libfontconfig into appimage --- buildScripts/createAppImage | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index f6abbc1..07f2c4a 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -3,7 +3,7 @@ # This bash script creates an AppImage for pdf2htmlEX -mkdir -p imageBuild/pdf2htmlEX.AppDir +mkdir -p imageBuild/pdf2htmlEX.AppDir/usr/lib/ cd pdf2htmlEX/build @@ -13,6 +13,10 @@ make install DESTDIR=../../imageBuild/pdf2htmlEX.AppDir cd ../../imageBuild +# force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig) +# +cp /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 pdf2htmlEX.AppDir/usr/lib/ + wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage chmod a+x linuxdeploy-x86_64.AppImage From 019db4e6358f047cf5dd469a1d4c4ef871182412 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 22 Nov 2019 17:43:56 +0000 Subject: [PATCH 020/269] added signal handler code --- pdf2htmlEX/CMakeLists.txt | 2 + pdf2htmlEX/src/pdf2htmlEX.cc | 14 +- pdf2htmlEX/src/util/SignalHandler.cc | 220 +++++++++++++++++++++++++++ pdf2htmlEX/src/util/SignalHandler.h | 21 +++ pdf2htmlEX/src/util/ffw.c | 68 ++++++++- pdf2htmlEX/src/util/ffw.h | 10 +- 6 files changed, 329 insertions(+), 6 deletions(-) create mode 100644 pdf2htmlEX/src/util/SignalHandler.cc create mode 100644 pdf2htmlEX/src/util/SignalHandler.h diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 3852c22..b8e5008 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -149,6 +149,8 @@ set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC} src/util/unicode.cc src/util/mingw.h src/util/mingw.cc + src/util/SignalHandler.h + src/util/SignalHandler.cc src/ArgParser.h src/ArgParser.cc src/Base64Stream.h diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index d08bc6c..9191489 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -25,6 +25,8 @@ #include "pdf2htmlEX-config.h" +#include "util/SignalHandler.h" + #if ENABLE_SVG #include #endif @@ -55,11 +57,15 @@ void show_usage_and_exit(const char * dummy = nullptr) void show_version_and_exit(const char * dummy = nullptr) { + const FFWVersionInfo* ffwVersionInfo = ffw_get_version_info(); + cerr << "pdf2htmlEX version " << PDF2HTMLEX_VERSION << endl; cerr << "Copyright 2012-2015 Lu Wang and other contributors" << endl; cerr << "Libraries: " << endl; cerr << " poppler " << POPPLER_VERSION << endl; - cerr << " libfontforge " << ffw_get_version() << endl; + cerr << " libfontforge " << ffwVersionInfo->majorVersion << "." << + ffwVersionInfo->minorVersion << "." << ffwVersionInfo->gitVersion << endl; + cerr << " libfontforge (date) " << ffwVersionInfo->versionDate << endl; #if ENABLE_SVG cerr << " cairo " << cairo_version_string() << endl; #endif @@ -394,6 +400,12 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } + // setup the signal handler + setupSignalHandler(argc, (const char**)argv, + param.data_dir.c_str(), + param.poppler_data_dir.c_str(), + 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); diff --git a/pdf2htmlEX/src/util/SignalHandler.cc b/pdf2htmlEX/src/util/SignalHandler.cc new file mode 100644 index 0000000..c19eedc --- /dev/null +++ b/pdf2htmlEX/src/util/SignalHandler.cc @@ -0,0 +1,220 @@ +/* + * SignalHandler.cc + * + * Created on: 2019-Nov-14 + * Author: Stephen Gaito + */ + +/********** + +This collection of basic ANSI-C functions implement a crude SIG-SEGV +handler for when things go horribly wrong ;-( + +We implement them in as simple a maner as possible so that it will be as +portable as possible and less likely to fall into a reentrant deadlock. + +At the moment the most critical SIG-SEGVs are happening inside the +FontForge library. So we start by focusing upon adding more helpful +messages when FontForge can't save a file for us. + +**********/ + + +#include +#include +#include +#include +#include + +#include "pdf2htmlEX-config.h" +#include "util/ffw.h" +#include +#include + +const char* oopsMessage = + "\n" + "\n" + "Oops! Something went horribly wrong.... sorry!\n" + "\n"; + +const char* ffwMessage_1 = + "I was in the middle of asking FontForge to "; + +const char* ffwMessage_2 = + " a font.\n" + "\n" + "I suspect that the problem is that FontForge is having trouble\n" + "working with one of the fonts embedded in your pdf file.\n" + "\n" + "The best way to verify this is to install FontForge and to try\n" + "loading and then (re)generating each font in the\n" + "\n" + " "; + +const char* ffwMessage_3 = + "\n" + "\n" + "directory. See:\n" + "\n" + " https://github.com/pdf2htmlEX/pdf2htmlEX/wiki/Troubleshooting-Crashes\n" + "\n" + "for details.\n" + "\n" + "If one of these fonts crashes FontForge, then it is certainly not a\n" + "pdf2htmlEX problem.... sorry.\n" + "\n" + "IF it *is* a FontForge problem then you have the following options:\n" + "\n" + " 1) You can send a copy of the font you found which crashed FontForge to\n" + " the FontForge developers and see if they can find the problem.\n" + " (Be warned FontForge is a complex application, so it might be\n" + " very hard for the developers to isolate your problem.... )\n" + "\n" + " 2) You can try re-creating your PDF with a different font.\n" + "\n" + " 3) Or you can do both of these things...\n" + "\n" + "IF you were not able to crash FontForge using the fonts in the above\n" + "directory... then and only then please raise an issue with the pdf2htmlEX\n" + "team... make sure you provide them with your pdf, as well as the following\n" + "details:\n"; + +const char* noFfwMessage = + "Please raise an issue with the pdf2hmtlEX team so they can fix this...\n" + "\n" + "Please make sure you provide them with your pdf as well as the following\n" + "details:\n"; + +const char* detailsHeader = + "\n" + "--------------------------------------------------------------------------\n" + "\n"; + +const char* detailsBody = "no details recorded\n"; + +const char* pdf2htmlEXTmpDir = NULL; +const char* ffwAction = NULL; + +struct sigaction act; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +void signalHandler(int sigInt) { + write(STDERR_FILENO, oopsMessage, strlen(oopsMessage) ); + + if (ffwAction) { + write(STDERR_FILENO, ffwMessage_1, strlen(ffwMessage_1) ); + write(STDERR_FILENO, ffwAction, strlen(ffwAction) ); + write(STDERR_FILENO, ffwMessage_2, strlen(ffwMessage_2) ); + write(STDERR_FILENO, pdf2htmlEXTmpDir, strlen(pdf2htmlEXTmpDir) ); + write(STDERR_FILENO, ffwMessage_3, strlen(ffwMessage_3) ); + } else { + write(STDERR_FILENO, noFfwMessage, strlen(noFfwMessage) ); + } + + write(STDERR_FILENO, detailsHeader, strlen(detailsHeader) ); + write(STDERR_FILENO, detailsBody, strlen(detailsBody) ); + exit(-1); + +} +#pragma GCC diagnostic pop + +#ifdef __cplusplus +extern "C" { +#endif + +void ffwSetAction(const char* anAction) { ffwAction = anAction; } +void ffwClearAction(const char* anAction) { ffwAction = NULL; } + +#ifdef __cplusplus +} +#endif + +void setupSignalHandler( + int argc, const char* argv[], + const char* data_dir, + const char* poppler_data_dir, + const char* tmp_dir) { + // THIS MUST BE CALLED AFTER ARGUMENT PARSING + + // Start by setting up the messages + // + // Construct the command line information + std::string detailInfo; + detailInfo = "Command line:\n"; + for (int i = 0 ; i < argc ; i++ ){ + detailInfo = detailInfo + " " + std::to_string(i) + ": [" + argv[i] + "]\n" ; + } + detailInfo = detailInfo + "\n"; + + // Construct the version information + const pdf2htmlEX::FFWVersionInfo* ffwVersionInfo = + pdf2htmlEX::ffw_get_version_info(); + + detailInfo = detailInfo + "Version information:\n"; + detailInfo = detailInfo + " pdf2htmlEX version " + pdf2htmlEX::PDF2HTMLEX_VERSION + "\n"; + detailInfo = detailInfo + " Copyright 2012-2015 Lu Wang and other contributors\n"; + detailInfo = detailInfo + "\n"; + detailInfo = detailInfo + "Libraries:\n" ; + detailInfo = detailInfo + " poppler " + POPPLER_VERSION + "\n"; + detailInfo = detailInfo + " libfontforge " + ffwVersionInfo->majorVersion + "." + ffwVersionInfo->minorVersion + "." + ffwVersionInfo->gitVersion + "\n"; + detailInfo = detailInfo + " libfontforge (date) " + ffwVersionInfo->versionDate + "\n"; +#if ENABLE_SVG + detailInfo = detailInfo + " cairo " + cairo_version_string() + "\n"; +#endif + detailInfo = detailInfo + "\n"; + detailInfo = detailInfo + "Default data-dir: " + data_dir + "\n"; + detailInfo = detailInfo + "Default poppler-data-dir: " + poppler_data_dir + "\n"; + detailInfo = detailInfo + "Default tmp-dir: " + tmp_dir + "\n"; + detailInfo = detailInfo + "\n"; + detailInfo = detailInfo + "Supported image formats:"; +#ifdef ENABLE_LIBPNG + detailInfo = detailInfo + " png"; +#endif +#ifdef ENABLE_LIBJPEG + detailInfo = detailInfo + " jpg"; +#endif +#if ENABLE_SVG + detailInfo = detailInfo + " svg"; +#endif + detailInfo = detailInfo + "\n\n"; + + detailsBody = strdup(detailInfo.c_str()); + + pdf2htmlEXTmpDir = strdup(tmp_dir); + + // Now setup the signal handler + // + memset(&act, 0, sizeof(act)); + act.sa_handler = signalHandler; + // + sigaction(SIGILL, &act, NULL); // Illegal Instruction + sigaction(SIGFPE, &act, NULL); // Floating-point exception + sigaction(SIGSEGV, &act, NULL); // Invalid memory reference + sigaction(SIGBUS, &act, NULL); // Bus error (bad memory access) + sigaction(SIGSYS, &act, NULL); // Bad system call (SVr4) + + // All done +} + + +/*** +int main(int argc, const char* argv[]) { + + setupSignalHandler(argc, argv, "aTmpDir"); + + ffwSetAction("save"); + + for (int i = 0; i < 5; i++) { + printf("sleeping.... \n"); + sleep(1); + } + + int *foo = NULL; + + *foo = 1; + + printf("We should not reach here!\n"); + +} +***/ diff --git a/pdf2htmlEX/src/util/SignalHandler.h b/pdf2htmlEX/src/util/SignalHandler.h new file mode 100644 index 0000000..d39b844 --- /dev/null +++ b/pdf2htmlEX/src/util/SignalHandler.h @@ -0,0 +1,21 @@ +#ifndef SIGNAL_HANDLER_H +#define SIGNAL_HANDLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +void ffwSetAction(const char* anAction); +void ffwClearAction(void); + +#ifdef __cplusplus +} +#endif + +void setupSignalHandler( + int argc, const char* argv[], + const char* data_dir, + const char* poppler_data_dir, + const char* tmp_dir); + +#endif diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index c296f38..2101cde 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -16,6 +16,8 @@ #include #include +#include "SignalHandler.h" + #include "ffw.h" #include "fontforge-2.0.20170731/autowidth.h" #include "fontforge-2.0.20170731/bitmapchar.h" @@ -66,6 +68,7 @@ static void dumb_post_error(const char * title, const char * error, ...) { } void ffw_init(int debug) { + ffwSetAction("initialize"); InitSimpleStuff(); if ( default_encoding==NULL ) default_encoding=FindOrMakeEncoding("ISO8859-1"); @@ -88,10 +91,12 @@ void ffw_init(int debug) v.u.ival = 1; SetPrefs("DetectDiagonalStems", &v, NULL); } + ffwClearAction(); } void ffw_finalize(void) { + ffwSetAction("finalize"); while(enc_head) { Encoding * next = enc_head->next; @@ -107,21 +112,36 @@ void ffw_finalize(void) free(enc_head); enc_head = next; } + ffwClearAction(); } -long ffw_get_version(void) +// see: https://stackoverflow.com/a/2653351 +#define xstr(a) str(a) +#define str(a) #a + +static FFWVersionInfo ffwVersionInfo; + +const FFWVersionInfo* ffw_get_version_info(void) { - return FONTFORGE_VERSIONDATE_RAW; + ffwVersionInfo.gitVersion = FONTFORGE_GIT_VERSION; + ffwVersionInfo.majorVersion = xstr(FONTFORGE_VERSION_MAJOR); + ffwVersionInfo.minorVersion = xstr(FONTFORGE_VERSION_MINOR); + ffwVersionInfo.versionDate = FONTFORGE_VERSIONDATE; + + return &ffwVersionInfo; } void ffw_new_font() { + ffwSetAction("create"); assert((cur_fv == NULL) && "Previous font is not destroyed"); cur_fv = FVAppend(_FontViewCreate(SplineFontNew())); + ffwClearAction(); } void ffw_load_font(const char * filename) { + ffwSetAction("load"); assert((cur_fv == NULL) && "Previous font is not destroyed"); char * _filename = strcopy(filename); @@ -147,6 +167,7 @@ void ffw_load_font(const char * filename) cur_fv->cidmaster->ascent = cur_fv->sf->ascent; cur_fv->cidmaster->descent = cur_fv->sf->descent; } + ffwClearAction(); } /* @@ -154,6 +175,7 @@ void ffw_load_font(const char * filename) */ void ffw_prepare_font(void) { + ffwSetAction("prepare"); memset(cur_fv->selected, 1, cur_fv->map->enccount); // remove kern FVRemoveKerns(cur_fv); @@ -185,10 +207,12 @@ void ffw_prepare_font(void) */ free(sf->fontname); sf->fontname = strcopy(""); + ffwClearAction(); } void ffw_save(const char * filename) { + ffwSetAction("save"); char * _filename = strcopy(filename); char * _ = strcopy(""); @@ -200,11 +224,14 @@ void ffw_save(const char * filename) if(!r) err("Cannot save font to %s\n", filename); + ffwClearAction(); } void ffw_close(void) { + ffwSetAction("close"); FontViewClose(cur_fv); cur_fv = NULL; + ffwClearAction(); } static void ffw_do_reencode(Encoding * encoding, int force) @@ -234,25 +261,32 @@ static void ffw_do_reencode(Encoding * encoding, int force) void ffw_reencode_glyph_order(void) { + ffwSetAction("re-encode the glyph order in"); ffw_do_reencode(original_enc, 0); + ffwClearAction(); } void ffw_reencode_unicode_full(void) { + ffwSetAction("re-encode to unicode"); ffw_do_reencode(unicodefull_enc, 0); + ffwClearAction(); } void ffw_reencode(const char * encname, int force) { + ffwSetAction("re-encode"); Encoding * enc = FindOrMakeEncoding(encname); if(!enc) err("Unknown encoding %s\n", encname); ffw_do_reencode(enc, force); + ffwClearAction(); } void ffw_reencode_raw(int32 * mapping, int mapping_len, int force) { + ffwSetAction("re-encode (raw1)"); Encoding * enc = calloc(1, sizeof(Encoding)); enc->only_1byte = enc->has_1byte = true; @@ -273,10 +307,12 @@ void ffw_reencode_raw(int32 * mapping, int mapping_len, int force) enc_head = enc; ffw_do_reencode(enc, force); + ffwClearAction(); } void ffw_reencode_raw2(const char ** mapping, int mapping_len, int force) { + ffwSetAction("re-encode (raw2)"); Encoding * enc = calloc(1, sizeof(Encoding)); enc->enc_name = strcopy(""); enc->char_cnt = mapping_len; @@ -300,6 +336,7 @@ void ffw_reencode_raw2(const char ** mapping, int mapping_len, int force) enc_head = enc; ffw_do_reencode(enc, force); + ffwClearAction(); } void ffw_cidflatten(void) @@ -309,7 +346,9 @@ void ffw_cidflatten(void) fprintf(stderr, "Cannot flatten a non-CID font\n"); return; } + ffwSetAction("flatten the cid in"); SFFlatten(cur_fv->sf->cidmaster); + ffwClearAction(); } /* @@ -318,6 +357,7 @@ void ffw_cidflatten(void) */ void ffw_add_empty_char(int32_t unicode, int width) { + ffwSetAction("add an empty character to"); SplineChar * sc = SFMakeChar(cur_fv->sf, cur_fv->map, cur_fv->map->enccount); char buffer[400]; SCSetMetaData(sc, @@ -325,22 +365,29 @@ void ffw_add_empty_char(int32_t unicode, int width) cur_fv->sf->uni_interp, cur_fv->sf->for_new_glyphs)), unicode, sc->comment); SCSynchronizeWidth(sc, width, sc->width, cur_fv); + ffwClearAction(); } int ffw_get_em_size(void) { - return cur_fv->sf->ascent + cur_fv->sf->descent; + ffwSetAction("get the em size of"); + int emSize = cur_fv->sf->ascent + cur_fv->sf->descent; + ffwClearAction(); + return emSize; } void ffw_fix_metric() { + ffwSetAction("fix the metric of"); double ascent, descent; ffw_get_metric(&ascent, &descent); ffw_set_metric(ascent, descent); + ffwClearAction(); } void ffw_get_metric(double * ascent, double * descent) { + ffwSetAction("get the metric of"); SplineFont * sf = cur_fv->sf; DBounds bb; @@ -357,10 +404,12 @@ void ffw_get_metric(double * ascent, double * descent) { *ascent = *descent = 0; } + ffwClearAction(); } void ffw_set_metric(double ascent, double descent) { + ffwSetAction("set the metric of"); SplineFont * sf = cur_fv->sf; struct pfminfo * info = &sf->pfminfo; @@ -402,6 +451,7 @@ void ffw_set_metric(double ascent, double descent) info->os2_typolinegap = 0; info->linegap = 0; + ffwClearAction(); } /* @@ -410,6 +460,7 @@ void ffw_set_metric(double ascent, double descent) void ffw_set_widths(int * width_list, int mapping_len, int stretch_narrow, int squeeze_wide) { + ffwSetAction("set the widths of"); SplineFont * sf = cur_fv->sf; if(sf->onlybitmaps @@ -453,13 +504,17 @@ void ffw_set_widths(int * width_list, int mapping_len, SCSynchronizeWidth(sc, width_list[i], sc->width, cur_fv); } + ffwClearAction(); } void ffw_import_svg_glyph(int code, const char * filename, double ox, double oy, double width) { + ffwSetAction("import the glyphs from"); int enc = SFFindSlot(cur_fv->sf, cur_fv->map, code, ""); - if(enc == -1) + if(enc == -1) { + ffwClearAction(); return; + } SplineChar * sc = SFMakeChar(cur_fv->sf, cur_fv->map, enc); @@ -483,10 +538,12 @@ void ffw_import_svg_glyph(int code, const char * filename, double ox, double oy, SCSynchronizeWidth(sc, floor(width * (a+d) + 0.5), sc->width, cur_fv); } + ffwClearAction(); } void ffw_auto_hint(void) { + ffwSetAction("automatically hint"); // convert to quadratic if(!(cur_fv->sf->layers[ly_fore].order2)) { @@ -496,11 +553,14 @@ void ffw_auto_hint(void) memset(cur_fv->selected, 1, cur_fv->map->enccount); FVAutoHint(cur_fv); FVAutoInstr(cur_fv); + ffwClearAction(); } void ffw_override_fstype(void) { + ffwSetAction("override the fstype of"); *(int16 *)(&cur_fv->sf->pfminfo.fstype) = 0; cur_fv->sf->pfminfo.pfmset = true; cur_fv->sf->changed = true; + ffwClearAction(); } diff --git a/pdf2htmlEX/src/util/ffw.h b/pdf2htmlEX/src/util/ffw.h index 106310a..5ce70e9 100644 --- a/pdf2htmlEX/src/util/ffw.h +++ b/pdf2htmlEX/src/util/ffw.h @@ -23,7 +23,15 @@ extern "C" { // global void ffw_init(int debug); void ffw_finalize(void); -long ffw_get_version(void); + +typedef struct ffw_version_info { + const char* gitVersion; + const char* majorVersion; + const char* minorVersion; + const char* versionDate; +} FFWVersionInfo ; + +const FFWVersionInfo* ffw_get_version_info(void); //////////////////////// // load & save From f7aa5f3b48f278c5011f17d2abab7862a6b559d4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 23 Nov 2019 06:23:30 +0000 Subject: [PATCH 021/269] rearrange fontforge patches --- buildScripts/buildFontforge | 8 ++++++++ buildScripts/getFontforge | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index b8ba71a..69b3325 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -5,4 +5,12 @@ cd fontforge ./bootstrap ./configure + +# Apply any patches required for fontforge raw sources before we make +# +for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*) do + echo "patching fontforge using [$APATCHFILE]" + patch -p 1 < $APATCHFILE +done + make -j `nproc` diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 193eca4..0db0b23 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -14,9 +14,3 @@ wget https://github.com/fontforge/fontforge/archive/$FONTFORGE_SRC tar xvf $FONTFORGE_SRC mv fontforge-$FONTFORGE_VERSION fontforge - -# FIX required for fontforge 20170731 raw sources -# -cd fontforge -# -patch -p 1 < ../patches/fontforge-20170731-fixGDraw.patch From 51ea338524501efbc3409f76265b3aee871a8a54 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 23 Nov 2019 06:41:05 +0000 Subject: [PATCH 022/269] added patch to fix the FONTFORGE_GIT_VERSION for our use --- buildScripts/buildFontforge | 7 +++++-- patches/fontforge-20170731-fixGitVersion.patch | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 patches/fontforge-20170731-fixGitVersion.patch diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 69b3325..4d4e953 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -2,14 +2,17 @@ # This bash script build FontForge +source buildScripts/versionEnvs + cd fontforge ./bootstrap ./configure # Apply any patches required for fontforge raw sources before we make # -for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*) do - echo "patching fontforge using [$APATCHFILE]" +for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*) +do + echo "patching fontforge using [$APATCHFILE]" patch -p 1 < $APATCHFILE done diff --git a/patches/fontforge-20170731-fixGitVersion.patch b/patches/fontforge-20170731-fixGitVersion.patch new file mode 100644 index 0000000..887c05d --- /dev/null +++ b/patches/fontforge-20170731-fixGitVersion.patch @@ -0,0 +1,13 @@ +fontforge-config.h +--- a/inc/fontforge-config.h 2019-11-23 06:38:36.632042953 +0000 ++++ b/inc/fontforge-config.h 2019-11-23 06:38:47.424229496 +0000 +@@ -67,7 +67,7 @@ + /* #undef FONTFORGE_DEBUG */ + + /* "git hash that source are built from" */ +-#define FONTFORGE_GIT_VERSION "" ++#define FONTFORGE_GIT_VERSION "20170731" + + /* ExeLibFontForge Major Version */ + #define FONTFORGE_LIBFFE_VERSION_MAJOR 2 + From 1580ce3e5356e2bb7a7ec25fb1c9d38c5df50d5f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 23 Nov 2019 07:05:50 +0000 Subject: [PATCH 023/269] added version information to AppImage --- buildScripts/createAppImage | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 07f2c4a..c59914b 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -2,6 +2,7 @@ # This bash script creates an AppImage for pdf2htmlEX +source buildScripts/versionEnvs mkdir -p imageBuild/pdf2htmlEX.AppDir/usr/lib/ @@ -28,3 +29,4 @@ chmod a+x linuxdeploy-x86_64.AppImage --appdir=pdf2htmlEX.AppDir \ --output appimage +mv pdf2htmlEX-x86_64.AppImage pdf2htmlEX-$PDF2HTMLEX_VERSION-x86_64.AppImage From 2be983742266854df47529f40db60dc9088a8bbe Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 23 Nov 2019 10:25:09 +0000 Subject: [PATCH 024/269] continued work on image creation --- buildScripts/createAppImage | 11 +++++++---- buildScripts/createDockerImage | 13 +++++++++++++ buildScripts/versionEnvs | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100755 buildScripts/createDockerImage diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index c59914b..a0f19c1 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -18,15 +18,18 @@ cd ../../imageBuild # cp /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 pdf2htmlEX.AppDir/usr/lib/ -wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage +LINUX_DEPLOY_APP_IMAGE=linuxdeploy-$MACHINE_ARCH.AppImage -chmod a+x linuxdeploy-x86_64.AppImage +wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LINUX_DEPLOY_APP_IMAGE -./linuxdeploy-x86_64.AppImage \ +chmod a+x $LINUX_DEPLOY_APP_IMAGE + +./$LINUX_DEPLOY_APP_IMAGE \ -e pdf2htmlEX.AppDir/usr/bin/pdf2htmlEX \ --create-desktop-file \ -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ --appdir=pdf2htmlEX.AppDir \ --output appimage -mv pdf2htmlEX-x86_64.AppImage pdf2htmlEX-$PDF2HTMLEX_VERSION-x86_64.AppImage +mv pdf2htmlEX-$MACHINE_ARC.AppImage \ + pdf2htmlEX-$PDF2HTMLEX_VERSION-$MACHINE_ARCH.AppImage diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage new file mode 100755 index 0000000..bc11110 --- /dev/null +++ b/buildScripts/createDockerImage @@ -0,0 +1,13 @@ +#!/bin/bash + +# This bash script creates an Docker Image for pdf2htmlEX + +source buildScripts/versionEnvs + +cd imageBuild + +pip install git+https://github.com/larsks/dockerize + +dockerize \ + /usr/bin/pdf2htmlEX \ + diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 30f7465..e7bf2c2 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -8,3 +8,4 @@ export POPPLER_VERSION=poppler-0.81.0 #export FONTFORGE_VERSION=20190801 export FONTFORGE_VERSION=20170731 export PDF2HTMLEX_VERSION=newBuildSystem +export MACHINE_ARCH=`uname -m` From b6813a98f5cb7d5b56da2c95e4c1afc33a955286 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 23 Nov 2019 10:28:43 +0000 Subject: [PATCH 025/269] corrected spelling --- buildScripts/createAppImage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index a0f19c1..4f82477 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -31,5 +31,5 @@ chmod a+x $LINUX_DEPLOY_APP_IMAGE --appdir=pdf2htmlEX.AppDir \ --output appimage -mv pdf2htmlEX-$MACHINE_ARC.AppImage \ +mv pdf2htmlEX-$MACHINE_ARCH.AppImage \ pdf2htmlEX-$PDF2HTMLEX_VERSION-$MACHINE_ARCH.AppImage From 071904fd830430d7f92d456a5d1200ee5116ffc6 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 23 Nov 2019 17:49:43 +0000 Subject: [PATCH 026/269] updated doItAll --- buildScripts/doItAll | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/buildScripts/doItAll b/buildScripts/doItAll index 114d01d..f40d328 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -5,22 +5,23 @@ export UNATTENDED=--assume-yes -./buildScripts/getBuildTools +./buildScripts/getBuildTools || { echo 'getBuildTools FAILED' ; exit 1 ; } -./buildScripts/getDevLibraries +./buildScripts/getDevLibraries || { echo 'getDevLibraries FAILED' ; exit 1 ; } -./buildScripts/getPoppler +./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } -./buildScripts/buildPoppler +./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } -./buildScripts/installPoppler +./buildScripts/installPoppler || { echo 'installPoppler FAILED' ; exit 1 ; } -./buildScripts/getFontforge +./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } -./buildScripts/buildFontforge +./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } -./buildScripts/installFontforge +./buildScripts/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } -./buildScripts/buildPdf2htmlEX +./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } + +./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } -./buildScripts/installPdf2htmlEX From 817db7592af8f6d48b6066dbdf6d83ea8e9909fa Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 11:19:44 +0000 Subject: [PATCH 027/269] initial working draft of building docker image --- buildScripts/createDockerImage | 31 +++++++++++++++--- buildScripts/dockerFunctions | 59 ++++++++++++++++++++++++++++++++++ buildScripts/versionEnvs | 2 ++ 3 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 buildScripts/dockerFunctions diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index bc11110..f9f2cda 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -1,13 +1,34 @@ #!/bin/bash -# This bash script creates an Docker Image for pdf2htmlEX +# This bash script creates a docker image from an existing pdf2htmlEX source buildScripts/versionEnvs -cd imageBuild +source buildScripts/dockerFunctions -pip install git+https://github.com/larsks/dockerize +mkdir -p imageBuild/dockerDir + +cd pdf2htmlEX/build + +sudo rm -rf install_manifest.txt + +make install DESTDIR=../../imageBuild/dockerDir + +cd ../../imageBuild/dockerDir + +copy_deps + +delete_blacklisted + +cat >> Dockerfile <" | awk '{print $3}' \ + | xargs -I '{}' echo '{}' >> DEPSFILE + done + + DEPS=$(cat DEPSFILE | sort | uniq) + + for FILE in $DEPS ; do + if [ -e $FILE ] && [[ $(readlink -f $FILE)/ != $PWD/* ]] ; then + cp -v --parents -rfL $FILE ./ || true + fi + done + rm -f DEPSFILE +} + +# Delete blacklisted files. Our blacklisted files are the shared libraries +# extracted from the "base" docker image +# +delete_blacklisted() +{ + docker run --rm -it --entrypoint=find $DOCKER_FROM -iname "*.so.*" \ + | xargs -i basename {} | sed 's/\r//g' | sed 's/\(so\.[0-9]\+\).*$/\1/' \ + | sort | uniq > BLACKLISTED_FILES + + for FILE in $(cat BLACKLISTED_FILES | tr "\r\n" " ") ; do + FILES="$(find . -name "${FILE}*" -not -path "./usr/optional/*")" + for FOUND in $FILES ; do + rm -vf "$FOUND" "$(readlink -f "$FOUND")" + done + done + + rm BLACKLISTED_FILES + + # Do not bundle developer stuff + rm -rf usr/include || true + rm -rf usr/lib/cmake || true + rm -rf usr/lib/pkgconfig || true + find . -name '*.la' | xargs -i rm {} +} + diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index e7bf2c2..3cea7c5 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -9,3 +9,5 @@ export POPPLER_VERSION=poppler-0.81.0 export FONTFORGE_VERSION=20170731 export PDF2HTMLEX_VERSION=newBuildSystem export MACHINE_ARCH=`uname -m` +export DOCKER_FROM=ubuntu:16.04 + From dd3596432be555d9898d410afa739c5a4c9fd46f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 16:04:50 +0000 Subject: [PATCH 028/269] tidied build scripts --- buildScripts/buildFontforge | 2 +- buildScripts/buildPdf2htmlEX | 4 ++-- buildScripts/buildPdf2htmlEXClang | 4 ++-- buildScripts/buildPoppler | 2 +- buildScripts/travisEnvs | 3 +++ buildScripts/versionEnvs | 4 ++++ 6 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 buildScripts/travisEnvs diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 4d4e953..139d466 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -16,4 +16,4 @@ do patch -p 1 < $APATCHFILE done -make -j `nproc` +make $MAKE_PARALLEL diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index ad47a2d..efbc54d 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -5,5 +5,5 @@ cd pdf2htmlEX mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. -make -j `nproc` +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. +make $MAKE_PARALLEL diff --git a/buildScripts/buildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang index 95a4574..6d0b7ee 100755 --- a/buildScripts/buildPdf2htmlEXClang +++ b/buildScripts/buildPdf2htmlEXClang @@ -5,5 +5,5 @@ cd pdf2htmlEX mkdir build cd build -CC=clang CXX=clang++ cmake .. -make +CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. +make $MAKE_PARALLEL diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 458697b..711fbd3 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -7,4 +7,4 @@ mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ -DENABLE_LIBOPENJPEG=none .. -make -j `nproc` +make $MAKE_PARALLEL diff --git a/buildScripts/travisEnvs b/buildScripts/travisEnvs new file mode 100644 index 0000000..9ab6776 --- /dev/null +++ b/buildScripts/travisEnvs @@ -0,0 +1,3 @@ + +export MAKE_PARALLEL=-j `nproc` + diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 3cea7c5..51208ac 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -5,9 +5,13 @@ #export POPPLER_VERSION=poppler-0.82.0 export POPPLER_VERSION=poppler-0.81.0 + #export FONTFORGE_VERSION=20190801 export FONTFORGE_VERSION=20170731 + export PDF2HTMLEX_VERSION=newBuildSystem + export MACHINE_ARCH=`uname -m` + export DOCKER_FROM=ubuntu:16.04 From 1bf3eadbdc7b71623043e8d24569168f613f681b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 16:10:34 +0000 Subject: [PATCH 029/269] added image creation to doItAll --- buildScripts/doItAll | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildScripts/doItAll b/buildScripts/doItAll index f40d328..aee2d2f 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -25,3 +25,6 @@ export UNATTENDED=--assume-yes ./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } +./buildScripts/createAppImage || { echo 'createAppImage FAILED' ; exit 1 ; } + +./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; } From c5ab4f4f9e4f303bbc6a70c4ac08da66a9d65988 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 16:46:14 +0000 Subject: [PATCH 030/269] corrected build scripts --- buildScripts/createAppImage | 16 ++++++++-------- buildScripts/travisEnvs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 4f82477..8a61951 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -4,19 +4,19 @@ source buildScripts/versionEnvs -mkdir -p imageBuild/pdf2htmlEX.AppDir/usr/lib/ +mkdir -p imageBuild/appDir/usr/lib/ cd pdf2htmlEX/build sudo rm -rf install_manifest.txt -make install DESTDIR=../../imageBuild/pdf2htmlEX.AppDir +make install DESTDIR=../../imageBuild/appDir cd ../../imageBuild # force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig) # -cp /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 pdf2htmlEX.AppDir/usr/lib/ +cp /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 appDir/usr/lib/ LINUX_DEPLOY_APP_IMAGE=linuxdeploy-$MACHINE_ARCH.AppImage @@ -24,11 +24,11 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LI chmod a+x $LINUX_DEPLOY_APP_IMAGE -./$LINUX_DEPLOY_APP_IMAGE \ - -e pdf2htmlEX.AppDir/usr/bin/pdf2htmlEX \ - --create-desktop-file \ - -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ - --appdir=pdf2htmlEX.AppDir \ +./$LINUX_DEPLOY_APP_IMAGE \ + -e appDir/usr/bin/pdf2htmlEX \ + --create-desktop-file \ + -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ + --appdir=appDir \ --output appimage mv pdf2htmlEX-$MACHINE_ARCH.AppImage \ diff --git a/buildScripts/travisEnvs b/buildScripts/travisEnvs index 9ab6776..35d2199 100644 --- a/buildScripts/travisEnvs +++ b/buildScripts/travisEnvs @@ -1,3 +1,3 @@ -export MAKE_PARALLEL=-j `nproc` +export MAKE_PARALLEL="-j `nproc`" From 4d78893209babce886e39ccc00a18914fcbb5424 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 18:06:04 +0000 Subject: [PATCH 031/269] corrected build scripts --- .travis.yml.off | 52 +++++-------------------------------- buildScripts/createAppImage | 2 +- pdf2htmlEX/CMakeLists.txt | 4 +-- 3 files changed, 10 insertions(+), 48 deletions(-) diff --git a/.travis.yml.off b/.travis.yml.off index bff2be1..71baa25 100644 --- a/.travis.yml.off +++ b/.travis.yml.off @@ -6,44 +6,14 @@ os: - linux # - osx -dist: bionic +dist: xenial -env: - global: - - POPPLER_SOURCE="https://gitlab.freedesktop.org/poppler/poppler.git" - matrix: - - PDF2HTMLEX_RELEASE="v0.18.7-poppler-0.81.0" POPPLER_RELEASE="poppler-0.81.0" - - PDF2HTMLEX_RELEASE="v0.18.0-poppler-0.74.0-ubuntu-19.04" POPPLER_RELEASE="poppler-0.74.0" - - PDF2HTMLEX_RELEASE="v0.16.0-poppler-0.62.0-ubuntu-18.04" POPPLER_RELEASE="poppler-0.62.0" +services: + - docker compiler: gcc -addons: - apt: - update: true - packages: - - build-essential - - autoconf - - git - - pkg-config - - cmake - - make - - gcc - - g++ - # - ca-certificates - # - libfreetype6-dev - # Poppler-specific packages - - libfontforge-dev - - libfontconfig-dev - - libjpeg-dev - - libpng-dev - - libnss3-dev - # pdf2htmlEX-specific packages - - default-jre - - libcairo-dev - - libspiro-dev - - libpango1.0-dev - - poppler-data +#addons: # homebrew: # packages: # - autoconf @@ -74,15 +44,7 @@ matrix: # allow_failures: # - os: osx # Until the build passes, then re-enable. -before_install: - - ./.travisScripts/copyScriptsToBin - - $HOME/bin/buildPoppler.sh - - $HOME/bin/installPoppler.sh - #- $HOME/setupTests.sh - script: - - git checkout ${PDF2HTMLEX_RELEASE} - - git branch - - $HOME/bin/dobuild - - $HOME/bin/doinstall --noWait - - /usr/local/bin/pdf2htmlEX -v + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - ./buildScripts/doItAll + - docker push $DOCKER_USERNAME/pdf2htmlex diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 8a61951..c86c0f2 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -25,7 +25,7 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LI chmod a+x $LINUX_DEPLOY_APP_IMAGE ./$LINUX_DEPLOY_APP_IMAGE \ - -e appDir/usr/bin/pdf2htmlEX \ + -e appDir/usr/local/bin/pdf2htmlEX \ --create-desktop-file \ -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ --appdir=appDir \ diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index b8e5008..30822da 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -20,7 +20,7 @@ add_custom_target(dist find_package(PkgConfig) -pkg_check_modules(POPPLER REQUIRED poppler>=0.25.0) +pkg_check_modules(POPPLER REQUIRED poppler>=0.81.0) include_directories(${POPPLER_INCLUDE_DIRS}) link_directories(${POPPLER_LIBRARY_DIRS}) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES}) @@ -55,7 +55,7 @@ if(ENABLE_SVG) endif() # fontforge starts using pkg-config 'correctly' since 2.0.0 -pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.0) +pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.20170731) include_directories(${FONTFORGE_INCLUDE_DIRS}) link_directories(${FONTFORGE_LIBRARY_DIRS}) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES}) From 58bdd22293858216827a819aef14a56b83daa614 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 18:53:01 +0000 Subject: [PATCH 032/269] final correction and first travis build --- .travis.yml.off => .travis.yml | 0 pdf2htmlEX/CMakeLists.txt | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename .travis.yml.off => .travis.yml (100%) diff --git a/.travis.yml.off b/.travis.yml similarity index 100% rename from .travis.yml.off rename to .travis.yml diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 30822da..22c3906 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -55,7 +55,8 @@ if(ENABLE_SVG) endif() # fontforge starts using pkg-config 'correctly' since 2.0.0 -pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.20170731) +#pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.20170731) +pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.0) include_directories(${FONTFORGE_INCLUDE_DIRS}) link_directories(${FONTFORGE_LIBRARY_DIRS}) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES}) From 93ed653ba9057bc5e9a8c5ab139bfc31a44b7daf Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 19:27:09 +0000 Subject: [PATCH 033/269] corrected tarvis --- .travis.yml | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71baa25..ae3348b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,34 @@ services: compiler: gcc -#addons: +env: + - UNATTENDED=--assume-yes + +addons: + apt: + # build tools + - git + - pkg-config + - ruby + - autoconf + - libtool + - cmake + - make + - gcc + - g++ + - gettext + - openjdk-8-jre-headless + - tree + # dev libraries + - libcairo-dev + - libspiro-dev + - libpng-dev + - libjpeg-dev + - poppler-data + - libpango1.0-dev + - liblcms2-dev + - libxml2-dev + - libuninameslist-dev # homebrew: # packages: # - autoconf @@ -46,5 +73,14 @@ matrix: script: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - - ./buildScripts/doItAll + - ./buildScripts/getPoppler + - ./buildScripts/buildPoppler + - ./buildScripts/installPoppler + - ./buildScripts/getFontforge + - ./buildScripts/buildFontforge + - ./buildScripts/installFontforge + - ./buildScripts/buildPdf2htmlEX + - ./buildScripts/installPdf2htmlEX + - ./buildScripts/createAppImage + - ./buildScripts/createDockerImage - docker push $DOCKER_USERNAME/pdf2htmlex From fe2111309090e359eae512d1c71ada0d409b846a Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 19:28:50 +0000 Subject: [PATCH 034/269] corrected tarvis 2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ae3348b..82012d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ services: compiler: gcc env: - - UNATTENDED=--assume-yes + - UNATTENDED="--assume-yes" addons: apt: From a8346a4204f78ea8195595b692b973c9805a921b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 19:31:00 +0000 Subject: [PATCH 035/269] corrected tarvis 3 --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 82012d0..b64fa7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,13 @@ services: compiler: gcc env: - - UNATTENDED="--assume-yes" + global: + - UNATTENDED="--assume-yes" addons: apt: + update: true + packages: # build tools - git - pkg-config From 8f177e198d17559abc303a780d440a3b31398bf4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 19:57:11 +0000 Subject: [PATCH 036/269] corrected tarvis 4 --- .travis.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index b64fa7b..2477009 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,14 +76,14 @@ matrix: script: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - - ./buildScripts/getPoppler - - ./buildScripts/buildPoppler - - ./buildScripts/installPoppler - - ./buildScripts/getFontforge - - ./buildScripts/buildFontforge - - ./buildScripts/installFontforge - - ./buildScripts/buildPdf2htmlEX - - ./buildScripts/installPdf2htmlEX - - ./buildScripts/createAppImage - - ./buildScripts/createDockerImage + - ./buildScripts/getPoppler || travis_terminate 1; + - ./buildScripts/buildPoppler || travis_terminate 1; + - ./buildScripts/installPoppler || travis_terminate 1; + - ./buildScripts/getFontforge || travis_terminate 1; + - ./buildScripts/buildFontforge || travis_terminate 1; + - ./buildScripts/installFontforge || travis_terminate 1; + - ./buildScripts/buildPdf2htmlEX || travis_terminate 1; + - ./buildScripts/installPdf2htmlEX || travis_terminate 1; + - ./buildScripts/createAppImage || travis_terminate 1; + - ./buildScripts/createDockerImage || travis_terminate 1; - docker push $DOCKER_USERNAME/pdf2htmlex From 1f25183b4cb930c34cc155db8b8f0586c2ebf80d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 20:04:24 +0000 Subject: [PATCH 037/269] corrected tarvis 5 --- .travis.yml | 2 +- buildScripts/versionEnvs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2477009..83ea400 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ os: - linux # - osx -dist: xenial +dist: bionic services: - docker diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 51208ac..4db6f51 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -13,5 +13,5 @@ export PDF2HTMLEX_VERSION=newBuildSystem export MACHINE_ARCH=`uname -m` -export DOCKER_FROM=ubuntu:16.04 +export DOCKER_FROM=ubuntu:18.04 From 7155ed25cc5b5deaf54c394eeafe459aea5ee957 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 22:06:17 +0000 Subject: [PATCH 038/269] corrected travis 6 --- .travis.yml | 56 +++++++++++++++++++----------------- buildScripts/getBuildTools | 27 ++++++++--------- buildScripts/getDevLibraries | 19 ++++++------ 3 files changed, 53 insertions(+), 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83ea400..32e5583 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,33 +17,33 @@ env: global: - UNATTENDED="--assume-yes" -addons: - apt: - update: true - packages: - # build tools - - git - - pkg-config - - ruby - - autoconf - - libtool - - cmake - - make - - gcc - - g++ - - gettext - - openjdk-8-jre-headless - - tree - # dev libraries - - libcairo-dev - - libspiro-dev - - libpng-dev - - libjpeg-dev - - poppler-data - - libpango1.0-dev - - liblcms2-dev - - libxml2-dev - - libuninameslist-dev +#addons: +# apt: +# update: true +# packages: +# # build tools +# - git +# - pkg-config +# - ruby +# - autoconf +# - libtool +# - cmake +# - make +# - gcc +# - g++ +# - gettext +# - openjdk-8-jre-headless +# - tree +# # dev libraries +# - libcairo-dev +# - libspiro-dev +# - libpng-dev +# - libjpeg-dev +# - poppler-data +# - libpango1.0-dev +# - liblcms2-dev +# - libxml2-dev +# - libuninameslist-dev # homebrew: # packages: # - autoconf @@ -76,6 +76,8 @@ matrix: script: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - ./buildScripts/getBuildTools || travis_terminate 1; + - ./buildScripts/getDevLibraries || travis_terminate 1; - ./buildScripts/getPoppler || travis_terminate 1; - ./buildScripts/buildPoppler || travis_terminate 1; - ./buildScripts/installPoppler || travis_terminate 1; diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools index 9219bb8..d4f29c6 100755 --- a/buildScripts/getBuildTools +++ b/buildScripts/getBuildTools @@ -5,18 +5,19 @@ # set the bash environment variable 'UNATTENDED' to '--assume-yes' for # unattended use (for example in the .travis.yml script) -sudo apt $UNATTENDED install \ - aptitude \ - git \ - pkg-config \ - ruby \ - autoconf \ - libtool \ - cmake \ - make \ - gcc \ - g++ \ - gettext \ - openjdk-8-jre-headless \ +sudo apt-get update +sudo apt-get $UNATTENDED install \ + aptitude \ + git \ + pkg-config \ + ruby \ + autoconf \ + libtool \ + cmake \ + make \ + gcc \ + g++ \ + gettext \ + openjdk-8-jre-headless \ tree diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index eab6818..05638c3 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -6,14 +6,15 @@ # set the bash environment variable 'UNATTENDED' to '--assume-yes' for # unattended use (for example in the .travis.yml script) -sudo apt $UNATTENDED install \ - libcairo-dev \ - libspiro-dev \ - libpng-dev \ - libjpeg-dev \ - poppler-data \ - libpango1.0-dev \ - liblcms2-dev \ - libxml2-dev \ +sudo apt-get update +sudo apt-get $UNATTENDED install \ + libcairo-dev \ + libspiro-dev \ + libpng-dev \ + libjpeg-dev \ + poppler-data \ + libpango1.0-dev \ + liblcms2-dev \ + libxml2-dev \ libuninameslist-dev From be3ebe2dddc140624c5a410f9c9c4b0800a92e96 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 25 Nov 2019 22:17:08 +0000 Subject: [PATCH 039/269] corrected travis 7 --- buildScripts/getDevLibraries | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index 05638c3..9636ffe 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -16,5 +16,5 @@ sudo apt-get $UNATTENDED install \ libpango1.0-dev \ liblcms2-dev \ libxml2-dev \ - libuninameslist-dev - + libuninameslist-dev \ + python-def From c4a7a9fb034036eda0a773ae4b65e35ae25e4c99 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 07:20:17 +0000 Subject: [PATCH 040/269] corrected travis 8 --- buildScripts/getDevLibraries | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index 9636ffe..ab2b7aa 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -17,4 +17,4 @@ sudo apt-get $UNATTENDED install \ liblcms2-dev \ libxml2-dev \ libuninameslist-dev \ - python-def + python-dev From ca690632e9273421f03f77ed9d31fe3ada6408b8 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 07:52:30 +0000 Subject: [PATCH 041/269] check for existing docker commands before trying to create docker --- buildScripts/createDockerImage | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index f9f2cda..226aa08 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -2,33 +2,38 @@ # This bash script creates a docker image from an existing pdf2htmlEX -source buildScripts/versionEnvs +if [ -x "$(which docker)" ]; then -source buildScripts/dockerFunctions + source buildScripts/versionEnvs -mkdir -p imageBuild/dockerDir + source buildScripts/dockerFunctions -cd pdf2htmlEX/build + mkdir -p imageBuild/dockerDir -sudo rm -rf install_manifest.txt + cd pdf2htmlEX/build -make install DESTDIR=../../imageBuild/dockerDir + sudo rm -rf install_manifest.txt -cd ../../imageBuild/dockerDir + make install DESTDIR=../../imageBuild/dockerDir -copy_deps + cd ../../imageBuild/dockerDir -delete_blacklisted + copy_deps -cat >> Dockerfile <> Dockerfile < Date: Tue, 26 Nov 2019 08:43:41 +0000 Subject: [PATCH 042/269] corrected travis 9 --- .travis.yml | 7 +++++++ buildScripts/getDevLibraries | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 32e5583..b8cae24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,13 @@ sudo: true os: - linux # - osx +# - windows + +# for windows *test* of AppImage +# see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job +# and https://discourse.appimage.org/t/run-appimage-on-windows/177 +# and https://docs.travis-ci.com/user/reference/windows/ +# why fuse is not possible on windows: https://superuser.com/questions/179436/is-it-possible-to-use-fuse-with-windows dist: bionic diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index ab2b7aa..6631536 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -17,4 +17,4 @@ sudo apt-get $UNATTENDED install \ liblcms2-dev \ libxml2-dev \ libuninameslist-dev \ - python-dev + libpython-dev From 6e44db6518e1323eb2e4e85cc86a51315a4a7fd3 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 09:07:03 +0000 Subject: [PATCH 043/269] corrected travis 10 --- .travis.yml | 1 + buildScripts/getDevLibraries | 6 ++++-- buildScripts/travisEnvs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8cae24..91101a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ compiler: gcc env: global: - UNATTENDED="--assume-yes" + - FORCE_REINSTALL="--reinstall" #addons: # apt: diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index 6631536..a32a956 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -16,5 +16,7 @@ sudo apt-get $UNATTENDED install \ libpango1.0-dev \ liblcms2-dev \ libxml2-dev \ - libuninameslist-dev \ - libpython-dev + libuninameslist-dev + +sudo apt-get $UNATTENDED $FORCE_REINSTALL install \ + libpython2.7-dev diff --git a/buildScripts/travisEnvs b/buildScripts/travisEnvs index 35d2199..3f8da7a 100644 --- a/buildScripts/travisEnvs +++ b/buildScripts/travisEnvs @@ -1,3 +1,3 @@ export MAKE_PARALLEL="-j `nproc`" - +export FORCE_REINSTALL=--reinstall From 0fdb4212c719e91bfe07c43281a74762e5733e96 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 09:44:53 +0000 Subject: [PATCH 044/269] corrected travis 11 --- buildScripts/buildFontforge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 139d466..3c96ca8 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -16,4 +16,4 @@ do patch -p 1 < $APATCHFILE done -make $MAKE_PARALLEL +make $MAKE_PARALLEL VERBOSE=1 From 496e7f26d79a5d064d64e5d3645e9872d542d162 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 09:45:56 +0000 Subject: [PATCH 045/269] corrected travis 12 --- buildScripts/buildFontforge | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 3c96ca8..f8b96d8 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -16,4 +16,7 @@ do patch -p 1 < $APATCHFILE done + +tree /usr/include/python2.7 + make $MAKE_PARALLEL VERBOSE=1 From 948e523201702a3528b65851494a318899415d2c Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 09:54:05 +0000 Subject: [PATCH 046/269] corrected travis 13 --- buildScripts/buildFontforge | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index f8b96d8..3eb1400 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -19,4 +19,8 @@ done tree /usr/include/python2.7 -make $MAKE_PARALLEL VERBOSE=1 +make -n +make + +#make $MAKE_PARALLEL + From 67db9afabf7eaf3ccbe57234504ee3e470c1e3e1 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 09:55:05 +0000 Subject: [PATCH 047/269] corrected travis 14 --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91101a9..81da3e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,9 +86,6 @@ script: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - ./buildScripts/getBuildTools || travis_terminate 1; - ./buildScripts/getDevLibraries || travis_terminate 1; - - ./buildScripts/getPoppler || travis_terminate 1; - - ./buildScripts/buildPoppler || travis_terminate 1; - - ./buildScripts/installPoppler || travis_terminate 1; - ./buildScripts/getFontforge || travis_terminate 1; - ./buildScripts/buildFontforge || travis_terminate 1; - ./buildScripts/installFontforge || travis_terminate 1; @@ -97,3 +94,7 @@ script: - ./buildScripts/createAppImage || travis_terminate 1; - ./buildScripts/createDockerImage || travis_terminate 1; - docker push $DOCKER_USERNAME/pdf2htmlex + +# - ./buildScripts/getPoppler || travis_terminate 1; +# - ./buildScripts/buildPoppler || travis_terminate 1; +# - ./buildScripts/installPoppler || travis_terminate 1; From 23d9686096fb2edf0e7958a8bee05950d2634c25 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 10:13:40 +0000 Subject: [PATCH 048/269] corrected travis 15 --- buildScripts/buildFontforge | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 3eb1400..5f19194 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -19,7 +19,10 @@ done tree /usr/include/python2.7 +cd fontforge make -n + +cd .. make #make $MAKE_PARALLEL From df1f265592dae0cd2356a2a06edb1a901af9b555 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 10:18:08 +0000 Subject: [PATCH 049/269] corrected travis 16 --- buildScripts/buildFontforge | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 5f19194..0ee7d26 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -6,7 +6,7 @@ source buildScripts/versionEnvs cd fontforge ./bootstrap -./configure +./configure --disable-silent-rules # Apply any patches required for fontforge raw sources before we make # @@ -19,10 +19,10 @@ done tree /usr/include/python2.7 -cd fontforge -make -n +#cd fontforge +#make -n +#cd .. -cd .. make #make $MAKE_PARALLEL From d6420613d977c26b4a68f340cb363129b8638c22 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 10:49:39 +0000 Subject: [PATCH 050/269] corrected travis 17 --- buildScripts/buildFontforge | 2 ++ buildScripts/fontforgeConfig.site | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 buildScripts/fontforgeConfig.site diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 0ee7d26..520842a 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -4,6 +4,8 @@ source buildScripts/versionEnvs +export CONFIG_SITE=$(pwd)/buildScripts/fontforgeConfig.site + cd fontforge ./bootstrap ./configure --disable-silent-rules diff --git a/buildScripts/fontforgeConfig.site b/buildScripts/fontforgeConfig.site new file mode 100644 index 0000000..567ff41 --- /dev/null +++ b/buildScripts/fontforgeConfig.site @@ -0,0 +1,6 @@ +# This autotools config.site file add the python2.7 include files which are +# for some reason missed in the standard fontforge configuration on +# travisCI + +CFLAGS=$CFLAGS -I/usr/include/python2.7 + From d22652e5ba0b6b9660a9cc47a16f5adfb2aa0dc5 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 10:54:21 +0000 Subject: [PATCH 051/269] corrected travis 18 --- buildScripts/buildFontforge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 520842a..db680e2 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -4,7 +4,7 @@ source buildScripts/versionEnvs -export CONFIG_SITE=$(pwd)/buildScripts/fontforgeConfig.site +export CONFIG_SITE=/home/travis/build/pdf2htmlEX/buildScripts/fontforgeConfig.site cd fontforge ./bootstrap From 7a74250679b4fc4ecedafd635d92bddcf69f00a2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 11:19:49 +0000 Subject: [PATCH 052/269] corrected travis 19 --- buildScripts/buildFontforge | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index db680e2..81d5340 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -6,6 +6,8 @@ source buildScripts/versionEnvs export CONFIG_SITE=/home/travis/build/pdf2htmlEX/buildScripts/fontforgeConfig.site +pkg-config --cflags python + cd fontforge ./bootstrap ./configure --disable-silent-rules From de1be14b03fee2c78e5a74b34d793907d115526b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 11:33:53 +0000 Subject: [PATCH 053/269] corrected travis 20 --- buildScripts/buildFontforge | 1 + 1 file changed, 1 insertion(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 81d5340..8d0910e 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -7,6 +7,7 @@ source buildScripts/versionEnvs export CONFIG_SITE=/home/travis/build/pdf2htmlEX/buildScripts/fontforgeConfig.site pkg-config --cflags python +pkg-config --cflags python-2.7 cd fontforge ./bootstrap From 73f0eb7191de6a983825b0b01794089e1003ddba Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 11:45:58 +0000 Subject: [PATCH 054/269] corrected travis 21 --- buildScripts/buildFontforge | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 8d0910e..ff4a29f 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -13,6 +13,12 @@ cd fontforge ./bootstrap ./configure --disable-silent-rules +echo "" +echo "-------------------------------" +cat config.log +echo "-------------------------------" +echo "" + # Apply any patches required for fontforge raw sources before we make # for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*) From 34d53bdb753f3cb9677c35838af4273a827d0bd7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 12:03:23 +0000 Subject: [PATCH 055/269] corrected travis 22 --- buildScripts/fontforgeConfig.site | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/fontforgeConfig.site b/buildScripts/fontforgeConfig.site index 567ff41..4c8361b 100644 --- a/buildScripts/fontforgeConfig.site +++ b/buildScripts/fontforgeConfig.site @@ -2,5 +2,5 @@ # for some reason missed in the standard fontforge configuration on # travisCI -CFLAGS=$CFLAGS -I/usr/include/python2.7 +PYTHON_CFLAGS=$PYTHON_CFLAGS -I/usr/include/python2.7 From ec7d6d9379266caed455c7d4ba19736f2025f741 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 12:13:27 +0000 Subject: [PATCH 056/269] corrected travis 23 --- buildScripts/buildFontforge | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index ff4a29f..e57731f 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -19,6 +19,13 @@ cat config.log echo "-------------------------------" echo "" +echo "" +echo "-------------------------------" +cat fontforge/Makefile +echo "-------------------------------" +echo "" + + # Apply any patches required for fontforge raw sources before we make # for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*) From 0792e570a5ad53b55bd9c46f6cf78329c3806187 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 12:36:10 +0000 Subject: [PATCH 057/269] corrected travis 24 --- buildScripts/buildFontforge | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index e57731f..7954663 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -6,8 +6,14 @@ source buildScripts/versionEnvs export CONFIG_SITE=/home/travis/build/pdf2htmlEX/buildScripts/fontforgeConfig.site +echo "" +echo "-------------------------------" pkg-config --cflags python pkg-config --cflags python-2.7 +echo $PYTHON_CFLAGS +echo $PYTHON_LIBS +echo "-------------------------------" +echo "" cd fontforge ./bootstrap From d65e6ff66ebd3907135163d29889673b614c75a3 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 12:55:53 +0000 Subject: [PATCH 058/269] corrected travis 25 --- buildScripts/buildFontforge | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 7954663..5b6d78f 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -4,7 +4,14 @@ source buildScripts/versionEnvs -export CONFIG_SITE=/home/travis/build/pdf2htmlEX/buildScripts/fontforgeConfig.site + +# This is a work-around to fix TravisCI's declaration of PYTHON_CFLAGS +# which is then honoured exactly as is by the fontforge bootstrap and +# configure steps +# +if [ -n "$PYTHON_CFLAGS" ] ; then + export PYTHON_CFLAGS="$(pkg-config --cflags python) $PYTHON_CFLAGS" +fi echo "" echo "-------------------------------" @@ -40,7 +47,6 @@ do patch -p 1 < $APATCHFILE done - tree /usr/include/python2.7 #cd fontforge From aa66683277e14843994faf49a72668b4b9c045bd Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 13:10:52 +0000 Subject: [PATCH 059/269] corrected travis 26 --- .travis.yml | 6 +++--- buildScripts/buildFontforge | 36 ++++++++----------------------- buildScripts/fontforgeConfig.site | 6 ------ buildScripts/getDevLibraries | 6 ++---- buildScripts/travisEnvs | 1 - 5 files changed, 14 insertions(+), 41 deletions(-) delete mode 100644 buildScripts/fontforgeConfig.site diff --git a/.travis.yml b/.travis.yml index 81da3e7..43790e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,6 +86,9 @@ script: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - ./buildScripts/getBuildTools || travis_terminate 1; - ./buildScripts/getDevLibraries || travis_terminate 1; + - ./buildScripts/getPoppler || travis_terminate 1; + - ./buildScripts/buildPoppler || travis_terminate 1; + - ./buildScripts/installPoppler || travis_terminate 1; - ./buildScripts/getFontforge || travis_terminate 1; - ./buildScripts/buildFontforge || travis_terminate 1; - ./buildScripts/installFontforge || travis_terminate 1; @@ -95,6 +98,3 @@ script: - ./buildScripts/createDockerImage || travis_terminate 1; - docker push $DOCKER_USERNAME/pdf2htmlex -# - ./buildScripts/getPoppler || travis_terminate 1; -# - ./buildScripts/buildPoppler || travis_terminate 1; -# - ./buildScripts/installPoppler || travis_terminate 1; diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 5b6d78f..40ca338 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -7,37 +7,27 @@ source buildScripts/versionEnvs # This is a work-around to fix TravisCI's declaration of PYTHON_CFLAGS # which is then honoured exactly as is by the fontforge bootstrap and -# configure steps +# configure steps. +# +# see: https://github.com/travis-ci/travis-ci/issues/5301 (unfixed) # if [ -n "$PYTHON_CFLAGS" ] ; then export PYTHON_CFLAGS="$(pkg-config --cflags python) $PYTHON_CFLAGS" fi echo "" +echo "PYTHON_CFLAGS: echo "-------------------------------" -pkg-config --cflags python -pkg-config --cflags python-2.7 echo $PYTHON_CFLAGS -echo $PYTHON_LIBS echo "-------------------------------" echo "" +# Can use "configure --disable-silent-rules" to debug configuration/make +# problems +# cd fontforge ./bootstrap -./configure --disable-silent-rules - -echo "" -echo "-------------------------------" -cat config.log -echo "-------------------------------" -echo "" - -echo "" -echo "-------------------------------" -cat fontforge/Makefile -echo "-------------------------------" -echo "" - +./configure # Apply any patches required for fontforge raw sources before we make # @@ -47,13 +37,5 @@ do patch -p 1 < $APATCHFILE done -tree /usr/include/python2.7 - -#cd fontforge -#make -n -#cd .. - -make - -#make $MAKE_PARALLEL +make $MAKE_PARALLEL diff --git a/buildScripts/fontforgeConfig.site b/buildScripts/fontforgeConfig.site deleted file mode 100644 index 4c8361b..0000000 --- a/buildScripts/fontforgeConfig.site +++ /dev/null @@ -1,6 +0,0 @@ -# This autotools config.site file add the python2.7 include files which are -# for some reason missed in the standard fontforge configuration on -# travisCI - -PYTHON_CFLAGS=$PYTHON_CFLAGS -I/usr/include/python2.7 - diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index a32a956..6631536 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -16,7 +16,5 @@ sudo apt-get $UNATTENDED install \ libpango1.0-dev \ liblcms2-dev \ libxml2-dev \ - libuninameslist-dev - -sudo apt-get $UNATTENDED $FORCE_REINSTALL install \ - libpython2.7-dev + libuninameslist-dev \ + libpython-dev diff --git a/buildScripts/travisEnvs b/buildScripts/travisEnvs index 3f8da7a..f9e4553 100644 --- a/buildScripts/travisEnvs +++ b/buildScripts/travisEnvs @@ -1,3 +1,2 @@ export MAKE_PARALLEL="-j `nproc`" -export FORCE_REINSTALL=--reinstall From 73408eab6ac2970c64823a7ad76e5f3c2ca4853d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 13:18:21 +0000 Subject: [PATCH 060/269] corrected travis 27 --- buildScripts/buildFontforge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 40ca338..cd2a9b1 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -16,7 +16,7 @@ if [ -n "$PYTHON_CFLAGS" ] ; then fi echo "" -echo "PYTHON_CFLAGS: +echo "PYTHON_CFLAGS:" echo "-------------------------------" echo $PYTHON_CFLAGS echo "-------------------------------" From 7b6826584555cb436010cb13abcbf9f94eb95fa7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 13:41:13 +0000 Subject: [PATCH 061/269] corrected travis 28 --- buildScripts/createAppImage | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index c86c0f2..e04900e 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -4,6 +4,10 @@ source buildScripts/versionEnvs +# For appimage output plugin +# +export VERSION=$PDF2HTMLEX_VERSION + mkdir -p imageBuild/appDir/usr/lib/ cd pdf2htmlEX/build @@ -30,6 +34,3 @@ chmod a+x $LINUX_DEPLOY_APP_IMAGE -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ --appdir=appDir \ --output appimage - -mv pdf2htmlEX-$MACHINE_ARCH.AppImage \ - pdf2htmlEX-$PDF2HTMLEX_VERSION-$MACHINE_ARCH.AppImage From 342a7569cc34b84637ac768d66563a5a89e580f8 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 17:13:58 +0000 Subject: [PATCH 062/269] travis test release of appImage --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 43790e9..25f530e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -98,3 +98,13 @@ script: - ./buildScripts/createDockerImage || travis_terminate 1; - docker push $DOCKER_USERNAME/pdf2htmlex +deploy: + provider: releases + api_key: + secure: ALWKAkgeLSPS4ULyTtxU50ZmSICEafCirCQ1YmuVTqe9nrc8E9Jm+4QaBlab5k6v90EpzNvZBnMOiT8cT1Wp2lqJzcGdGMcG49mhRvirdYhXgWuHYnygVgkxEhgejXcQaEiaGPDV3Y1k9MuiAVr8ApjUvIMlY4Hg1y0r7/rqR2fYmen+f+6a87bp5PptwakC9bfoYb92651d0TbugFfKT6TGKlE2jGlQ6On1alzLQ2DXA8coUjwpp4NcDD8OhnYGN/VZWkqckaBrMrHwjJ5FTfy5MGBOqCLzNix8sCGLEeCKkKC8J0nniNJ7+KOu9LJ2uIezKYfaUOJV0kik7F9ErvxjbfSRieako2yaSOR8X39aicTtpbyoXPRSKDU4WYX56vt4Dx7aNrYtP5b/UwWGXZa9MK7rNGJ+hiMDO1AzuyXirzR4RaJXCyC8n5W9ahBZBHCMqd5gMg5sMGPNj3Rgt34+R+nGYssum5wvr+6IKNl57sIoZFCgqviBrw2gJOCqlgOcEk/4ZSehWnXPCk6Gzxvkqkt/dmp8pJLNyvMaWcEZ6CXNHDU8MZS7bASo8Z7eAYvmX0MMjVty8J47expVaJ8M3OFHu6lE6tU8wwfd+Igr2TlWcixqaa3hDMgS+ghwdiZbYuMdR1AyZnEqK3xwvXXPPXrqRsB9xHtczLibkjY= + file: pdf2htmlEX-newBuildSystem-x86_64.AppImage + skip_cleanup: true + on: + repo: stephengaito/pdf2htmlEX + branch: newBuildSystem + From db644bd1a86453cafbeaa84c99634c7f085aedad Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 26 Nov 2019 19:43:56 +0000 Subject: [PATCH 063/269] travis test of release appImage 2 --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 25f530e..37db6b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" + - TRAVIS_TAG="test-$PDF2HTMLEX_VERSION-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: @@ -105,6 +106,6 @@ deploy: file: pdf2htmlEX-newBuildSystem-x86_64.AppImage skip_cleanup: true on: + tags: true repo: stephengaito/pdf2htmlEX - branch: newBuildSystem From 891900c99d35abc9a4d36906e294f3316c8ca488 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 08:50:34 +0000 Subject: [PATCH 064/269] test travisci 1 --- .travis.yml | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 37db6b2..be6fbb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,28 +84,32 @@ matrix: # - os: osx # Until the build passes, then re-enable. script: - - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - - ./buildScripts/getBuildTools || travis_terminate 1; - - ./buildScripts/getDevLibraries || travis_terminate 1; - - ./buildScripts/getPoppler || travis_terminate 1; - - ./buildScripts/buildPoppler || travis_terminate 1; - - ./buildScripts/installPoppler || travis_terminate 1; - - ./buildScripts/getFontforge || travis_terminate 1; - - ./buildScripts/buildFontforge || travis_terminate 1; - - ./buildScripts/installFontforge || travis_terminate 1; - - ./buildScripts/buildPdf2htmlEX || travis_terminate 1; - - ./buildScripts/installPdf2htmlEX || travis_terminate 1; - - ./buildScripts/createAppImage || travis_terminate 1; - - ./buildScripts/createDockerImage || travis_terminate 1; - - docker push $DOCKER_USERNAME/pdf2htmlex + - echo $TRAVIS_TAG + - echo $TRAVIS_BRANCH + - echo $TRAVIS_BUILD_DIR + - echo $HOME +# - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin +# - ./buildScripts/getBuildTools || travis_terminate 1; +# - ./buildScripts/getDevLibraries || travis_terminate 1; +# - ./buildScripts/getPoppler || travis_terminate 1; +# - ./buildScripts/buildPoppler || travis_terminate 1; +# - ./buildScripts/installPoppler || travis_terminate 1; +# - ./buildScripts/getFontforge || travis_terminate 1; +# - ./buildScripts/buildFontforge || travis_terminate 1; +# - ./buildScripts/installFontforge || travis_terminate 1; +# - ./buildScripts/buildPdf2htmlEX || travis_terminate 1; +# - ./buildScripts/installPdf2htmlEX || travis_terminate 1; +# - ./buildScripts/createAppImage || travis_terminate 1; +# - ./buildScripts/createDockerImage || travis_terminate 1; +# - docker push $DOCKER_USERNAME/pdf2htmlex -deploy: - provider: releases - api_key: - secure: ALWKAkgeLSPS4ULyTtxU50ZmSICEafCirCQ1YmuVTqe9nrc8E9Jm+4QaBlab5k6v90EpzNvZBnMOiT8cT1Wp2lqJzcGdGMcG49mhRvirdYhXgWuHYnygVgkxEhgejXcQaEiaGPDV3Y1k9MuiAVr8ApjUvIMlY4Hg1y0r7/rqR2fYmen+f+6a87bp5PptwakC9bfoYb92651d0TbugFfKT6TGKlE2jGlQ6On1alzLQ2DXA8coUjwpp4NcDD8OhnYGN/VZWkqckaBrMrHwjJ5FTfy5MGBOqCLzNix8sCGLEeCKkKC8J0nniNJ7+KOu9LJ2uIezKYfaUOJV0kik7F9ErvxjbfSRieako2yaSOR8X39aicTtpbyoXPRSKDU4WYX56vt4Dx7aNrYtP5b/UwWGXZa9MK7rNGJ+hiMDO1AzuyXirzR4RaJXCyC8n5W9ahBZBHCMqd5gMg5sMGPNj3Rgt34+R+nGYssum5wvr+6IKNl57sIoZFCgqviBrw2gJOCqlgOcEk/4ZSehWnXPCk6Gzxvkqkt/dmp8pJLNyvMaWcEZ6CXNHDU8MZS7bASo8Z7eAYvmX0MMjVty8J47expVaJ8M3OFHu6lE6tU8wwfd+Igr2TlWcixqaa3hDMgS+ghwdiZbYuMdR1AyZnEqK3xwvXXPPXrqRsB9xHtczLibkjY= - file: pdf2htmlEX-newBuildSystem-x86_64.AppImage - skip_cleanup: true - on: - tags: true - repo: stephengaito/pdf2htmlEX +#deploy: +# provider: releases +# api_key: +# secure: ALWKAkgeLSPS4ULyTtxU50ZmSICEafCirCQ1YmuVTqe9nrc8E9Jm+4QaBlab5k6v90EpzNvZBnMOiT8cT1Wp2lqJzcGdGMcG49mhRvirdYhXgWuHYnygVgkxEhgejXcQaEiaGPDV3Y1k9MuiAVr8ApjUvIMlY4Hg1y0r7/rqR2fYmen+f+6a87bp5PptwakC9bfoYb92651d0TbugFfKT6TGKlE2jGlQ6On1alzLQ2DXA8coUjwpp4NcDD8OhnYGN/VZWkqckaBrMrHwjJ5FTfy5MGBOqCLzNix8sCGLEeCKkKC8J0nniNJ7+KOu9LJ2uIezKYfaUOJV0kik7F9ErvxjbfSRieako2yaSOR8X39aicTtpbyoXPRSKDU4WYX56vt4Dx7aNrYtP5b/UwWGXZa9MK7rNGJ+hiMDO1AzuyXirzR4RaJXCyC8n5W9ahBZBHCMqd5gMg5sMGPNj3Rgt34+R+nGYssum5wvr+6IKNl57sIoZFCgqviBrw2gJOCqlgOcEk/4ZSehWnXPCk6Gzxvkqkt/dmp8pJLNyvMaWcEZ6CXNHDU8MZS7bASo8Z7eAYvmX0MMjVty8J47expVaJ8M3OFHu6lE6tU8wwfd+Igr2TlWcixqaa3hDMgS+ghwdiZbYuMdR1AyZnEqK3xwvXXPPXrqRsB9xHtczLibkjY= +# file: pdf2htmlEX-newBuildSystem-x86_64.AppImage +# skip_cleanup: true +# on: +# tags: true +# repo: stephengaito/pdf2htmlEX From cb0e2e8d0897260f4da0c54442524d477e1b6d03 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 08:53:28 +0000 Subject: [PATCH 065/269] test travisci 2 --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index be6fbb0..586e6e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" - - TRAVIS_TAG="test-$PDF2HTMLEX_VERSION-$(date +%Y_%m_%d-%H_%M_%S)" + - TRAVIS_TAG="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: @@ -88,6 +88,8 @@ script: - echo $TRAVIS_BRANCH - echo $TRAVIS_BUILD_DIR - echo $HOME + - pwd + - ls -la # - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin # - ./buildScripts/getBuildTools || travis_terminate 1; # - ./buildScripts/getDevLibraries || travis_terminate 1; From f849507a9fb006ca3cb6654f7823019c802d55df Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 08:56:21 +0000 Subject: [PATCH 066/269] test travisci 3 --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 586e6e5..b950e8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,6 +90,9 @@ script: - echo $HOME - pwd - ls -la + - cd + - pwd + - ls -la # - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin # - ./buildScripts/getBuildTools || travis_terminate 1; # - ./buildScripts/getDevLibraries || travis_terminate 1; From eaa43586766bf52e22528045c54d8f2fb0b1d40f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 09:00:20 +0000 Subject: [PATCH 067/269] test travisci 4 --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index b950e8c..381f3c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,6 +93,9 @@ script: - cd - pwd - ls -la + - cd build + - pwd + - ls -la # - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin # - ./buildScripts/getBuildTools || travis_terminate 1; # - ./buildScripts/getDevLibraries || travis_terminate 1; From 50b19819312d4c000dc78971b3a27302f1e42c0b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 09:02:22 +0000 Subject: [PATCH 068/269] test travisci 5 --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 381f3c1..8af436e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,6 +96,9 @@ script: - cd build - pwd - ls -la + - cd [secure] + - pwd + - ls -la # - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin # - ./buildScripts/getBuildTools || travis_terminate 1; # - ./buildScripts/getDevLibraries || travis_terminate 1; From 14f63e0153da2f2e5df85c6d89c2fd587d0b6c7d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 09:05:46 +0000 Subject: [PATCH 069/269] test travisci 6 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8af436e..e1c34ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,7 +96,7 @@ script: - cd build - pwd - ls -la - - cd [secure] + - cd $TRAVIS_BUILD_DIR - pwd - ls -la # - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin From 6b44ed74719723479741751e4608c117c045a076 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 09:20:07 +0000 Subject: [PATCH 070/269] test travisci 7 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e1c34ff..96174a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" - - TRAVIS_TAG="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" +# - TRAVIS_TAG="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: From aedf075ebfe9ccd9d135658461b2adee06fa2b83 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 10:01:51 +0000 Subject: [PATCH 071/269] test travisci 8 --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96174a9..475ef99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" -# - TRAVIS_TAG="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" + - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: @@ -88,6 +88,11 @@ script: - echo $TRAVIS_BRANCH - echo $TRAVIS_BUILD_DIR - echo $HOME + - echo $TRAVIS_COMMIT + - echo $TRAVIS_REPO_SLUG + - echo $GITHUB_TOKEN + - echo $UPLOADTOOL_SUFFIX + - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - pwd - ls -la - cd @@ -99,6 +104,7 @@ script: - cd $TRAVIS_BUILD_DIR - pwd - ls -la + - cat upload.sh # - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin # - ./buildScripts/getBuildTools || travis_terminate 1; # - ./buildScripts/getDevLibraries || travis_terminate 1; From 72dc72625d48a36845f5cfadf45ddb792349b658 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 12:24:03 +0000 Subject: [PATCH 072/269] travis full test --- .travis.yml | 55 +++++++++++++------------------------ buildScripts/createAppImage | 6 ++++ 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/.travis.yml b/.travis.yml index 475ef99..ef82ba6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,15 @@ services: compiler: gcc +branches: + except: # do not build tags that we create using the upload.sh script + - /^(?i:continuous.*)$/ + env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" - - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" +# - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: @@ -84,41 +88,20 @@ matrix: # - os: osx # Until the build passes, then re-enable. script: - - echo $TRAVIS_TAG - - echo $TRAVIS_BRANCH - - echo $TRAVIS_BUILD_DIR - - echo $HOME - - echo $TRAVIS_COMMIT - - echo $TRAVIS_REPO_SLUG - - echo $GITHUB_TOKEN - - echo $UPLOADTOOL_SUFFIX - - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - - pwd - - ls -la - - cd - - pwd - - ls -la - - cd build - - pwd - - ls -la - - cd $TRAVIS_BUILD_DIR - - pwd - - ls -la - - cat upload.sh -# - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -# - ./buildScripts/getBuildTools || travis_terminate 1; -# - ./buildScripts/getDevLibraries || travis_terminate 1; -# - ./buildScripts/getPoppler || travis_terminate 1; -# - ./buildScripts/buildPoppler || travis_terminate 1; -# - ./buildScripts/installPoppler || travis_terminate 1; -# - ./buildScripts/getFontforge || travis_terminate 1; -# - ./buildScripts/buildFontforge || travis_terminate 1; -# - ./buildScripts/installFontforge || travis_terminate 1; -# - ./buildScripts/buildPdf2htmlEX || travis_terminate 1; -# - ./buildScripts/installPdf2htmlEX || travis_terminate 1; -# - ./buildScripts/createAppImage || travis_terminate 1; -# - ./buildScripts/createDockerImage || travis_terminate 1; -# - docker push $DOCKER_USERNAME/pdf2htmlex + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - ./buildScripts/getBuildTools || travis_terminate 1; + - ./buildScripts/getDevLibraries || travis_terminate 1; + - ./buildScripts/getPoppler || travis_terminate 1; + - ./buildScripts/buildPoppler || travis_terminate 1; + - ./buildScripts/installPoppler || travis_terminate 1; + - ./buildScripts/getFontforge || travis_terminate 1; + - ./buildScripts/buildFontforge || travis_terminate 1; + - ./buildScripts/installFontforge || travis_terminate 1; + - ./buildScripts/buildPdf2htmlEX || travis_terminate 1; + - ./buildScripts/installPdf2htmlEX || travis_terminate 1; + - ./buildScripts/createAppImage || travis_terminate 1; + - ./buildScripts/createDockerImage || travis_terminate 1; + - docker push $DOCKER_USERNAME/pdf2htmlex #deploy: # provider: releases diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index e04900e..dbc9298 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -34,3 +34,9 @@ chmod a+x $LINUX_DEPLOY_APP_IMAGE -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ --appdir=appDir \ --output appimage + +wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh + +bash upload.sh pdf2htmlEX*.AppImage + + From 633b67144b404c70a4f913aff560e48ae29ea62d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 12:53:22 +0000 Subject: [PATCH 073/269] travis full test 1 --- .travis.yml | 1 + buildScripts/createDockerImage | 4 ++-- buildScripts/reportEnvs | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100755 buildScripts/reportEnvs diff --git a/.travis.yml b/.travis.yml index ef82ba6..5310be5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,6 +89,7 @@ matrix: script: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - ./buildScripts/reportEnvs || travis_terminate 1; - ./buildScripts/getBuildTools || travis_terminate 1; - ./buildScripts/getDevLibraries || travis_terminate 1; - ./buildScripts/getPoppler || travis_terminate 1; diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 226aa08..d2247f6 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -26,12 +26,12 @@ if [ -x "$(which docker)" ]; then FROM $DOCKER_FROM COPY ./ / RUN ldconfig -ENTRYPOINT ["/usr/bin/pdf2htmlEX"] +ENTRYPOINT ["/usr/local/bin/pdf2htmlEX"] DOCKERFILE_HERE_DOC cd .. - docker build -t stephengaito/pdf2htmlex:test-`date +%Y%m%d-%H.%M.%S` dockerDir + docker build -t stephengaito/pdf2htmlex:test-`date +%Y_%m_%d-%H_%M_%S` dockerDir else echo "Docker is not installed... skipping creation of a docker image." diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs new file mode 100755 index 0000000..bac508a --- /dev/null +++ b/buildScripts/reportEnvs @@ -0,0 +1,22 @@ +#!/bin/bash + +# This bash script reports the more important TRAVIS environment variables + +echo "TravisCI env:" +echo " tag: [$TARVIS_TAG]" +echo " branch: [$TARVIS_BRANCH]" +echo " commit: [$TARVIS_COMMIT]" +echo " build dir: [$TRAVIS_BUILD_DIR]" +echo " repo slug: [$TRAVIS_REPO_SLUG]" + +echo "UploadTool env:" +echo " suffix: [$UPLOADTOOL_SUFFIX]" + +source ./buildScripts/versionEnvs + +echo "pdf2htmlEX env:" +echo " poppler: [$POPPLER_VERSION]" +echo " fontforge: [$FONTFORGE_VERSION]" +echo " pdf2htmlEX: [$PDF2HTMLEX_VERSION]" +echo " docker from: [$DOCKER_FROM]" +echo "machine arch: [$MACHINE_ARCH]" From c52278a8fb57bcc42750ff1081d18f37f937732c Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 15:22:02 +0000 Subject: [PATCH 074/269] travis full test 2 --- .travis.yml | 2 +- buildScripts/reportEnvs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5310be5..51f1f68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" -# - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" + - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index bac508a..28e34d1 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -3,9 +3,9 @@ # This bash script reports the more important TRAVIS environment variables echo "TravisCI env:" -echo " tag: [$TARVIS_TAG]" -echo " branch: [$TARVIS_BRANCH]" -echo " commit: [$TARVIS_COMMIT]" +echo " tag: [$TRAVIS_TAG]" +echo " branch: [$TRAVIS_BRANCH]" +echo " commit: [$TRAVIS_COMMIT]" echo " build dir: [$TRAVIS_BUILD_DIR]" echo " repo slug: [$TRAVIS_REPO_SLUG]" From 606d8a987952d4f8d170178c3e98547f36472712 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 15:41:47 +0000 Subject: [PATCH 075/269] travis full test 3 --- .travis.yml | 2 +- buildScripts/createAppImage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51f1f68..5310be5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" - - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" +# - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index dbc9298..a4971af 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -6,7 +6,7 @@ source buildScripts/versionEnvs # For appimage output plugin # -export VERSION=$PDF2HTMLEX_VERSION +export VERSION="$PDF2HTMLEX_VERSION-$(date +%Y_%m_%d-%H_%M_%S)" mkdir -p imageBuild/appDir/usr/lib/ From acb14e9900764c0e1e80859882c09c63cabea291 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 16:44:08 +0000 Subject: [PATCH 076/269] travis full test 4 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5310be5..3a5ef3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ env: global: - UNATTENDED="--assume-yes" - FORCE_REINSTALL="--reinstall" -# - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" +## - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" #addons: # apt: From c5d5799b13d3aa96bcc53760ba6c3bd32f542650 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 17:33:15 +0000 Subject: [PATCH 077/269] travis full test 5 --- buildScripts/createAppImage | 1 + 1 file changed, 1 insertion(+) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index a4971af..e26a26b 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -7,6 +7,7 @@ source buildScripts/versionEnvs # For appimage output plugin # export VERSION="$PDF2HTMLEX_VERSION-$(date +%Y_%m_%d-%H_%M_%S)" +export UPLOADTOOL_BODY="This is the development/testing release of the pdf2htmlEX AppImage. You can download the AppImage and 'just run it'. See: https://appimage.org/ " mkdir -p imageBuild/appDir/usr/lib/ From 4006c6ebc9b5418561db385ded78f94d15caa76e Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 27 Nov 2019 17:34:24 +0000 Subject: [PATCH 078/269] travis full test 6 --- buildScripts/createAppImage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index e26a26b..3a6b788 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -7,7 +7,7 @@ source buildScripts/versionEnvs # For appimage output plugin # export VERSION="$PDF2HTMLEX_VERSION-$(date +%Y_%m_%d-%H_%M_%S)" -export UPLOADTOOL_BODY="This is the development/testing release of the pdf2htmlEX AppImage. You can download the AppImage and 'just run it'. See: https://appimage.org/ " +export UPLOADTOOL_BODY="This is the development/testing release of the pdf2htmlEX AppImage.\n\nYou can download the AppImage and 'just run it'.\n\nSee: https://appimage.org/ " mkdir -p imageBuild/appDir/usr/lib/ From 7f4f72fb05a09df4c80daffd1ceb9d1ed65f81ce Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 09:07:49 +0000 Subject: [PATCH 079/269] refactored upload --- .travis.yml => .travis.yml.off | 10 ++---- buildScripts/createAppImage | 7 +--- buildScripts/createDockerImage | 2 +- buildScripts/getPdf2htmlEX | 10 +++--- buildScripts/reportEnvs | 27 ++++++++------ buildScripts/travisEnvs | 1 + buildScripts/uploadRelease | 65 ++++++++++++++++++++++++++++++++++ buildScripts/versionEnvs | 11 ++++-- 8 files changed, 100 insertions(+), 33 deletions(-) rename .travis.yml => .travis.yml.off (92%) create mode 100755 buildScripts/uploadRelease diff --git a/.travis.yml b/.travis.yml.off similarity index 92% rename from .travis.yml rename to .travis.yml.off index 3a5ef3a..0cfce99 100644 --- a/.travis.yml +++ b/.travis.yml.off @@ -24,12 +24,6 @@ branches: except: # do not build tags that we create using the upload.sh script - /^(?i:continuous.*)$/ -env: - global: - - UNATTENDED="--assume-yes" - - FORCE_REINSTALL="--reinstall" -## - UPLOADTOOL_SUFFIX="test-$TRAVIS_BRANCH-$(date +%Y_%m_%d-%H_%M_%S)" - #addons: # apt: # update: true @@ -88,7 +82,7 @@ matrix: # - os: osx # Until the build passes, then re-enable. script: - - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - ./buildScripts/travisEnvs || travis_terminate 1; - ./buildScripts/reportEnvs || travis_terminate 1; - ./buildScripts/getBuildTools || travis_terminate 1; - ./buildScripts/getDevLibraries || travis_terminate 1; @@ -102,7 +96,7 @@ script: - ./buildScripts/installPdf2htmlEX || travis_terminate 1; - ./buildScripts/createAppImage || travis_terminate 1; - ./buildScripts/createDockerImage || travis_terminate 1; - - docker push $DOCKER_USERNAME/pdf2htmlex + - ./buildScripts/uploadRelease || travis_terminate 1; #deploy: # provider: releases diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 3a6b788..3fcbe5a 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -6,8 +6,7 @@ source buildScripts/versionEnvs # For appimage output plugin # -export VERSION="$PDF2HTMLEX_VERSION-$(date +%Y_%m_%d-%H_%M_%S)" -export UPLOADTOOL_BODY="This is the development/testing release of the pdf2htmlEX AppImage.\n\nYou can download the AppImage and 'just run it'.\n\nSee: https://appimage.org/ " +export VERSION="$PDF2HTMLEX_BRANCH-$BUILD_TIME" mkdir -p imageBuild/appDir/usr/lib/ @@ -36,8 +35,4 @@ chmod a+x $LINUX_DEPLOY_APP_IMAGE --appdir=appDir \ --output appimage -wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - -bash upload.sh pdf2htmlEX*.AppImage - diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index d2247f6..82d33fc 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -31,7 +31,7 @@ DOCKERFILE_HERE_DOC cd .. - docker build -t stephengaito/pdf2htmlex:test-`date +%Y_%m_%d-%H_%M_%S` dockerDir + docker build -t $DOCKER_USERNAME/pdf2htmlex:-`date +%Y_%m_%d-%H_%M_%S` dockerDir else echo "Docker is not installed... skipping creation of a docker image." diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX index a3a375d..2232ad1 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEX @@ -3,14 +3,14 @@ # This bash script automates the process of getting the original pdf2htmlEX # source -PDF2HTMLEX_VERSION=newBuildSystem +PDF2HTMLEX_BRANCH=newBuildSystem -wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_VERSION +wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_BRANCH -mv $PDF2HTMLEX_VERSION $PDF2HTMLEX_VERSION.zip +mv $PDF2HTMLEX_BRANCH $PDF2HTMLEX_BRANCH.zip sudo apt install unzip -unzip $PDF2HTMLEX_VERSION.zip +unzip $PDF2HTMLEX_BRANCH.zip -mv pdf2htmlEX-$PDF2HTMLEX_VERSION pdf2htmlEX +mv pdf2htmlEX-$PDF2HTMLEX_BRANCH pdf2htmlEX diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index 28e34d1..2ad9167 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -3,20 +3,25 @@ # This bash script reports the more important TRAVIS environment variables echo "TravisCI env:" -echo " tag: [$TRAVIS_TAG]" -echo " branch: [$TRAVIS_BRANCH]" -echo " commit: [$TRAVIS_COMMIT]" -echo " build dir: [$TRAVIS_BUILD_DIR]" -echo " repo slug: [$TRAVIS_REPO_SLUG]" +echo " tag: [$TRAVIS_TAG]" +echo " branch: [$TRAVIS_BRANCH]" +echo " commit: [$TRAVIS_COMMIT]" +echo " build dir: [$TRAVIS_BUILD_DIR]" +echo " repo slug: [$TRAVIS_REPO_SLUG]" echo "UploadTool env:" -echo " suffix: [$UPLOADTOOL_SUFFIX]" +echo " suffix: [$UPLOADTOOL_SUFFIX]" source ./buildScripts/versionEnvs echo "pdf2htmlEX env:" -echo " poppler: [$POPPLER_VERSION]" -echo " fontforge: [$FONTFORGE_VERSION]" -echo " pdf2htmlEX: [$PDF2HTMLEX_VERSION]" -echo " docker from: [$DOCKER_FROM]" -echo "machine arch: [$MACHINE_ARCH]" +echo " poppler: [$POPPLER_VERSION]" +echo " fontforge: [$FONTFORGE_VERSION]" +echo " pdf2htmlEX: [$PDF2HTMLEX_BRANCH]" +echo " machine arch: [$MACHINE_ARCH]" + +echo "release env:" +echo " build time: [$BUILD_TIME]" +echo " docker from: [$DOCKER_FROM]" +echo " docker name: [$DOCKER_NAME]" +echo "appImage name: [$APPIMAGE_NAME]" diff --git a/buildScripts/travisEnvs b/buildScripts/travisEnvs index f9e4553..ce997c5 100644 --- a/buildScripts/travisEnvs +++ b/buildScripts/travisEnvs @@ -1,2 +1,3 @@ +export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j `nproc`" diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease new file mode 100755 index 0000000..33f342f --- /dev/null +++ b/buildScripts/uploadRelease @@ -0,0 +1,65 @@ +#!/bin/bash + +# This bash script uploads the pdf2htmlEX release artefacts +# +# We EXPECT the following environment variables to be set: +# GITHUB_TOKEN +# DOCKER_USERNAME +# +# You can OPTIONALLY set the following environment variables: +# DOCKER_PASSWORD (if not set you will be asked for your password) +# UPLOADTOOL_BODY (the text of the github release message) +# + +################################## +# upload github release artefacts +# + +if [ -n "$GITHUB_TOKEN" ]; then + wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh + + echo $BUILD_TIME > buildTime + + echo $APPIMAGE_NAME > appImageName + + echo $DOCKER_NAME > dockerImageName + + if [ -z "$UPLOADTOOL_BODY" ]; then + export UPLOADTOOL_BODY=< Date: Thu, 28 Nov 2019 09:15:56 +0000 Subject: [PATCH 080/269] corrected doItAll --- buildScripts/doItAll | 9 ++++++++- buildScripts/reportEnvs | 32 +++++++++++++++++--------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/buildScripts/doItAll b/buildScripts/doItAll index aee2d2f..7eef747 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -3,7 +3,12 @@ # This bash script builds the complete pdf2htmlEX application LOCALLY # (It does not create the AppImage or Docker images) -export UNATTENDED=--assume-yes +# Adjust the following two environment variables to suit your needs +# +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } ./buildScripts/getBuildTools || { echo 'getBuildTools FAILED' ; exit 1 ; } @@ -28,3 +33,5 @@ export UNATTENDED=--assume-yes ./buildScripts/createAppImage || { echo 'createAppImage FAILED' ; exit 1 ; } ./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; } + +./buildScripts/uploadRelease || { echo 'uploadRelease FAILED' ; exit 1 ; } diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index 2ad9167..f174f1e 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -3,25 +3,27 @@ # This bash script reports the more important TRAVIS environment variables echo "TravisCI env:" -echo " tag: [$TRAVIS_TAG]" -echo " branch: [$TRAVIS_BRANCH]" -echo " commit: [$TRAVIS_COMMIT]" -echo " build dir: [$TRAVIS_BUILD_DIR]" -echo " repo slug: [$TRAVIS_REPO_SLUG]" +echo " tag: [$TRAVIS_TAG]" +echo " branch: [$TRAVIS_BRANCH]" +echo " commit: [$TRAVIS_COMMIT]" +echo " build dir: [$TRAVIS_BUILD_DIR]" +echo " repo slug: [$TRAVIS_REPO_SLUG]" -echo "UploadTool env:" -echo " suffix: [$UPLOADTOOL_SUFFIX]" +echo "Build env:" +echo " unattended: [$UNATTENEDED]" +echo " make parallel: [$MAKE_PARALLEL]" source ./buildScripts/versionEnvs echo "pdf2htmlEX env:" -echo " poppler: [$POPPLER_VERSION]" -echo " fontforge: [$FONTFORGE_VERSION]" -echo " pdf2htmlEX: [$PDF2HTMLEX_BRANCH]" -echo " machine arch: [$MACHINE_ARCH]" +echo " poppler: [$POPPLER_VERSION]" +echo " fontforge: [$FONTFORGE_VERSION]" +echo " pdf2htmlEX: [$PDF2HTMLEX_BRANCH]" +echo " machine arch: [$MACHINE_ARCH]" echo "release env:" -echo " build time: [$BUILD_TIME]" -echo " docker from: [$DOCKER_FROM]" -echo " docker name: [$DOCKER_NAME]" -echo "appImage name: [$APPIMAGE_NAME]" +echo " build time: [$BUILD_TIME]" +echo " docker from: [$DOCKER_FROM]" +echo " docker name: [$DOCKER_NAME]" +echo " appImage name: [$APPIMAGE_NAME]" +echo "uploadTool suffix: [$UPLOADTOOL_SUFFIX]" From 24631e31ab1d4ae71fd9fccf65947e31164d3d31 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 10:28:03 +0000 Subject: [PATCH 081/269] begun refactoring travis for tests as well as builds --- .travis.yml.off | 36 +++++++++++++----------------------- buildScripts/doItAll | 8 ++++++++ buildScripts/doItAllTravis | 24 ++++++++++++++++++++++++ buildScripts/reportEnvs | 2 +- buildScripts/travisEnvs | 3 --- buildScripts/versionEnvs | 4 +++- testScripts/doItAll | 5 +++++ testScripts/doItAllTravis | 5 +++++ 8 files changed, 59 insertions(+), 28 deletions(-) create mode 100755 buildScripts/doItAllTravis delete mode 100644 buildScripts/travisEnvs create mode 100644 testScripts/doItAll create mode 100644 testScripts/doItAllTravis diff --git a/.travis.yml.off b/.travis.yml.off index 0cfce99..d5d6d23 100644 --- a/.travis.yml.off +++ b/.travis.yml.off @@ -2,10 +2,6 @@ language: cpp sudo: true -os: - - linux -# - osx -# - windows # for windows *test* of AppImage # see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job @@ -13,8 +9,6 @@ os: # and https://docs.travis-ci.com/user/reference/windows/ # why fuse is not possible on windows: https://superuser.com/questions/179436/is-it-possible-to-use-fuse-with-windows -dist: bionic - services: - docker @@ -81,23 +75,19 @@ matrix: # allow_failures: # - os: osx # Until the build passes, then re-enable. -script: - - ./buildScripts/travisEnvs || travis_terminate 1; - - ./buildScripts/reportEnvs || travis_terminate 1; - - ./buildScripts/getBuildTools || travis_terminate 1; - - ./buildScripts/getDevLibraries || travis_terminate 1; - - ./buildScripts/getPoppler || travis_terminate 1; - - ./buildScripts/buildPoppler || travis_terminate 1; - - ./buildScripts/installPoppler || travis_terminate 1; - - ./buildScripts/getFontforge || travis_terminate 1; - - ./buildScripts/buildFontforge || travis_terminate 1; - - ./buildScripts/installFontforge || travis_terminate 1; - - ./buildScripts/buildPdf2htmlEX || travis_terminate 1; - - ./buildScripts/installPdf2htmlEX || travis_terminate 1; - - ./buildScripts/createAppImage || travis_terminate 1; - - ./buildScripts/createDockerImage || travis_terminate 1; - - ./buildScripts/uploadRelease || travis_terminate 1; - +jobs: + include: + - stage: build + os: + - linux + dist: bionic + script: ./buildScripts/doItAllTravis + - stage: test + os: + - linux + - osx + - windows + script: ./testScripts/doItAllTravis #deploy: # provider: releases # api_key: diff --git a/buildScripts/doItAll b/buildScripts/doItAll index 7eef747..3ced38f 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -8,6 +8,14 @@ export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j $(nproc)" +# choose one of the following... +# +export PDF2HTMLEX_BRANCH=newBuildSystem +# export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +################ +# do the build + ./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } ./buildScripts/getBuildTools || { echo 'getBuildTools FAILED' ; exit 1 ; } diff --git a/buildScripts/doItAllTravis b/buildScripts/doItAllTravis new file mode 100755 index 0000000..83c5631 --- /dev/null +++ b/buildScripts/doItAllTravis @@ -0,0 +1,24 @@ +#!/bin/bash + +# This bash script builds everyting on an TravisCI worker + +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +./buildScripts/reportEnvs || travis_terminate 1; +./buildScripts/getBuildTools || travis_terminate 1; +./buildScripts/getDevLibraries || travis_terminate 1; +./buildScripts/getPoppler || travis_terminate 1; +./buildScripts/buildPoppler || travis_terminate 1; +./buildScripts/installPoppler || travis_terminate 1; +./buildScripts/getFontforge || travis_terminate 1; +./buildScripts/buildFontforge || travis_terminate 1; +./buildScripts/installFontforge || travis_terminate 1; +./buildScripts/buildPdf2htmlEX || travis_terminate 1; +./buildScripts/installPdf2htmlEX || travis_terminate 1; +./buildScripts/createAppImage || travis_terminate 1; +./buildScripts/createDockerImage || travis_terminate 1; +./buildScripts/uploadRelease || travis_terminate 1; + diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index f174f1e..084c173 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -10,7 +10,7 @@ echo " build dir: [$TRAVIS_BUILD_DIR]" echo " repo slug: [$TRAVIS_REPO_SLUG]" echo "Build env:" -echo " unattended: [$UNATTENEDED]" +echo " unattended: [$UNATTENDED]" echo " make parallel: [$MAKE_PARALLEL]" source ./buildScripts/versionEnvs diff --git a/buildScripts/travisEnvs b/buildScripts/travisEnvs deleted file mode 100644 index ce997c5..0000000 --- a/buildScripts/travisEnvs +++ /dev/null @@ -1,3 +0,0 @@ - -export UNATTENDED="--assume-yes" -export MAKE_PARALLEL="-j `nproc`" diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 5d2c618..126d567 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -9,7 +9,9 @@ export POPPLER_VERSION=poppler-0.81.0 #export FONTFORGE_VERSION=20190801 export FONTFORGE_VERSION=20170731 -export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +if [ -n "$PDF2HTMLEX_BRANCH" ]; then + export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +fi export MACHINE_ARCH="$(uname -m)" diff --git a/testScripts/doItAll b/testScripts/doItAll new file mode 100644 index 0000000..d10b213 --- /dev/null +++ b/testScripts/doItAll @@ -0,0 +1,5 @@ +#!/bin/bash + +# This bash script automates the tests + + diff --git a/testScripts/doItAllTravis b/testScripts/doItAllTravis new file mode 100644 index 0000000..f01339e --- /dev/null +++ b/testScripts/doItAllTravis @@ -0,0 +1,5 @@ +#!/bin/bash + +# This bash script automates the tests on a TravisCI worker + + From d640bd83f0cb2a6a9568cdb4f3db9b3a55831c83 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 10:32:42 +0000 Subject: [PATCH 082/269] corrected versionEnvs --- buildScripts/versionEnvs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 126d567..2bd720e 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -9,7 +9,7 @@ export POPPLER_VERSION=poppler-0.81.0 #export FONTFORGE_VERSION=20190801 export FONTFORGE_VERSION=20170731 -if [ -n "$PDF2HTMLEX_BRANCH" ]; then +if [ -z "$PDF2HTMLEX_BRANCH" ]; then export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" fi From a693e3d33c2fd0d646f95b60f986b7214d73a98d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 10:34:38 +0000 Subject: [PATCH 083/269] corrected versionEnvs --- buildScripts/versionEnvs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 2bd720e..e34c479 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -21,6 +21,6 @@ export DOCKER_FROM=ubuntu:18.04 export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME" -export APPIMAGE_NAME="pdf2htmlEX-$PDF2HTML_BRANCH-$BUILD_TIME-$MACHINE_ARCH.AppImage" +export APPIMAGE_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH.AppImage" From bf9fe5cfc10df8cfaf220e47264f7922c25863ed Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 12:04:22 +0000 Subject: [PATCH 084/269] started using reSourceVersionEnvs --- .travis.yml.off | 4 ++-- buildScripts/buildFontforge | 3 +-- buildScripts/createAppImage | 2 +- buildScripts/createDockerImage | 2 +- buildScripts/doItAll | 1 + buildScripts/getFontforge | 2 +- buildScripts/getPoppler | 2 +- buildScripts/reportEnvs | 2 +- buildScripts/uploadRelease | 12 ++++++++++-- buildScripts/versionEnvs | 11 ++++++++++- testScripts/doItAll | 27 +++++++++++++++++++++++++++ 11 files changed, 56 insertions(+), 12 deletions(-) diff --git a/.travis.yml.off b/.travis.yml.off index d5d6d23..c2c1291 100644 --- a/.travis.yml.off +++ b/.travis.yml.off @@ -85,8 +85,8 @@ jobs: - stage: test os: - linux - - osx - - windows + #- osx + #- windows script: ./testScripts/doItAllTravis #deploy: # provider: releases diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index cd2a9b1..8639556 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -2,8 +2,7 @@ # This bash script build FontForge -source buildScripts/versionEnvs - +source buildScripts/reSourceVersionEnvs # This is a work-around to fix TravisCI's declaration of PYTHON_CFLAGS # which is then honoured exactly as is by the fontforge bootstrap and diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 3fcbe5a..399d862 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -2,7 +2,7 @@ # This bash script creates an AppImage for pdf2htmlEX -source buildScripts/versionEnvs +source ./buildScripts/reSourceVersionEnvs # For appimage output plugin # diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 82d33fc..d4da534 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -4,7 +4,7 @@ if [ -x "$(which docker)" ]; then - source buildScripts/versionEnvs + source buildScripts/reSourceVersionEnvs source buildScripts/dockerFunctions diff --git a/buildScripts/doItAll b/buildScripts/doItAll index 3ced38f..66eb2a1 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -7,6 +7,7 @@ # export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j $(nproc)" +export TRAVIS_REPO_SLUG=stephengaito/pdf2htmlEX # choose one of the following... # diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 0db0b23..402aee9 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -2,7 +2,7 @@ # This bash script gets and unpacks the latest fontforge AppImage -source buildScripts/versionEnvs +source buildScripts/reSourceVersionEnvs FONTFORGE_SRC=$FONTFORGE_VERSION.tar.gz diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index ce9474f..a6888d7 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -2,7 +2,7 @@ # This bash script gets and unpacks the latest Poppler source code -source buildScripts/versionEnvs +source buildScripts/reSourceVersionEnvs echo "Getting poppler version: $POPPLER_VERSION" diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index 084c173..941d538 100755 --- a/buildScripts/reportEnvs +++ b/buildScripts/reportEnvs @@ -13,7 +13,7 @@ echo "Build env:" echo " unattended: [$UNATTENDED]" echo " make parallel: [$MAKE_PARALLEL]" -source ./buildScripts/versionEnvs +source ./buildScripts/reSourceVersionEnvs echo "pdf2htmlEX env:" echo " poppler: [$POPPLER_VERSION]" diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index 33f342f..8a90567 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -11,10 +11,14 @@ # UPLOADTOOL_BODY (the text of the github release message) # +source ./buildScripts/reSourceVersionEnvs + ################################## # upload github release artefacts # +cd imageBuild + if [ -n "$GITHUB_TOKEN" ]; then wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh @@ -34,10 +38,14 @@ See: https://appimage.org/ for details RELEASE_MESSAGE fi - bash upload.sh $APPIMAGE_NAME appImageName dockerImageName + bash upload.sh \ + $($APPIMAGE_NAME) \ + ../appImageName \ + ../dockerImageName \ + ../buildTime else - echo "GITHUG_TOKEN not set... so we can not upload release artefacts." + echo "GITHUB_TOKEN not set... so we can not upload release artefacts." fi ################################## diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index e34c479..065efb7 100644 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -23,4 +23,13 @@ export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME" export APPIMAGE_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH.AppImage" - +echo > buildScripts/reSourceVersionEnvs < Date: Thu, 28 Nov 2019 12:21:58 +0000 Subject: [PATCH 085/269] corrected reSourceVersionEnvs --- buildScripts/createDockerImage | 2 +- buildScripts/doItAll | 2 ++ buildScripts/doItAllTravis | 1 + buildScripts/versionEnvs | 19 +++++++++---------- 4 files changed, 13 insertions(+), 11 deletions(-) mode change 100644 => 100755 buildScripts/versionEnvs diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index d4da534..160684c 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -22,7 +22,7 @@ if [ -x "$(which docker)" ]; then delete_blacklisted - cat >> Dockerfile < Dockerfile < buildScripts/reSourceVersionEnvs < buildScripts/reSourceVersionEnvs +echo "export FONTFORGE_VERSION=\"$FONTFORGE_VERSION\"" >> buildScripts/reSourceVersionEnvs +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 DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs +echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs +echo "export APPIMAGE_NAME=\"$APPIMAGE_NAME\"" >> buildScripts/reSourceVersionEnvs + From 8fe76e30862348dc32b55846187b5a0283305542 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 13:04:03 +0000 Subject: [PATCH 086/269] penultimage build tools --- buildScripts/createDockerImage | 2 +- buildScripts/uploadRelease | 13 ++++--------- buildScripts/versionEnvs | 1 + testScripts/doItAll | 18 +++++++++++------- testScripts/doItAllTravis | 29 ++++++++++++++++++++++++++++- 5 files changed, 45 insertions(+), 18 deletions(-) diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 160684c..14ceb55 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -31,7 +31,7 @@ DOCKERFILE_HERE_DOC cd .. - docker build -t $DOCKER_USERNAME/pdf2htmlex:-`date +%Y_%m_%d-%H_%M_%S` dockerDir + docker build -t $DOCKER_USERNAME/pdf2htmlex:$PDF2THMLEX_BRANCH-$BUILD_TIME dockerDir else echo "Docker is not installed... skipping creation of a docker image." diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index 8a90567..c39427a 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -8,7 +8,6 @@ # # You can OPTIONALLY set the following environment variables: # DOCKER_PASSWORD (if not set you will be asked for your password) -# UPLOADTOOL_BODY (the text of the github release message) # source ./buildScripts/reSourceVersionEnvs @@ -28,21 +27,15 @@ if [ -n "$GITHUB_TOKEN" ]; then echo $DOCKER_NAME > dockerImageName - if [ -z "$UPLOADTOOL_BODY" ]; then - export UPLOADTOOL_BODY=<> buildScripts/reSourceV echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs echo "export APPIMAGE_NAME=\"$APPIMAGE_NAME\"" >> buildScripts/reSourceVersionEnvs +echo "export TRAVIS_REPO_SLUG=\"$TRAVIS_REPO_SLUG\"" >> buildScripts/reSourceVersionEnvs diff --git a/testScripts/doItAll b/testScripts/doItAll index 665279a..a10e143 100644 --- a/testScripts/doItAll +++ b/testScripts/doItAll @@ -2,17 +2,21 @@ # This bash script automates the tests +mkdir -p testDir + +cd testDir + wget https://github.com/stephengaito/pdf2htmlEX/releases/download/continuous/appImageName -export APP_IMAGE_NAME=$(cat appImageName) +export APPIMAGE_NAME=$(cat appImageName) -wget https://github.com/stephengaito/pdf2htmlEX/releases/download/continuous/$APP_IMAGE_NAME +wget https://github.com/stephengaito/pdf2htmlEX/releases/download/continuous/$APPIMAGE_NAME -chmod a+x $APP_IMAGE_NAME +chmod a+x $APPIMAGE_NAME -if ! ./$APP_IMAGE_NAME --version ; then +if ! ./$APPIMAGE_NAME --version ; then echo "COULD NOT run the AppImage" - exit(-1) + exit 1 fi if [ -x "$(which docker)" ]; then @@ -22,8 +26,8 @@ if [ -x "$(which docker)" ]; then export DOCKER_IMAGE_NAME=$(cat dockerImageName) if ! docker run $DOCKER_IMAGE_NAME --version ; then - echo "COULD NOT run the AppImage" - exit(-1) + echo "COULD NOT run the Docker Image" + exit 1 fi fi diff --git a/testScripts/doItAllTravis b/testScripts/doItAllTravis index f01339e..695fd75 100644 --- a/testScripts/doItAllTravis +++ b/testScripts/doItAllTravis @@ -1,5 +1,32 @@ #!/bin/bash -# This bash script automates the tests on a TravisCI worker +# This bash script automates the tests + +wget https://github.com/stephengaito/pdf2htmlEX/releases/download/continuous/appImageName + +export APPIMAGE_NAME=$(cat appImageName) + +wget https://github.com/stephengaito/pdf2htmlEX/releases/download/continuous/$APPIMAGE_NAME + +chmod a+x $APPIMAGE_NAME + +if ! ./$APPIMAGE_NAME --version ; then + echo "COULD NOT run the AppImage" + exit 1 +fi + +if [ -x "$(which docker)" ]; then + + wget https://github.com/stephengaito/pdf2htmlEX/releases/download/continuous/dockerImageName + + export DOCKER_IMAGE_NAME=$(cat dockerImageName) + + if ! docker run $DOCKER_IMAGE_NAME --version ; then + echo "COULD NOT run the Docker Image" + exit 1 + fi + +fi + From 1000742831885404a0fd87a260eb1368a0cdcebd Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 13:49:35 +0000 Subject: [PATCH 087/269] corrected build and upload --- buildScripts/createDockerImage | 2 +- buildScripts/uploadRelease | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 14ceb55..70a7962 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -31,7 +31,7 @@ DOCKERFILE_HERE_DOC cd .. - docker build -t $DOCKER_USERNAME/pdf2htmlex:$PDF2THMLEX_BRANCH-$BUILD_TIME dockerDir + docker build -t $DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME dockerDir else echo "Docker is not installed... skipping creation of a docker image." diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index c39427a..fb618ed 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -35,6 +35,14 @@ You can download the AppImage and 'just run it'. See: https://appimage.org/ for details RELEASE_MESSAGE + echo "" + echo "---------------------------------------------------------------" + echo "upload tool body: + echo "---------------------------------------------------------------" + echo $UPLOADTOOL_BODY + echo "---------------------------------------------------------------" + echo "" + bash upload.sh $APPIMAGE_NAME appImageName dockerImageName buildTime else From e00def0bb6295bd70eadda80a59edf745e100b8f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 14:07:07 +0000 Subject: [PATCH 088/269] correded createDockerImage --- buildScripts/createDockerImage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 70a7962..ce6f169 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -31,7 +31,7 @@ DOCKERFILE_HERE_DOC cd .. - docker build -t $DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME dockerDir + docker build -t $DOCKER_NAME dockerDir else echo "Docker is not installed... skipping creation of a docker image." From b17931b4fcafed1dfa71b9d6c983bab3441104be Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 17:23:26 +0000 Subject: [PATCH 089/269] attempting to use new github upload tool --- buildScripts/getBuildTools | 1 + buildScripts/uploadRelease | 27 ++--- buildScripts/uploadReleaseMessage | 6 + buildScripts/uploadReleaseTool | 191 ++++++++++++++++++++++++++++++ 4 files changed, 207 insertions(+), 18 deletions(-) create mode 100644 buildScripts/uploadReleaseMessage create mode 100755 buildScripts/uploadReleaseTool diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools index d4f29c6..d4e5c58 100755 --- a/buildScripts/getBuildTools +++ b/buildScripts/getBuildTools @@ -19,5 +19,6 @@ sudo apt-get $UNATTENDED install \ g++ \ gettext \ openjdk-8-jre-headless \ + jp \ tree diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index fb618ed..4653f29 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -19,7 +19,13 @@ source ./buildScripts/reSourceVersionEnvs cd imageBuild if [ -n "$GITHUB_TOKEN" ]; then - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh + + echo "machine api.github.com" > $HOME/.netrc + echo " login $GITHUB_USERNAME" >> $HOME/.netrc + echo " password $GITHUB_TOKEN" >> $HOME/.netrc + echo "machine uploads.github.com" >> $HOME/.netrc + echo " login $GITHUB_USERNAME" >> $HOME/.netrc + echo " password $GITHUB_TOKEN" >> $HOME/.netrc echo $BUILD_TIME > buildTime @@ -27,23 +33,8 @@ if [ -n "$GITHUB_TOKEN" ]; then echo $DOCKER_NAME > dockerImageName - export UPLOADTOOL_BODY=< [] [-- ...]" >&2; +} + +if [ "$1" = "-h" -o "$1" = "--help" ]; then + usage + cat >&2 <\`: ":user/:name" of the repository. For example, "foca/mpp". + * \`\`: Name of the tag for this release. For example, "v1.0.0". + * \`\`: Optional suffix for the release name. + +You can pass a list of files to upload as release assets by giving them after a +\`--\` argument. + +If you supply text on \`STDIN\` it will be used as the release notes. + +EXAMPLES: + + $ $0 foca/mpp v1.0.0 -- pkg/*.tar.gz + + Creates a release named "mpp v1.0.0" and adds any tar.gz file in + \`./pkg\` as an asset. + + $ $0 foca/mpp v1.0.1 "Bugfixes" -- pkg/*.tar.gz < notes.md + + Creates a release named "mpp v1.0.1: Bugfixes", adds any tar.gz + file in \`./pkg\` as an asset, and uses the contents of \`notes.md\` + as the release notes. + +NOTE: + +This uses your \`.netrc\` file to authenticate with GitHub. In order to run the +script, make sure you have **both** \`api.github.com\` and \`upload.github.com\` in +this file. For example: + +machine api.github.com + login foca + password +machine uploads.github.com + login foca + password + +Generate this access token at https://github.com/settings/tokens and make sure +it has access to the \`"repo"\` scope. +EOS + exit 1; +fi + +[ -n "$2" ] || (usage; exit 1); + +REPO="$1" +shift + +TAG="$1" +shift + +NAME="$(basename "$REPO") ${TAG}" +if [ -n "$1" -a "$1" != "--" ]; then + NAME="${NAME}: $1"; + shift +fi + +BODY="$(cat ./buildScripts/uploadReleaseMessage)" + +if [ "$1" = "--" -a "$#" -ge "2" ]; then + shift + ASSETS="$@" +fi + +echo "looking for an existing 'continuous' release" + +response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "GET" \ + "https://api.github.com/repos/${REPO}/releases" +) + +releaseID=$(echo $response | jq '.[] | select(.tag_name == "continuous") | .id') + +if [ -n "$releaseID" ] ; then + + echo "deleting an existing 'continuous' release" + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "DELETE" \ + "https://api.github.com/repos/${REPO}/releases/$releaseID" + ) + +fi + +echo "looking for an existing 'continuous' tag" + +response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "GET" \ + "https://api.github.com/repos/${REPO}/git/matching-refs/tags/continuous" +) + +tagURL=$(echo $response | jq '.[].url') +tagURL="${tagURL%\"}" +tagURL="${tagURL#\"}" + +if [ -n "$tagURL" ]; then + echo "deleting an existing 'continuous' tag" + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "DELETE" \ + $tagURL + ) +fi + +payload=$( + jq --null-input \ + --arg tag "$TAG" \ + --arg name "$NAME" \ + --arg body "$BODY" \ + '{ tag_name: $tag, name: $name, body: $body, draft: false, prerelease: true }' +) + +response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --data "$payload" \ + "https://api.github.com/repos/${REPO}/releases" +) + +upload_url="$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")" + +for file in $ASSETS; do + echo "" + echo "uploading $file" + curl --netrc \ + --silent \ + --header "Content-Type:application/gzip" \ + --data-binary "@$file" \ + "$upload_url?name=$(basename "$file")" + echo "" +done + +# The above was taken from: +# https://gist.github.com/foca/38d82e93e32610f5241709f8d5720156 +# on 2019-11-28 +# and has been altered to delete the "continuous" tag/release +# as well as using the ./buildScripts/uploadReleaseMessage +# by Stephen Gaito +# it has been used under the following (MIT-like) license: + +# Copyright (c) 2016 Nicolas Sanguinetti +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. From 69b18fdab3b645224a1f3935223782d69bba4e76 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 17:30:45 +0000 Subject: [PATCH 090/269] updated documentation for uploadReleaseTool --- buildScripts/uploadReleaseTool | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildScripts/uploadReleaseTool b/buildScripts/uploadReleaseTool index 8e8fe81..de18d73 100755 --- a/buildScripts/uploadReleaseTool +++ b/buildScripts/uploadReleaseTool @@ -163,6 +163,8 @@ done # https://gist.github.com/foca/38d82e93e32610f5241709f8d5720156 # on 2019-11-28 # and has been altered to delete the "continuous" tag/release +# using: https://developer.github.com/v3/git/refs/ +# and: https://developer.github.com/v3/repos/releases/ # as well as using the ./buildScripts/uploadReleaseMessage # by Stephen Gaito # it has been used under the following (MIT-like) license: From ce93fa036d2c06066d21c78ee9ceb238dac5bca1 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 18:27:43 +0000 Subject: [PATCH 091/269] corrected build scripts --- buildScripts/doItAll | 1 - buildScripts/getBuildTools | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/buildScripts/doItAll b/buildScripts/doItAll index 6e510f0..b434a06 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAll @@ -45,4 +45,3 @@ export PDF2HTMLEX_BRANCH=newBuildSystem ./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; } -./buildScripts/uploadRelease || { echo 'uploadRelease FAILED' ; exit 1 ; } diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools index d4e5c58..91156df 100755 --- a/buildScripts/getBuildTools +++ b/buildScripts/getBuildTools @@ -19,6 +19,6 @@ sudo apt-get $UNATTENDED install \ g++ \ gettext \ openjdk-8-jre-headless \ - jp \ + jq \ tree From cd88751cf379cbb399cbfcbeaff3a5bf4ab3430e Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 Nov 2019 19:13:40 +0000 Subject: [PATCH 092/269] corrected release upload --- buildScripts/uploadRelease | 5 ++++- buildScripts/uploadReleaseTool | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index 4653f29..126102c 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -33,7 +33,10 @@ if [ -n "$GITHUB_TOKEN" ]; then echo $DOCKER_NAME > dockerImageName - ./buildScripts/uploadReleaseTool "$REPO_SLUG" "continuous" "Latest release" \ + echo ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ + -- $APPIMAGE_NAME appImageName dockerImageName buildTime + + ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ -- $APPIMAGE_NAME appImageName dockerImageName buildTime else diff --git a/buildScripts/uploadReleaseTool b/buildScripts/uploadReleaseTool index de18d73..f60d8a9 100755 --- a/buildScripts/uploadReleaseTool +++ b/buildScripts/uploadReleaseTool @@ -57,18 +57,21 @@ fi [ -n "$2" ] || (usage; exit 1); REPO="$1" +echo "Repository: [$REPO]" shift TAG="$1" +echo " Tag: [$TAG]" shift NAME="$(basename "$REPO") ${TAG}" if [ -n "$1" -a "$1" != "--" ]; then NAME="${NAME}: $1"; + echo " Name: [$NAME]" shift fi -BODY="$(cat ./buildScripts/uploadReleaseMessage)" +BODY="$(cat ../buildScripts/uploadReleaseMessage)" if [ "$1" = "--" -a "$#" -ge "2" ]; then shift From 41e8218f6576d3f75bc9bc6406db7bdc3249e7e4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 07:28:23 +0000 Subject: [PATCH 093/269] refactored upload process --- buildScripts/buildInstallLocally | 41 ++++++++++ buildScripts/{doItAll => doItAllLocally} | 1 - buildScripts/uploadRelease | 96 ++++++++++++++++-------- buildScripts/versionEnvs | 1 - 4 files changed, 104 insertions(+), 35 deletions(-) create mode 100755 buildScripts/buildInstallLocally rename buildScripts/{doItAll => doItAllLocally} (97%) diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally new file mode 100755 index 0000000..4c0a3d3 --- /dev/null +++ b/buildScripts/buildInstallLocally @@ -0,0 +1,41 @@ +#!/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=newBuildSystem +# 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/doItAll b/buildScripts/doItAllLocally similarity index 97% rename from buildScripts/doItAll rename to buildScripts/doItAllLocally index b434a06..adeefcf 100755 --- a/buildScripts/doItAll +++ b/buildScripts/doItAllLocally @@ -7,7 +7,6 @@ # export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j $(nproc)" -export TRAVIS_REPO_SLUG=stephengaito/pdf2htmlEX # choose one of the following... # diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index 126102c..4b52d3c 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -16,54 +16,84 @@ source ./buildScripts/reSourceVersionEnvs # upload github release artefacts # +# begin by gathering the required environment variables +# + +if [ -z "$GITHUB_USERNAME" ]; then + echo "" + read -p "Enter the GitHub upload username: " GITHUB_USERNAME + echo "" + if [ -z "$GITHUB_USERNAME" ]; then + echo "GITHUB_USERNAME not set... so we can not upload release artefacts." + exit 1 + fi +fi + +if [ -z "$GITHUB_TOKEN" ]; then + echo "" + read -p "Enter the GitHub upload token/password: " GITHUB_TOKEN + echo "" + if [ -z "$GITHUB_TOKEN" ]; then + echo "GITHUB_TOKEN not set... so we can not upload release artefacts." + exit 1 + fi +fi + +if [ -z "$TRAVIS_REPO_SLUG" ]; then + echo "" + read -p "Enter the GitHub repository (user/proj): " TRAVIS_REPO_SLUG + echo "" + if [ -z "$TRAVIS_REPO_SLUG" ]; then + echo "TRAVIS_REPO_SLUG (Github repository) not set... so we can not upload release artefacts." + exit 1 + fi +fi + cd imageBuild -if [ -n "$GITHUB_TOKEN" ]; then +echo "machine api.github.com" > $HOME/.netrc +echo " login $GITHUB_USERNAME" >> $HOME/.netrc +echo " password $GITHUB_TOKEN" >> $HOME/.netrc +echo "machine uploads.github.com" >> $HOME/.netrc +echo " login $GITHUB_USERNAME" >> $HOME/.netrc +echo " password $GITHUB_TOKEN" >> $HOME/.netrc - echo "machine api.github.com" > $HOME/.netrc - echo " login $GITHUB_USERNAME" >> $HOME/.netrc - echo " password $GITHUB_TOKEN" >> $HOME/.netrc - echo "machine uploads.github.com" >> $HOME/.netrc - echo " login $GITHUB_USERNAME" >> $HOME/.netrc - echo " password $GITHUB_TOKEN" >> $HOME/.netrc +echo $BUILD_TIME > buildTime +echo $APPIMAGE_NAME > appImageName +echo $DOCKER_NAME > dockerImageName - echo $BUILD_TIME > buildTime +echo ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ + -- $APPIMAGE_NAME appImageName dockerImageName buildTime - echo $APPIMAGE_NAME > appImageName +../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ + -- $APPIMAGE_NAME appImageName dockerImageName buildTime - echo $DOCKER_NAME > dockerImageName - - echo ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ - -- $APPIMAGE_NAME appImageName dockerImageName buildTime - - ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ - -- $APPIMAGE_NAME appImageName dockerImageName buildTime - -else - echo "GITHUB_TOKEN not set... so we can not upload release artefacts." -fi ################################## # push docker image # if [ -x "$(which docker)" ]; then - if [ -n "$DOCKER_USERNAME" ]; then - - if [ -z "$DOCKER_PASSWORD" ]; then - echo "" - echo "Please type your the Docker hub password" - docker login -u "$DOCKER_USERNAME" - else - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + if [ -z "$DOCKER_USERNAME" ]; then + echo "" + read -p "Enter the Docker usernane): " DOCKER_USERNAME + echo "" + if [ -z "$DOCKER_USERNAME" ]; then + echo "DOCKER_USERNAME not set... so we do not know where to push image." + exit 1 fi - - docker push $DOCKER_USERNAME/pdf2htmlex - - else - echo "DOCKER_USERNAME not set... so we do not know where to push image." fi + if [ -z "$DOCKER_PASSWORD" ]; then + echo "" + echo "Please type your the Docker hub password" + docker login -u "$DOCKER_USERNAME" + else + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + fi + + docker push $DOCKER_USERNAME/pdf2htmlex + else echo "Docker is not installed... skipping upload of docker image." fi diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 9103687..0c11cf9 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -31,5 +31,4 @@ echo "export BUILD_TIME=\"$BUILD_TIME\"" >> buildScripts/reSourceV echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs echo "export APPIMAGE_NAME=\"$APPIMAGE_NAME\"" >> buildScripts/reSourceVersionEnvs -echo "export TRAVIS_REPO_SLUG=\"$TRAVIS_REPO_SLUG\"" >> buildScripts/reSourceVersionEnvs From b207b8ea485f87d0faf5e7c81bfbf69052ab259a Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 09:11:32 +0000 Subject: [PATCH 094/269] refactored to provide build stage headers and improved the upload function --- buildScripts/buildFontforge | 6 + buildScripts/buildPdf2htmlEX | 6 + buildScripts/buildPdf2htmlEXClang | 6 + buildScripts/buildPoppler | 6 + buildScripts/createAppImage | 6 + buildScripts/createDockerImage | 6 + buildScripts/getBuildTools | 7 ++ buildScripts/getDevLibraries | 7 ++ buildScripts/getFontforge | 8 ++ buildScripts/getPdf2htmlEX | 8 ++ buildScripts/getPoppler | 8 ++ buildScripts/installFontforge | 8 ++ buildScripts/installPdf2htmlEX | 8 ++ buildScripts/installPoppler | 7 ++ buildScripts/uploadRelease | 23 +++- buildScripts/uploadReleaseDSL | 194 +++++++++++++++++++++++++++++ buildScripts/uploadReleaseTool | 196 ------------------------------ 17 files changed, 308 insertions(+), 202 deletions(-) create mode 100755 buildScripts/uploadReleaseDSL delete mode 100755 buildScripts/uploadReleaseTool diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 8639556..f2d5823 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -4,6 +4,12 @@ source buildScripts/reSourceVersionEnvs +echo "" +echo "-------------------------------------------------------------------" +echo "BUILDING FontForge" +echo "-------------------------------------------------------------------" +echo "" + # This is a work-around to fix TravisCI's declaration of PYTHON_CFLAGS # which is then honoured exactly as is by the fontforge bootstrap and # configure steps. diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index efbc54d..1d49382 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -2,6 +2,12 @@ # This bash script builds pdf2htmlEX +echo "" +echo "-------------------------------------------------------------------" +echo "BUILDING pdf2htmlEX (using gcc)" +echo "-------------------------------------------------------------------" +echo "" + cd pdf2htmlEX mkdir build cd build diff --git a/buildScripts/buildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang index 6d0b7ee..3ea3a3f 100755 --- a/buildScripts/buildPdf2htmlEXClang +++ b/buildScripts/buildPdf2htmlEXClang @@ -2,6 +2,12 @@ # This bash script builds pdf2htmlEX using Clang (if it is installed) +echo "" +echo "-------------------------------------------------------------------" +echo "BUILDING pdf2htmlEX (using CLang)" +echo "-------------------------------------------------------------------" +echo "" + cd pdf2htmlEX mkdir build cd build diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 711fbd3..52df3e9 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -2,6 +2,12 @@ # This bash script builds the latest poppler +echo "" +echo "-------------------------------------------------------------------" +echo "BUILDING Poppler" +echo "-------------------------------------------------------------------" +echo "" + cd poppler mkdir build cd build diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 399d862..5321e1e 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -4,6 +4,12 @@ source ./buildScripts/reSourceVersionEnvs +echo "" +echo "-------------------------------------------------------------------" +echo "CREATING pdf2htmlEX AppImage" +echo "-------------------------------------------------------------------" +echo "" + # For appimage output plugin # export VERSION="$PDF2HTMLEX_BRANCH-$BUILD_TIME" diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index ce6f169..8945c71 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -2,6 +2,12 @@ # This bash script creates a docker image from an existing pdf2htmlEX +echo "" +echo "-------------------------------------------------------------------" +echo "CREATING pdf2htmlEX Docker Image" +echo "-------------------------------------------------------------------" +echo "" + if [ -x "$(which docker)" ]; then source buildScripts/reSourceVersionEnvs diff --git a/buildScripts/getBuildTools b/buildScripts/getBuildTools index 91156df..92e42fd 100755 --- a/buildScripts/getBuildTools +++ b/buildScripts/getBuildTools @@ -5,6 +5,13 @@ # set the bash environment variable 'UNATTENDED' to '--assume-yes' for # unattended use (for example in the .travis.yml script) +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING Build Tools (using APT)" +echo " (UNATTENDED: [$UNATTENDED])" +echo "-------------------------------------------------------------------" +echo "" + sudo apt-get update sudo apt-get $UNATTENDED install \ aptitude \ diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index 6631536..37b80f5 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -6,6 +6,13 @@ # set the bash environment variable 'UNATTENDED' to '--assume-yes' for # unattended use (for example in the .travis.yml script) +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING development libraries (using APT)" +echo " (UNATTENDED: [$UNATTENDED])" +echo "-------------------------------------------------------------------" +echo "" + sudo apt-get update sudo apt-get $UNATTENDED install \ libcairo-dev \ diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 402aee9..1ad7bab 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -2,6 +2,14 @@ # This bash script gets and unpacks the latest fontforge AppImage +echo "" +echo "-------------------------------------------------------------------" +echo "GETTING FontForge sources (using wget)" +echo " (FONTFORGE_VERSION: [$FONTFORGE_VERSION])" +echo "-------------------------------------------------------------------" +echo "" + + source buildScripts/reSourceVersionEnvs FONTFORGE_SRC=$FONTFORGE_VERSION.tar.gz diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX index 2232ad1..5c988d6 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEX @@ -5,6 +5,14 @@ PDF2HTMLEX_BRANCH=newBuildSystem +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 diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index a6888d7..ca25e1c 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -4,6 +4,14 @@ source buildScripts/reSourceVersionEnvs +echo "" +echo "-------------------------------------------------------------------" +echo "GETTING Poppler source code (using wget)" +echo " (POPPLER_VERSION: [$POPPLER_VERSION])" +echo "-------------------------------------------------------------------" +echo "" + + echo "Getting poppler version: $POPPLER_VERSION" rm -rf $POPPLER_VERSION.tar.xz diff --git a/buildScripts/installFontforge b/buildScripts/installFontforge index 77c2058..1ea43f9 100755 --- a/buildScripts/installFontforge +++ b/buildScripts/installFontforge @@ -1,5 +1,13 @@ #!/bin/bash +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING FontForge locally" +echo " (UNATTENDED: [$UNATTENDED])" +echo "-------------------------------------------------------------------" +echo "" + + if [ -z "$UNATTENDED" ] ; then echo "WARNING: this may over-write any existing" echo "FontForge version you have installed on your system." diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index 4193c6b..c3b861e 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -1,5 +1,13 @@ #!/bin/bash +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING pdf2htmlEX locally" +echo " (UNATTENDED: [$UNATTENDED])" +echo "-------------------------------------------------------------------" +echo "" + + if [ -z "$UNATTENDED" ] ; then echo "This installation assumes you have 'sudo' privileges" diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler index ec97f26..2ae5b15 100755 --- a/buildScripts/installPoppler +++ b/buildScripts/installPoppler @@ -2,6 +2,13 @@ # This bash script installs Poppler into the local system +echo "" +echo "-------------------------------------------------------------------" +echo "INSTALLING Poppler locally" +echo " (UNATTENDED: [$UNATTENDED])" +echo "-------------------------------------------------------------------" +echo "" + if [ -z "$UNATTENDED" ] ; then echo "WARNING: this may over-write any existing" diff --git a/buildScripts/uploadRelease b/buildScripts/uploadRelease index 4b52d3c..fefc3c3 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadRelease @@ -11,6 +11,14 @@ # source ./buildScripts/reSourceVersionEnvs +source ./buildScripts/uploadReleaseDSL + +echo "" +echo "-------------------------------------------------------------------" +echo "UPLOADING pdf2htmlEX AppImage and Docker Images" +echo "-------------------------------------------------------------------" +echo "" + ################################## # upload github release artefacts @@ -58,16 +66,19 @@ echo "machine uploads.github.com" >> $HOME/.netrc echo " login $GITHUB_USERNAME" >> $HOME/.netrc echo " password $GITHUB_TOKEN" >> $HOME/.netrc -echo $BUILD_TIME > buildTime +echo $BUILD_TIME > buildTime echo $APPIMAGE_NAME > appImageName -echo $DOCKER_NAME > dockerImageName +echo $DOCKER_NAME > dockerImageName -echo ../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ - -- $APPIMAGE_NAME appImageName dockerImageName buildTime +deleteReleaseByTag "$TRAVIS_REPO_SLUG" "continuous" -../buildScripts/uploadReleaseTool "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ - -- $APPIMAGE_NAME appImageName dockerImageName buildTime +createNewRelease "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ + ../buildScripts/uploadReleaseMessage +uploadAnAsset $upload_url appImageName "text/plain" +uploadAnAsset $upload_url buildTime "text/plain" +uploadAnAsset $upload_url dockerImageName "text/plain" +uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip" ################################## # push docker image diff --git a/buildScripts/uploadReleaseDSL b/buildScripts/uploadReleaseDSL new file mode 100755 index 0000000..3d36db6 --- /dev/null +++ b/buildScripts/uploadReleaseDSL @@ -0,0 +1,194 @@ +#!/usr/bin/env bash + +# This bash script is a collection of functions to interact with the GitHub +# release and git/tag APIs. It essentially provides a bash based DSL for +# uploading GitHub release artefacts. + +# NOTE-1: These functions make use of your ".netrc" file to authenticate +# with GitHub. In order to use these functions, make sure you have **both** +# "api.github.com" and "upload.github.com" in this file. For example: +# +# machine api.github.com +# login foca +# password +# machine uploads.github.com +# login foca +# password +# +# You can generate the required access token at +# https://github.com/settings/tokens +# Make sure this access token has access to the "repo" scope. +# +# NOTE-2: These functions require the "jq" library to parse the JSON +# returned by the GitHub APIs. + +############################# +function deleteReleaseByTag { + + [ -n "$1" ] || (echo "deleteReleaseByTag: missing repository"; exit 1); + [ -n "$2" ] || (echo "deleteReleaseByTag: missing releaseTag"; exit 1); + + REPO=$1 + releaseTag=$2 + + echo "" + echo "deleting the release tagged $releaseTag" + echo " from the repository $REPO" + echo "" + + echo "looking for an existing '$releaseTag' release in the repo $REPO" + + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "GET" \ + "https://api.github.com/repos/${REPO}/releases" + ) + + releaseID=$(echo $response | jq '.[] | select(.tag_name == "$releaseTag") | .id') + + if [ -n "$releaseID" ] ; then + + echo "deleting an existing '$releaseTag' release in the repo $REPO" + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "DELETE" \ + "https://api.github.com/repos/${REPO}/releases/$releaseID" + ) + + fi + + echo "looking for an existing '$releaseTag' git/tag in the repo $REPO" + + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "GET" \ + "https://api.github.com/repos/${REPO}/git/matching-refs/tags/$releaseTag" + ) + + tagURL=$(echo $response | jq '.[].url') + tagURL="${tagURL%\"}" + tagURL="${tagURL#\"}" + + if [ -n "$tagURL" ]; then + echo "deleting an existing '$releaseTag' git/tag in the repo $REPO" + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "DELETE" \ + $tagURL + ) + fi +} + +########################### +function createNewRelease { +# returns: upload_url (envVar) + + [ -n "$1" ] || (echo "createNewRelease: missing repository"; exit 1); + [ -n "$2" ] || (echo "createNewRelease: missing releaseTag"; exit 1); + [ -n "$3" ] || (echo "createNewRelease: missing release name"; exit 1); + [ -n "$4" ] || (echo "createNewRelease: missing release description filename"; exit 1); + + REPO=$1 + TAG=$2 + NAME=$3 + BODY=$(cat $4) + + echo "" + echo "Creating a new release in the repository $REPO" + echo " with tag $TAG" + echo " and name $NAME" + echo " using the message in the file $4" + echo "--------------------------------------------------------------" + echo $BODY + echo "--------------------------------------------------------------" + + payload=$( + jq --null-input \ + --arg tag "$TAG" \ + --arg name "$NAME" \ + --arg body "$BODY" \ + '{ tag_name: $tag, name: $name, body: $body, draft: false, prerelease: true }' + ) + + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --data "$payload" \ + "https://api.github.com/repos/${REPO}/releases" + ) + + upload_url="$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")" +} + +######################## +function uploadAnAsset { + + [ -n "$1" ] || (echo "uploadAnAsset: missing upload url"; exit 1); + [ -n "$2" ] || (echo "uploadAnAsset: missing file name"; exit 1); + [ -n "$3" ] || (echo "uploadAnAsset: missing file type"; exit 1); + + upload_url=$1 + file=$2 + fileType=$3 + + echo "" + echo "uploading the asset $file" + echo " of type $fileType" + + curl --netrc \ + --silent \ + --header "Content-Type:$fileType" \ + --data-binary "@$file" \ + "$upload_url?name=$(basename "$file")" + echo "" +} + +# The above has been heavily modified into a collection of bash functions +# by Stephen Gaito working on the pdf2htmlEX project. +# +# It has been based upon the code in: +# https://gist.github.com/foca/38d82e93e32610f5241709f8d5720156 +# on 2019-11-28 +# +# The relevant GitHub API can be found at: +# https://developer.github.com/v3/git/refs/ +# https://developer.github.com/v3/repos/releases/ +# +# The original code has been used under the following (MIT-like) license: + +# Copyright (c) 2016 Nicolas Sanguinetti +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. diff --git a/buildScripts/uploadReleaseTool b/buildScripts/uploadReleaseTool deleted file mode 100755 index f60d8a9..0000000 --- a/buildScripts/uploadReleaseTool +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/env bash - -set -e -[ -z "$DEBUG" ] || set -x; - -usage() { - echo "$0 [] [-- ...]" >&2; -} - -if [ "$1" = "-h" -o "$1" = "--help" ]; then - usage - cat >&2 <\`: ":user/:name" of the repository. For example, "foca/mpp". - * \`\`: Name of the tag for this release. For example, "v1.0.0". - * \`\`: Optional suffix for the release name. - -You can pass a list of files to upload as release assets by giving them after a -\`--\` argument. - -If you supply text on \`STDIN\` it will be used as the release notes. - -EXAMPLES: - - $ $0 foca/mpp v1.0.0 -- pkg/*.tar.gz - - Creates a release named "mpp v1.0.0" and adds any tar.gz file in - \`./pkg\` as an asset. - - $ $0 foca/mpp v1.0.1 "Bugfixes" -- pkg/*.tar.gz < notes.md - - Creates a release named "mpp v1.0.1: Bugfixes", adds any tar.gz - file in \`./pkg\` as an asset, and uses the contents of \`notes.md\` - as the release notes. - -NOTE: - -This uses your \`.netrc\` file to authenticate with GitHub. In order to run the -script, make sure you have **both** \`api.github.com\` and \`upload.github.com\` in -this file. For example: - -machine api.github.com - login foca - password -machine uploads.github.com - login foca - password - -Generate this access token at https://github.com/settings/tokens and make sure -it has access to the \`"repo"\` scope. -EOS - exit 1; -fi - -[ -n "$2" ] || (usage; exit 1); - -REPO="$1" -echo "Repository: [$REPO]" -shift - -TAG="$1" -echo " Tag: [$TAG]" -shift - -NAME="$(basename "$REPO") ${TAG}" -if [ -n "$1" -a "$1" != "--" ]; then - NAME="${NAME}: $1"; - echo " Name: [$NAME]" - shift -fi - -BODY="$(cat ../buildScripts/uploadReleaseMessage)" - -if [ "$1" = "--" -a "$#" -ge "2" ]; then - shift - ASSETS="$@" -fi - -echo "looking for an existing 'continuous' release" - -response=$( - curl --fail \ - --netrc \ - --silent \ - --location \ - --request "GET" \ - "https://api.github.com/repos/${REPO}/releases" -) - -releaseID=$(echo $response | jq '.[] | select(.tag_name == "continuous") | .id') - -if [ -n "$releaseID" ] ; then - - echo "deleting an existing 'continuous' release" - response=$( - curl --fail \ - --netrc \ - --silent \ - --location \ - --request "DELETE" \ - "https://api.github.com/repos/${REPO}/releases/$releaseID" - ) - -fi - -echo "looking for an existing 'continuous' tag" - -response=$( - curl --fail \ - --netrc \ - --silent \ - --location \ - --request "GET" \ - "https://api.github.com/repos/${REPO}/git/matching-refs/tags/continuous" -) - -tagURL=$(echo $response | jq '.[].url') -tagURL="${tagURL%\"}" -tagURL="${tagURL#\"}" - -if [ -n "$tagURL" ]; then - echo "deleting an existing 'continuous' tag" - response=$( - curl --fail \ - --netrc \ - --silent \ - --location \ - --request "DELETE" \ - $tagURL - ) -fi - -payload=$( - jq --null-input \ - --arg tag "$TAG" \ - --arg name "$NAME" \ - --arg body "$BODY" \ - '{ tag_name: $tag, name: $name, body: $body, draft: false, prerelease: true }' -) - -response=$( - curl --fail \ - --netrc \ - --silent \ - --location \ - --data "$payload" \ - "https://api.github.com/repos/${REPO}/releases" -) - -upload_url="$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")" - -for file in $ASSETS; do - echo "" - echo "uploading $file" - curl --netrc \ - --silent \ - --header "Content-Type:application/gzip" \ - --data-binary "@$file" \ - "$upload_url?name=$(basename "$file")" - echo "" -done - -# The above was taken from: -# https://gist.github.com/foca/38d82e93e32610f5241709f8d5720156 -# on 2019-11-28 -# and has been altered to delete the "continuous" tag/release -# using: https://developer.github.com/v3/git/refs/ -# and: https://developer.github.com/v3/repos/releases/ -# as well as using the ./buildScripts/uploadReleaseMessage -# by Stephen Gaito -# it has been used under the following (MIT-like) license: - -# Copyright (c) 2016 Nicolas Sanguinetti -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following -# conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. From c50bc7ecfa7b2ba1dce919b8be89d6baf2679da7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 09:43:07 +0000 Subject: [PATCH 095/269] refactored upload scripts --- buildScripts/createAppImage | 3 ++ buildScripts/createDockerImage | 26 ++++++++++ buildScripts/uploadDockerImage | 48 +++++++++++++++++++ .../{uploadRelease => uploadGitHubRelease} | 2 +- ...ploadReleaseDSL => uploadGitHubReleaseDSL} | 0 ...easeMessage => uploadGitHubReleaseMessage} | 0 buildScripts/uploadImages | 13 +++++ buildScripts/versionEnvs | 18 +++---- 8 files changed, 100 insertions(+), 10 deletions(-) create mode 100755 buildScripts/uploadDockerImage rename buildScripts/{uploadRelease => uploadGitHubRelease} (98%) rename buildScripts/{uploadReleaseDSL => uploadGitHubReleaseDSL} (100%) rename buildScripts/{uploadReleaseMessage => uploadGitHubReleaseMessage} (100%) create mode 100644 buildScripts/uploadImages diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 5321e1e..4ebebd6 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -13,6 +13,9 @@ echo "" # For appimage output plugin # export VERSION="$PDF2HTMLEX_BRANCH-$BUILD_TIME" +export APPIMAGE_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH.AppImage" + +echo "export APPIMAGE_NAME=\"$APPIMAGE_NAME\"" >> buildScripts/reSourceVersionEnvs mkdir -p imageBuild/appDir/usr/lib/ diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 8945c71..71e2287 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -14,6 +14,32 @@ if [ -x "$(which docker)" ]; then source buildScripts/dockerFunctions +if [ -z "$DOCKER_FROM" ]; then + echo "" + read -p "Enter the docker image for the 'from' base: " DOCKER_FROM + echo "" + if [ -z "$DOCKER_FROM" ]; then + echo "DOCKER_FROM not set... so we can not build the docker image" + exit 1 + fi +fi + +if [ -z "$DOCKER_USERNAME" ]; then + echo "" + read -p "Enter a docker username: " DOCKER_USERNAME + echo "" + if [ -z "$DOCKER_USERNAME" ]; then + echo "DOCKER_USERNAME not set... so we can not build the docker image" + exit 1 + fi +fi + +export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME" + +echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs +echo "export DOCKER_USERNAME=\"$DOCKER_USERNAME\"" >> buildScripts/reSourceVersionEnvs +echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs + mkdir -p imageBuild/dockerDir cd pdf2htmlEX/build diff --git a/buildScripts/uploadDockerImage b/buildScripts/uploadDockerImage new file mode 100755 index 0000000..13fe66f --- /dev/null +++ b/buildScripts/uploadDockerImage @@ -0,0 +1,48 @@ +#!/bin/bash + +# This bash script uploads the pdf2htmlEX docker image to docker hub +# +# We EXPECT the following environment variables to be set: +# DOCKER_USERNAME +# +# You can OPTIONALLY set the following environment variables: +# DOCKER_PASSWORD (if not set you will be asked for your password) +# + +source ./buildScripts/reSourceVersionEnvs + +echo "" +echo "-------------------------------------------------------------------" +echo "UPLOADING pdf2htmlEX Docker Image to Docker Hub" +echo "-------------------------------------------------------------------" +echo "" + +################################## +# push docker image +# +if [ -x "$(which docker)" ]; then + + if [ -z "$DOCKER_USERNAME" ]; then + echo "" + read -p "Enter the Docker usernane): " DOCKER_USERNAME + echo "" + if [ -z "$DOCKER_USERNAME" ]; then + echo "DOCKER_USERNAME not set... so we do not know where to push image." + exit 1 + fi + fi + + if [ -z "$DOCKER_PASSWORD" ]; then + echo "" + echo "Please type your the Docker hub password" + docker login -u "$DOCKER_USERNAME" + else + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + fi + + docker push $DOCKER_USERNAME/pdf2htmlex + +else + echo "Docker is not installed... skipping upload of docker image." +fi + diff --git a/buildScripts/uploadRelease b/buildScripts/uploadGitHubRelease similarity index 98% rename from buildScripts/uploadRelease rename to buildScripts/uploadGitHubRelease index fefc3c3..0f6b35e 100755 --- a/buildScripts/uploadRelease +++ b/buildScripts/uploadGitHubRelease @@ -73,7 +73,7 @@ echo $DOCKER_NAME > dockerImageName deleteReleaseByTag "$TRAVIS_REPO_SLUG" "continuous" createNewRelease "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ - ../buildScripts/uploadReleaseMessage + ../buildScripts/uploadGitHubReleaseMessage uploadAnAsset $upload_url appImageName "text/plain" uploadAnAsset $upload_url buildTime "text/plain" diff --git a/buildScripts/uploadReleaseDSL b/buildScripts/uploadGitHubReleaseDSL similarity index 100% rename from buildScripts/uploadReleaseDSL rename to buildScripts/uploadGitHubReleaseDSL diff --git a/buildScripts/uploadReleaseMessage b/buildScripts/uploadGitHubReleaseMessage similarity index 100% rename from buildScripts/uploadReleaseMessage rename to buildScripts/uploadGitHubReleaseMessage diff --git a/buildScripts/uploadImages b/buildScripts/uploadImages new file mode 100644 index 0000000..8941229 --- /dev/null +++ b/buildScripts/uploadImages @@ -0,0 +1,13 @@ +#!/bin/bash + +# This bash script uploads already existing pdf2htmlEX AppImage and Docker +# Images + +################ +# do the uploads + +./buildScripts/uploadGitHubRelease || { echo 'uploadGitHubRelease FAILED' ; exit 1 ; } + +./buildScripts/uploadDockerImage || { echo 'uploadDockerImage FAILED' ; exit 1 ; } + + diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 0c11cf9..ccc0093 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -11,24 +11,24 @@ export FONTFORGE_VERSION=20170731 if [ -z "$PDF2HTMLEX_BRANCH" ]; then export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + if [ -z "$PDF2HTMLEX_BRANCH" ]; then + echo "" + read -p "Enter the pdf2htmlEX branch or version: " PDF2HTMLEX_BRANCH + echo "" + if [ -z "$PDF2HTMLEX_BRANCH" ]; then + echo "PDF2HTMLEX_BRANCH not set... so we can not build anything." + exit 1 + fi + fi fi export MACHINE_ARCH="$(uname -m)" export BUILD_TIME="$(date +%Y_%m_%d-%H_%M_%S)" -export DOCKER_FROM=ubuntu:18.04 - -export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME" - -export APPIMAGE_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH.AppImage" - echo "export POPPLER_VERSION=\"$POPPLER_VERSION\"" > buildScripts/reSourceVersionEnvs echo "export FONTFORGE_VERSION=\"$FONTFORGE_VERSION\"" >> buildScripts/reSourceVersionEnvs 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 DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs -echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs -echo "export APPIMAGE_NAME=\"$APPIMAGE_NAME\"" >> buildScripts/reSourceVersionEnvs From f2e7a432ba23eddab8bd68bba064938b909fec6e Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 09:43:57 +0000 Subject: [PATCH 096/269] corrected doItAllLocally --- buildScripts/doItAllLocally | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/doItAllLocally b/buildScripts/doItAllLocally index adeefcf..d7c1351 100755 --- a/buildScripts/doItAllLocally +++ b/buildScripts/doItAllLocally @@ -1,7 +1,7 @@ #!/bin/bash # This bash script builds the complete pdf2htmlEX application LOCALLY -# (It does not create the AppImage or Docker images) +# (It creates local versions of the AppImage or Docker images) # Adjust the following two environment variables to suit your needs # From cbcbc879c967314cc5e7f2fa9528c7fd950ca7ac Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 09:57:32 +0000 Subject: [PATCH 097/269] refactored overall bulid process scripts --- buildScripts/createImages | 14 +++++++++++ buildScripts/doItAllLocally | 46 ------------------------------------- buildScripts/uploadImages | 2 ++ 3 files changed, 16 insertions(+), 46 deletions(-) create mode 100644 buildScripts/createImages delete mode 100755 buildScripts/doItAllLocally diff --git a/buildScripts/createImages b/buildScripts/createImages new file mode 100644 index 0000000..7b3a205 --- /dev/null +++ b/buildScripts/createImages @@ -0,0 +1,14 @@ +#!/bin/bash + +# This bash script creates the pdf2htmlEX AppImage and Docker Images + +################# +# do the creation + +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } + +./buildScripts/createAppImage || { echo 'createAppImage FAILED' ; exit 1 ; } + +./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; } + + diff --git a/buildScripts/doItAllLocally b/buildScripts/doItAllLocally deleted file mode 100755 index d7c1351..0000000 --- a/buildScripts/doItAllLocally +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# This bash script builds the complete pdf2htmlEX application LOCALLY -# (It creates local versions of 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=newBuildSystem -# 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 ; } - -./buildScripts/createAppImage || { echo 'createAppImage FAILED' ; exit 1 ; } - -./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; } - diff --git a/buildScripts/uploadImages b/buildScripts/uploadImages index 8941229..63b3b30 100644 --- a/buildScripts/uploadImages +++ b/buildScripts/uploadImages @@ -6,6 +6,8 @@ ################ # do the uploads +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } + ./buildScripts/uploadGitHubRelease || { echo 'uploadGitHubRelease FAILED' ; exit 1 ; } ./buildScripts/uploadDockerImage || { echo 'uploadDockerImage FAILED' ; exit 1 ; } From af9c57800c0e76e9d65998f0d6b263efa7fa78d9 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 12:11:03 +0000 Subject: [PATCH 098/269] corrected scripts --- buildScripts/createImages | 0 buildScripts/getFontforge | 5 ++--- buildScripts/uploadGitHubRelease | 32 +------------------------------- 3 files changed, 3 insertions(+), 34 deletions(-) mode change 100644 => 100755 buildScripts/createImages diff --git a/buildScripts/createImages b/buildScripts/createImages old mode 100644 new mode 100755 diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 1ad7bab..7059eea 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -2,6 +2,8 @@ # This bash script gets and unpacks the latest fontforge AppImage +source buildScripts/reSourceVersionEnvs + echo "" echo "-------------------------------------------------------------------" echo "GETTING FontForge sources (using wget)" @@ -9,9 +11,6 @@ echo " (FONTFORGE_VERSION: [$FONTFORGE_VERSION])" echo "-------------------------------------------------------------------" echo "" - -source buildScripts/reSourceVersionEnvs - FONTFORGE_SRC=$FONTFORGE_VERSION.tar.gz rm -rf $FONTFORGE_SRC diff --git a/buildScripts/uploadGitHubRelease b/buildScripts/uploadGitHubRelease index 0f6b35e..445ca91 100755 --- a/buildScripts/uploadGitHubRelease +++ b/buildScripts/uploadGitHubRelease @@ -11,7 +11,7 @@ # source ./buildScripts/reSourceVersionEnvs -source ./buildScripts/uploadReleaseDSL +source ./buildScripts/uploadGitHubReleaseDSL echo "" echo "-------------------------------------------------------------------" @@ -79,33 +79,3 @@ uploadAnAsset $upload_url appImageName "text/plain" uploadAnAsset $upload_url buildTime "text/plain" uploadAnAsset $upload_url dockerImageName "text/plain" uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip" - -################################## -# push docker image -# -if [ -x "$(which docker)" ]; then - - if [ -z "$DOCKER_USERNAME" ]; then - echo "" - read -p "Enter the Docker usernane): " DOCKER_USERNAME - echo "" - if [ -z "$DOCKER_USERNAME" ]; then - echo "DOCKER_USERNAME not set... so we do not know where to push image." - exit 1 - fi - fi - - if [ -z "$DOCKER_PASSWORD" ]; then - echo "" - echo "Please type your the Docker hub password" - docker login -u "$DOCKER_USERNAME" - else - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - fi - - docker push $DOCKER_USERNAME/pdf2htmlex - -else - echo "Docker is not installed... skipping upload of docker image." -fi - From 8d4b3486883b94e8af68427c450646cc49f1d574 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 Nov 2019 12:35:49 +0000 Subject: [PATCH 099/269] updated uploadGitHub scripts --- buildScripts/uploadGitHubRelease | 15 ++++++------ buildScripts/uploadGitHubReleaseDSL | 38 ++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/buildScripts/uploadGitHubRelease b/buildScripts/uploadGitHubRelease index 445ca91..b0d23bb 100755 --- a/buildScripts/uploadGitHubRelease +++ b/buildScripts/uploadGitHubRelease @@ -11,6 +11,7 @@ # source ./buildScripts/reSourceVersionEnvs +cp ./buildScripts/reSourceVersionEnvs imageBuild/buildInfo.sh source ./buildScripts/uploadGitHubReleaseDSL echo "" @@ -66,16 +67,16 @@ echo "machine uploads.github.com" >> $HOME/.netrc echo " login $GITHUB_USERNAME" >> $HOME/.netrc echo " password $GITHUB_TOKEN" >> $HOME/.netrc -echo $BUILD_TIME > buildTime -echo $APPIMAGE_NAME > appImageName -echo $DOCKER_NAME > dockerImageName +echo $APPIMAGE_NAME > appImageName.txt +echo $DOCKER_NAME > dockerImageName.txt deleteReleaseByTag "$TRAVIS_REPO_SLUG" "continuous" createNewRelease "$TRAVIS_REPO_SLUG" "continuous" "Latest release" \ ../buildScripts/uploadGitHubReleaseMessage -uploadAnAsset $upload_url appImageName "text/plain" -uploadAnAsset $upload_url buildTime "text/plain" -uploadAnAsset $upload_url dockerImageName "text/plain" -uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip" +uploadAnAsset $upload_url "appImageName.txt" "text/plain" +uploadAnAsset $upload_url "buildInfo.sh" "text/plain" +uploadAnAsset $upload_url "dockerImageName.txt" "text/plain" +uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip" + diff --git a/buildScripts/uploadGitHubReleaseDSL b/buildScripts/uploadGitHubReleaseDSL index 3d36db6..3a0207a 100755 --- a/buildScripts/uploadGitHubReleaseDSL +++ b/buildScripts/uploadGitHubReleaseDSL @@ -47,20 +47,29 @@ function deleteReleaseByTag { "https://api.github.com/repos/${REPO}/releases" ) - releaseID=$(echo $response | jq '.[] | select(.tag_name == "$releaseTag") | .id') + releaseID=$(echo $response | \ + jq --arg releaseTag $releaseTag \ + '.[] | select(.tag_name == $releaseTag) | .id') + + echo "" + echo "releaseID(s): $releaseID" + echo "" if [ -n "$releaseID" ] ; then - echo "deleting an existing '$releaseTag' release in the repo $REPO" - response=$( - curl --fail \ - --netrc \ - --silent \ - --location \ - --request "DELETE" \ - "https://api.github.com/repos/${REPO}/releases/$releaseID" - ) - + for aReleaseID in $releaseID + do + echo "deleting an existing '$releaseTag'($aReleaseID) release in the repo $REPO" + response=$( + curl --fail \ + --netrc \ + --silent \ + --location \ + --request "DELETE" \ + "https://api.github.com/repos/${REPO}/releases/$aReleaseID" + ) + done + echo "" fi echo "looking for an existing '$releaseTag' git/tag in the repo $REPO" @@ -131,7 +140,12 @@ function createNewRelease { "https://api.github.com/repos/${REPO}/releases" ) - upload_url="$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")" + upload_url="$(echo "$response" | \ + jq -r .upload_url | sed -e "s/{?name,label}//")" + + echo "" + echo "upload_url:" + echo $upload_url } ######################## From 75f8a94d70323a63589eaa950164073862b4b6b8 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 3 Dec 2019 06:34:35 +0000 Subject: [PATCH 100/269] updated gitignore as part of work on homeBrew formula --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f1f1335..c082415 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +brewFormula fontforge *.tar.* poppler From b0c06bcfffef737f20cbe73ee3be7862b182ea12 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 3 Dec 2019 18:36:56 +0000 Subject: [PATCH 101/269] build on osx using homebrew --- .travis.yml.off => .travis.yml | 20 ++++++++++++-------- LICENSE | 28 +++++++++++++++------------- 2 files changed, 27 insertions(+), 21 deletions(-) rename .travis.yml.off => .travis.yml (91%) diff --git a/.travis.yml.off b/.travis.yml similarity index 91% rename from .travis.yml.off rename to .travis.yml index c2c1291..08ef055 100644 --- a/.travis.yml.off +++ b/.travis.yml @@ -2,7 +2,6 @@ language: cpp sudo: true - # for windows *test* of AppImage # see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job # and https://discourse.appimage.org/t/run-appimage-on-windows/177 @@ -45,8 +44,10 @@ branches: # - liblcms2-dev # - libxml2-dev # - libuninameslist-dev -# homebrew: -# packages: + homebrew: + taps: pdf2htmlEX/homebrew-brewTap + packages: + - pdf2html-new # - autoconf # - pkg-config # - git @@ -77,17 +78,20 @@ matrix: jobs: include: - - stage: build + - stage: build-linux os: - linux dist: bionic script: ./buildScripts/doItAllTravis - - stage: test - os: - - linux + - stage: build-osx + os: + - osx +# - stage: test +# os: +# - linux #- osx #- windows - script: ./testScripts/doItAllTravis +# script: ./testScripts/doItAllTravis #deploy: # provider: releases # api_key: diff --git a/LICENSE b/LICENSE index 0665c92..90c48ff 100644 --- a/LICENSE +++ b/LICENSE @@ -1,23 +1,25 @@ pdf2htmlEX (https://github.com/coolwanglu/pdf2htmlEX) Copyright (c) 2012-2014 Lu Wang and other contributors -pdf2htmlEX, as a whole package, is licensed under GPLv3 (or any later version). +pdf2htmlEX, as a whole package, is licensed under GPLv3 (or any later +version). -Files in share/ and logo/ are released under relaxed licenses, -read the respective `LICENSE` file in the folders for details. +Files in pdf2htmlEX/share/ pdf2htmlEX/logo/ and pdf2htmlEX/brewFormual are +released under relaxed licenses, read the respective `LICENSE` file in +these folders for details. ----- GPLv3 -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your option) +any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . +You should have received a copy of the GNU General Public License along +with this program. If not, see . From 385108fceb68b0126d836a723348b80b6fc2a0a2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 3 Dec 2019 19:15:21 +0000 Subject: [PATCH 102/269] corrected upload scripts --- .travis.yml | 4 ++++ buildScripts/doItAllTravis | 32 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 08ef055..c6c5cc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,10 @@ branches: except: # do not build tags that we create using the upload.sh script - /^(?i:continuous.*)$/ +env: + global: + - DOCKER_FROM="ubuntu:18.04" + #addons: # apt: # update: true diff --git a/buildScripts/doItAllTravis b/buildScripts/doItAllTravis index f4a5a37..821583f 100755 --- a/buildScripts/doItAllTravis +++ b/buildScripts/doItAllTravis @@ -7,19 +7,19 @@ export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" -./buildScripts/versionEnvs || travis_terminate 1; -./buildScripts/reportEnvs || travis_terminate 1; -./buildScripts/getBuildTools || travis_terminate 1; -./buildScripts/getDevLibraries || travis_terminate 1; -./buildScripts/getPoppler || travis_terminate 1; -./buildScripts/buildPoppler || travis_terminate 1; -./buildScripts/installPoppler || travis_terminate 1; -./buildScripts/getFontforge || travis_terminate 1; -./buildScripts/buildFontforge || travis_terminate 1; -./buildScripts/installFontforge || travis_terminate 1; -./buildScripts/buildPdf2htmlEX || travis_terminate 1; -./buildScripts/installPdf2htmlEX || travis_terminate 1; -./buildScripts/createAppImage || travis_terminate 1; -./buildScripts/createDockerImage || travis_terminate 1; -./buildScripts/uploadRelease || travis_terminate 1; - +./buildScripts/versionEnvs || travis_terminate 1; +./buildScripts/reportEnvs || travis_terminate 1; +./buildScripts/getBuildTools || travis_terminate 1; +./buildScripts/getDevLibraries || travis_terminate 1; +./buildScripts/getPoppler || travis_terminate 1; +./buildScripts/buildPoppler || travis_terminate 1; +./buildScripts/installPoppler || travis_terminate 1; +./buildScripts/getFontforge || travis_terminate 1; +./buildScripts/buildFontforge || travis_terminate 1; +./buildScripts/installFontforge || travis_terminate 1; +./buildScripts/buildPdf2htmlEX || travis_terminate 1; +./buildScripts/installPdf2htmlEX || travis_terminate 1; +./buildScripts/createAppImage || travis_terminate 1; +./buildScripts/createDockerImage || travis_terminate 1; +./buildScripts/uploadGitHubRelease || travis_terminate 1; +./buildScripts/uploadDockerImage || travis_terminate 1; From a45238f91fa8035a457090a93b284e3b52ccd568 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 3 Dec 2019 19:39:47 +0000 Subject: [PATCH 103/269] retry osx travis build --- .travis.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index c6c5cc3..5f0e31a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,10 +48,10 @@ env: # - liblcms2-dev # - libxml2-dev # - libuninameslist-dev - homebrew: - taps: pdf2htmlEX/homebrew-brewTap - packages: - - pdf2html-new +# homebrew: +# taps: pdf2htmlEX/homebrew-brewTap +# packages: +# - pdf2html-new # - autoconf # - pkg-config # - git @@ -82,14 +82,17 @@ matrix: jobs: include: - - stage: build-linux - os: - - linux - dist: bionic - script: ./buildScripts/doItAllTravis +# - stage: build-linux +# os: +# - linux +# dist: bionic +# script: ./buildScripts/doItAllTravis - stage: build-osx os: - osx + script: + - brew tap pdf2htmlEX/homebrew-brewTaps + - brew install pdf2htmlex-new # - stage: test # os: # - linux From e022417d6748c9ffa6466d215550eb6875d64ee2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 3 Dec 2019 21:09:00 +0000 Subject: [PATCH 104/269] retry osx travis build 1 --- .travis.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5f0e31a..961f6ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,20 +8,12 @@ sudo: true # and https://docs.travis-ci.com/user/reference/windows/ # why fuse is not possible on windows: https://superuser.com/questions/179436/is-it-possible-to-use-fuse-with-windows -services: - - docker - compiler: gcc branches: except: # do not build tags that we create using the upload.sh script - /^(?i:continuous.*)$/ -env: - global: - - DOCKER_FROM="ubuntu:18.04" - -#addons: # apt: # update: true # packages: @@ -49,7 +41,6 @@ env: # - libxml2-dev # - libuninameslist-dev # homebrew: -# taps: pdf2htmlEX/homebrew-brewTap # packages: # - pdf2html-new # - autoconf @@ -85,13 +76,20 @@ jobs: # - stage: build-linux # os: # - linux +# env: +# global: +# - DOCKER_FROM="ubuntu:18.04" +# services: +# - docker # dist: bionic # script: ./buildScripts/doItAllTravis - stage: build-osx os: - osx + addons: + homebrew: + taps: pdf2htmlEX/homebrew-brewTap script: - - brew tap pdf2htmlEX/homebrew-brewTaps - brew install pdf2htmlex-new # - stage: test # os: From ede3cd8961b1b85c0968121797ee89f61a5d35f6 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 3 Dec 2019 21:27:24 +0000 Subject: [PATCH 105/269] retry osx travis build 2 --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 961f6ab..317d787 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,8 +89,11 @@ jobs: addons: homebrew: taps: pdf2htmlEX/homebrew-brewTap + packages: + - pdf2htmlex-new script: - - brew install pdf2htmlex-new + - pwd + - ls # - stage: test # os: # - linux From 96fd4c90d6061939cad26240c04424c75bb9a328 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 3 Dec 2019 21:27:59 +0000 Subject: [PATCH 106/269] retry osx travis build 3 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 317d787..bb945b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,6 +88,7 @@ jobs: - osx addons: homebrew: + update: true taps: pdf2htmlEX/homebrew-brewTap packages: - pdf2htmlex-new From 39b667404b83d650f545dfb760eb23c5fb5bc259 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 4 Dec 2019 12:06:17 +0000 Subject: [PATCH 107/269] refactored travis build scripts for linux and osx work --- .travis.yml => .travis.yml.off | 3 ++- buildScripts/{doItAllTravis => travisLinuxDoItAll} | 2 +- buildScripts/travisOsxDoItAll | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) rename .travis.yml => .travis.yml.off (97%) rename buildScripts/{doItAllTravis => travisLinuxDoItAll} (93%) create mode 100644 buildScripts/travisOsxDoItAll diff --git a/.travis.yml b/.travis.yml.off similarity index 97% rename from .travis.yml rename to .travis.yml.off index bb945b8..733a793 100644 --- a/.travis.yml +++ b/.travis.yml.off @@ -82,7 +82,7 @@ jobs: # services: # - docker # dist: bionic -# script: ./buildScripts/doItAllTravis +# script: ./buildScripts/travisLinuxDoItAll - stage: build-osx os: - osx @@ -95,6 +95,7 @@ jobs: script: - pwd - ls + - pdf2htmlEX --version # - stage: test # os: # - linux diff --git a/buildScripts/doItAllTravis b/buildScripts/travisLinuxDoItAll similarity index 93% rename from buildScripts/doItAllTravis rename to buildScripts/travisLinuxDoItAll index 821583f..1abfed3 100755 --- a/buildScripts/doItAllTravis +++ b/buildScripts/travisLinuxDoItAll @@ -1,6 +1,6 @@ #!/bin/bash -# This bash script builds everyting on an TravisCI worker +# This bash script builds everyting on an TravisCI Linux (Ubunutu) worker export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j $(nproc)" diff --git a/buildScripts/travisOsxDoItAll b/buildScripts/travisOsxDoItAll new file mode 100644 index 0000000..5614704 --- /dev/null +++ b/buildScripts/travisOsxDoItAll @@ -0,0 +1,9 @@ +#!/bin/bash + +# This bash script builds everyting on an TravisCI Mac OSx worker + +rvm use 2.6 --install --binary +brew tap pdf2htmlEX/homebrew-brewTap +brew update +brew install pdf2htmlex-new +rvm use $TRAVIS_RUBY_VERSION # optionally, switch back to the Ruby version you need. From 3522bea042178840d1f04cb00a07416dbdb8a8ed Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 4 Dec 2019 12:08:47 +0000 Subject: [PATCH 108/269] correcte OSx script --- buildScripts/{travisOsxDoItAll => travisOSxDoItAll} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename buildScripts/{travisOsxDoItAll => travisOSxDoItAll} (100%) mode change 100644 => 100755 diff --git a/buildScripts/travisOsxDoItAll b/buildScripts/travisOSxDoItAll old mode 100644 new mode 100755 similarity index 100% rename from buildScripts/travisOsxDoItAll rename to buildScripts/travisOSxDoItAll From c8fb950ae8a5aeb89518f388eafbf9e133b44e3f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 4 Dec 2019 13:26:26 +0000 Subject: [PATCH 109/269] updated travis homebrew build script --- .travis.yml.off => .travis.yml | 6 +----- .../{travisOSxDoItAll => travisHomeBrewDoItAll} | 4 ++++ buildScripts/travisLinuxBrewDoItAll | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) rename .travis.yml.off => .travis.yml (96%) rename buildScripts/{travisOSxDoItAll => travisHomeBrewDoItAll} (58%) create mode 100755 buildScripts/travisLinuxBrewDoItAll diff --git a/.travis.yml.off b/.travis.yml similarity index 96% rename from .travis.yml.off rename to .travis.yml index 733a793..089f0e7 100644 --- a/.travis.yml.off +++ b/.travis.yml @@ -89,12 +89,8 @@ jobs: addons: homebrew: update: true - taps: pdf2htmlEX/homebrew-brewTap - packages: - - pdf2htmlex-new script: - - pwd - - ls + - ./buildScripts/travisHomeBrewDoItAll - pdf2htmlEX --version # - stage: test # os: diff --git a/buildScripts/travisOSxDoItAll b/buildScripts/travisHomeBrewDoItAll similarity index 58% rename from buildScripts/travisOSxDoItAll rename to buildScripts/travisHomeBrewDoItAll index 5614704..e3b7326 100755 --- a/buildScripts/travisOSxDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -2,6 +2,10 @@ # This bash script builds everyting on an TravisCI Mac OSx worker +# See: +# https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images +# For details on obtaining/using the correct ruby version for homebrew. + rvm use 2.6 --install --binary brew tap pdf2htmlEX/homebrew-brewTap brew update diff --git a/buildScripts/travisLinuxBrewDoItAll b/buildScripts/travisLinuxBrewDoItAll new file mode 100755 index 0000000..e105eb9 --- /dev/null +++ b/buildScripts/travisLinuxBrewDoItAll @@ -0,0 +1,14 @@ +#!/bin/bash + +# This bash script builds everyting on an TravisCI Mac OSx worker + +# See: +# https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images +# For details on obtaining/using the correct ruby version for homebrew. + +sudo apt-get update +sudo apt-get install gcc-5 # many of the linuxBrew bottles are compiled with gcc-5 + +brew tap pdf2htmlEX/homebrew-brewTap +brew update +brew install pdf2htmlex-new -s --cc=gcc-5 From e9ec3744551495b685c6968e141a3a8b5556d12d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 4 Dec 2019 13:34:04 +0000 Subject: [PATCH 110/269] updated homeBrew script --- buildScripts/travisLinuxBrewDoItAll | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/buildScripts/travisLinuxBrewDoItAll b/buildScripts/travisLinuxBrewDoItAll index e105eb9..642fe16 100755 --- a/buildScripts/travisLinuxBrewDoItAll +++ b/buildScripts/travisLinuxBrewDoItAll @@ -6,9 +6,14 @@ # https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images # For details on obtaining/using the correct ruby version for homebrew. -sudo apt-get update -sudo apt-get install gcc-5 # many of the linuxBrew bottles are compiled with gcc-5 - brew tap pdf2htmlEX/homebrew-brewTap brew update + +# many of the linuxBrew bottles are compiled with gcc-5 so we need to +# explicity install it! +# +brew install gcc@5 + +# Now use brew to install pdf2htmlEX (and its dependencies) +# brew install pdf2htmlex-new -s --cc=gcc-5 From d5ec2a38ea2fabca71927aa58e73ffcc838f620f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 4 Dec 2019 14:11:58 +0000 Subject: [PATCH 111/269] updated linuxbrew script --- buildScripts/travisLinuxBrewDoItAll | 8 -------- 1 file changed, 8 deletions(-) diff --git a/buildScripts/travisLinuxBrewDoItAll b/buildScripts/travisLinuxBrewDoItAll index 642fe16..7cd342f 100755 --- a/buildScripts/travisLinuxBrewDoItAll +++ b/buildScripts/travisLinuxBrewDoItAll @@ -8,12 +8,4 @@ brew tap pdf2htmlEX/homebrew-brewTap brew update - -# many of the linuxBrew bottles are compiled with gcc-5 so we need to -# explicity install it! -# -brew install gcc@5 - -# Now use brew to install pdf2htmlEX (and its dependencies) -# brew install pdf2htmlex-new -s --cc=gcc-5 From ac797cb2d95c1de784e0f934d47c562ec13cdad2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 4 Dec 2019 17:49:50 +0000 Subject: [PATCH 112/269] updated brew scripts --- buildScripts/travisHomeBrewDoItAll | 2 +- buildScripts/travisLinuxBrewDoItAll | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index e3b7326..6c260bd 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -6,7 +6,7 @@ # https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images # For details on obtaining/using the correct ruby version for homebrew. -rvm use 2.6 --install --binary +rvm use $brew_ruby brew tap pdf2htmlEX/homebrew-brewTap brew update brew install pdf2htmlex-new diff --git a/buildScripts/travisLinuxBrewDoItAll b/buildScripts/travisLinuxBrewDoItAll index 7cd342f..f8fa8e1 100755 --- a/buildScripts/travisLinuxBrewDoItAll +++ b/buildScripts/travisLinuxBrewDoItAll @@ -6,6 +6,6 @@ # https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images # For details on obtaining/using the correct ruby version for homebrew. -brew tap pdf2htmlEX/homebrew-brewTap brew update -brew install pdf2htmlex-new -s --cc=gcc-5 +brew tap pdf2htmlEX/homebrew-brewTap +brew install pdf2htmlex-new From 45836b7ab4ad31b4373d8401f58acaf0caafa085 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 4 Dec 2019 22:12:13 +0000 Subject: [PATCH 113/269] corrected homebrew scripts --- .travis.yml | 2 +- buildScripts/travisHomeBrewDoItAll | 2 -- buildScripts/{travisLinuxDoItAll => travisLinuxAptDoItAll} | 0 3 files changed, 1 insertion(+), 3 deletions(-) rename buildScripts/{travisLinuxDoItAll => travisLinuxAptDoItAll} (100%) diff --git a/.travis.yml b/.travis.yml index 089f0e7..3be96fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,7 +82,7 @@ jobs: # services: # - docker # dist: bionic -# script: ./buildScripts/travisLinuxDoItAll +# script: ./buildScripts/travisLinuxAptDoItAll - stage: build-osx os: - osx diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 6c260bd..7408507 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -6,8 +6,6 @@ # https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images # For details on obtaining/using the correct ruby version for homebrew. -rvm use $brew_ruby brew tap pdf2htmlEX/homebrew-brewTap brew update brew install pdf2htmlex-new -rvm use $TRAVIS_RUBY_VERSION # optionally, switch back to the Ruby version you need. diff --git a/buildScripts/travisLinuxDoItAll b/buildScripts/travisLinuxAptDoItAll similarity index 100% rename from buildScripts/travisLinuxDoItAll rename to buildScripts/travisLinuxAptDoItAll From 76a12d3a073d4dae4c93c23cc70a020d23ffb700 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 5 Dec 2019 07:55:00 +0000 Subject: [PATCH 114/269] updated osx_image in travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3be96fc..fee06ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,6 +86,7 @@ jobs: - stage: build-osx os: - osx + osx_image: xcode10.1 addons: homebrew: update: true From 345e931073beead8ee79e16286df507729cef50a Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 5 Dec 2019 07:57:51 +0000 Subject: [PATCH 115/269] updated homebrew script to provide more detail --- buildScripts/travisHomeBrewDoItAll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 7408507..9f70fc1 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -8,4 +8,4 @@ brew tap pdf2htmlEX/homebrew-brewTap brew update -brew install pdf2htmlex-new +brew install -v pdf2htmlex-new From 79e3d55f477b6a15fcfae2b72d400c04c38f0e8b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 5 Dec 2019 08:42:24 +0000 Subject: [PATCH 116/269] updated homebrew script to provide more detail --- buildScripts/travisHomeBrewDoItAll | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 9f70fc1..f039846 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -6,6 +6,30 @@ # https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images # For details on obtaining/using the correct ruby version for homebrew. +echo "-------------------------------------------------" +echo $PATH +echo $LDFLAGS +echo $CPPFLAGS +which clang +echo "-------------------------------------------------" brew tap pdf2htmlEX/homebrew-brewTap +echo "-------------------------------------------------" +echo $PATH +echo $LDFLAGS +echo $CPPFLAGS +which clang +echo "-------------------------------------------------" brew update +echo "-------------------------------------------------" +echo $PATH +echo $LDFLAGS +echo $CPPFLAGS +which clang +echo "-------------------------------------------------" brew install -v pdf2htmlex-new +echo "-------------------------------------------------" +echo $PATH +echo $LDFLAGS +echo $CPPFLAGS +which clang +echo "-------------------------------------------------" From 282f4bf5318d1680e3c06728f5f39c5f245790e0 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 14:50:02 +0000 Subject: [PATCH 117/269] attempt to force python v2.7 --- buildScripts/travisHomeBrewDoItAll | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index f039846..b9f13e2 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -26,6 +26,20 @@ echo $LDFLAGS echo $CPPFLAGS which clang echo "-------------------------------------------------" +brew install -v python@2 +echo "-------------------------------------------------" +echo $PATH +echo $LDFLAGS +echo $CPPFLAGS +which clang +echo "-------------------------------------------------" +brew switch python 2.7 +echo "-------------------------------------------------" +echo $PATH +echo $LDFLAGS +echo $CPPFLAGS +which clang +echo "-------------------------------------------------" brew install -v pdf2htmlex-new echo "-------------------------------------------------" echo $PATH From f20eaa4aae4c70506945e5709a2e310ee6c9bf26 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 15:44:19 +0000 Subject: [PATCH 118/269] attempt to force python v2.7 2 --- buildScripts/travisHomeBrewDoItAll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index b9f13e2..533c4bd 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -33,7 +33,7 @@ echo $LDFLAGS echo $CPPFLAGS which clang echo "-------------------------------------------------" -brew switch python 2.7 +brew switch python 2.7.17 echo "-------------------------------------------------" echo $PATH echo $LDFLAGS From 741e6fdd5d31aba234c44e1927ccd58da8e01c84 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 17:12:59 +0000 Subject: [PATCH 119/269] try tool to extract brew info versions --- buildScripts/travisHomeBrewDoItAll | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 533c4bd..7ee2e93 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -27,12 +27,15 @@ echo $CPPFLAGS which clang echo "-------------------------------------------------" brew install -v python@2 +brew install jq echo "-------------------------------------------------" echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang +brew info --json=v1 python@2 | jq '.[].installed' echo "-------------------------------------------------" +brew info python@2 brew switch python 2.7.17 echo "-------------------------------------------------" echo $PATH @@ -40,7 +43,7 @@ echo $LDFLAGS echo $CPPFLAGS which clang echo "-------------------------------------------------" -brew install -v pdf2htmlex-new +#brew install -v pdf2htmlex-new echo "-------------------------------------------------" echo $PATH echo $LDFLAGS From 5b1a711514c03289e177bbbbf4db101a9a20dd40 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 17:17:47 +0000 Subject: [PATCH 120/269] try tool to extract brew info versions 1 --- buildScripts/travisHomeBrewDoItAll | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 7ee2e93..2f20ad3 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -33,15 +33,18 @@ echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang -brew info --json=v1 python@2 | jq '.[].installed' +python2Version = brew info --json=v1 python@2 | jq '.[].installed[].version' +echo $python2Version echo "-------------------------------------------------" brew info python@2 -brew switch python 2.7.17 +brew switch python $python2Version echo "-------------------------------------------------" echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang +which python +python --version echo "-------------------------------------------------" #brew install -v pdf2htmlex-new echo "-------------------------------------------------" From 1a7ac1f7b7a23af080de09bd132886e80d95df07 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 17:21:37 +0000 Subject: [PATCH 121/269] try tool to extract brew info versions 2 --- buildScripts/travisHomeBrewDoItAll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 2f20ad3..8a4e9ea 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -33,7 +33,7 @@ echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang -python2Version = brew info --json=v1 python@2 | jq '.[].installed[].version' +export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version') echo $python2Version echo "-------------------------------------------------" brew info python@2 From b9998d6ef2a6c9320c55cd98783d7138ba25e445 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 17:32:16 +0000 Subject: [PATCH 122/269] try tool to extract brew info versions 3 --- buildScripts/travisHomeBrewDoItAll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 8a4e9ea..7ad182d 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -33,7 +33,7 @@ echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang -export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version') +export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].version' | tr -d '"') echo $python2Version echo "-------------------------------------------------" brew info python@2 From f70211f8c9ab83d5dd397b777af15cde70707764 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 17:39:22 +0000 Subject: [PATCH 123/269] try tool to extract brew info versions 4 --- buildScripts/travisHomeBrewDoItAll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 7ad182d..664de13 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -37,7 +37,7 @@ export python2Version=$(brew info --json=v1 python@2 | jq '.[].installed[].versi echo $python2Version echo "-------------------------------------------------" brew info python@2 -brew switch python $python2Version +brew switch python@2 $python2Version echo "-------------------------------------------------" echo $PATH echo $LDFLAGS From 8e5b3ab0c8caf7ccbf7f2b8a693159bd728fbf57 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 17:52:05 +0000 Subject: [PATCH 124/269] try tool to extract brew info versions 4 --- buildScripts/travisHomeBrewDoItAll | 1 + 1 file changed, 1 insertion(+) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 664de13..01bf25f 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -44,6 +44,7 @@ echo $LDFLAGS echo $CPPFLAGS which clang which python +ls -la $(which python) python --version echo "-------------------------------------------------" #brew install -v pdf2htmlex-new From ab09224d8b0160c7f11351342a1d792d4945f376 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 18:36:39 +0000 Subject: [PATCH 125/269] try tool to extract brew info versions 5 --- buildScripts/travisHomeBrewDoItAll | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 01bf25f..a405e78 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -43,11 +43,12 @@ echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang +ls -la $(which clang) which python ls -la $(which python) python --version echo "-------------------------------------------------" -#brew install -v pdf2htmlex-new +brew install -v pdf2htmlex-new echo "-------------------------------------------------" echo $PATH echo $LDFLAGS From 3e5082566fd0a29890c585e814c3900c78d495f7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 19:15:50 +0000 Subject: [PATCH 126/269] try tool to extract brew info versions 6 --- buildScripts/travisHomeBrewDoItAll | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index a405e78..95bee7a 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -54,4 +54,11 @@ echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang +ls -la $(which clang) +which python +ls -la $(which python) +python --version +which pdf2htmlEX +ls -la $(which pdf2htmlEX) +pdf2htmlEX --version echo "-------------------------------------------------" From ac9a469ca8eefa817a72f69ad31647e774df4c59 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 6 Dec 2019 19:54:43 +0000 Subject: [PATCH 127/269] try tool to extract brew info versions 7 --- buildScripts/travisHomeBrewDoItAll | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 95bee7a..cbc2879 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -26,6 +26,7 @@ echo $LDFLAGS echo $CPPFLAGS which clang echo "-------------------------------------------------" +brew install llvm brew install -v python@2 brew install jq echo "-------------------------------------------------" @@ -33,9 +34,13 @@ echo $PATH echo $LDFLAGS echo $CPPFLAGS which clang +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 '"') echo $python2Version echo "-------------------------------------------------" +brew info llvm +brew switch llvm $llvmVersion brew info python@2 brew switch python@2 $python2Version echo "-------------------------------------------------" From d6ac2b4a6a0e6548a99224f89ecb12f6daa7969d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 9 Dec 2019 07:35:00 +0000 Subject: [PATCH 128/269] turned travis off for the moment --- .travis.yml => .travis.yml.off | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml => .travis.yml.off (100%) diff --git a/.travis.yml b/.travis.yml.off similarity index 100% rename from .travis.yml rename to .travis.yml.off From 4a0d08822b73f52e16e40882c4fe735d963dc651 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 9 Dec 2019 07:45:53 +0000 Subject: [PATCH 129/269] updated work from newBuildSystem to fontforge-update --- buildScripts/buildInstallLocally | 2 +- buildScripts/getPdf2htmlEX | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally index 4c0a3d3..4c15ffe 100755 --- a/buildScripts/buildInstallLocally +++ b/buildScripts/buildInstallLocally @@ -10,7 +10,7 @@ export MAKE_PARALLEL="-j $(nproc)" # choose one of the following... # -export PDF2HTMLEX_BRANCH=newBuildSystem +export PDF2HTMLEX_BRANCH=fontforge-update # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" ################ diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX index 5c988d6..7075601 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEX @@ -3,7 +3,7 @@ # This bash script automates the process of getting the original pdf2htmlEX # source -PDF2HTMLEX_BRANCH=newBuildSystem +PDF2HTMLEX_BRANCH=fontforge-update echo "" echo "-------------------------------------------------------------------" From 4a0a48cf69ef08f047192f9fed37022070b0db0a Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 9 Dec 2019 10:45:13 +0000 Subject: [PATCH 130/269] initial update to fontforge 20190801 --- buildScripts/versionEnvs | 4 +- pdf2htmlEX/src/util/ffw.c | 92 +- .../src/util/fontforge-2.0.20170731/views.h | 1496 ----------------- .../src/util/fontforge-20190801/Readme.md | 26 + .../autowidth.h | 0 .../bitmapchar.h | 0 .../cvimages.h | 2 +- .../encoding.h | 2 +- .../fvfonts.h | 0 .../namelist.h | 1 + .../savefont.h | 30 + .../splineorder2.h | 0 .../splineutil.h | 8 +- .../splineutil2.h | 0 .../start.h | 0 .../tottf.h | 0 16 files changed, 112 insertions(+), 1549 deletions(-) delete mode 100644 pdf2htmlEX/src/util/fontforge-2.0.20170731/views.h create mode 100644 pdf2htmlEX/src/util/fontforge-20190801/Readme.md rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/autowidth.h (100%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/bitmapchar.h (100%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/cvimages.h (100%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/encoding.h (98%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/fvfonts.h (100%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/namelist.h (89%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/savefont.h (65%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/splineorder2.h (100%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/splineutil.h (98%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/splineutil2.h (100%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/start.h (100%) rename pdf2htmlEX/src/util/{fontforge-2.0.20170731 => fontforge-20190801}/tottf.h (100%) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index ccc0093..54b12f4 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -6,8 +6,8 @@ #export POPPLER_VERSION=poppler-0.82.0 export POPPLER_VERSION=poppler-0.81.0 -#export FONTFORGE_VERSION=20190801 -export FONTFORGE_VERSION=20170731 +export FONTFORGE_VERSION=20190801 +#export FONTFORGE_VERSION=20170731 if [ -z "$PDF2HTMLEX_BRANCH" ]; then export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index 2101cde..91418f9 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -19,18 +19,19 @@ #include "SignalHandler.h" #include "ffw.h" -#include "fontforge-2.0.20170731/autowidth.h" -#include "fontforge-2.0.20170731/bitmapchar.h" -#include "fontforge-2.0.20170731/cvimages.h" -#include "fontforge-2.0.20170731/encoding.h" -#include "fontforge-2.0.20170731/fvfonts.h" -#include "fontforge-2.0.20170731/namelist.h" -#include "fontforge-2.0.20170731/savefont.h" -#include "fontforge-2.0.20170731/splineorder2.h" -#include "fontforge-2.0.20170731/splineutil.h" -#include "fontforge-2.0.20170731/splineutil2.h" -#include "fontforge-2.0.20170731/start.h" -#include "fontforge-2.0.20170731/tottf.h" +#include "fontforge-version-extras.h" // needed for FONTFORGE_GIT_VERSION +#include "fontforge-20190801/autowidth.h" +#include "fontforge-20190801/bitmapchar.h" +#include "fontforge-20190801/cvimages.h" +#include "fontforge-20190801/encoding.h" +#include "fontforge-20190801/fvfonts.h" +#include "fontforge-20190801/namelist.h" +#include "fontforge-20190801/savefont.h" +#include "fontforge-20190801/splineorder2.h" +#include "fontforge-20190801/splineutil.h" +#include "fontforge-20190801/splineutil2.h" +#include "fontforge-20190801/start.h" +#include "fontforge-20190801/tottf.h" static real EPS=1e-6; @@ -126,7 +127,7 @@ const FFWVersionInfo* ffw_get_version_info(void) ffwVersionInfo.gitVersion = FONTFORGE_GIT_VERSION; ffwVersionInfo.majorVersion = xstr(FONTFORGE_VERSION_MAJOR); ffwVersionInfo.minorVersion = xstr(FONTFORGE_VERSION_MINOR); - ffwVersionInfo.versionDate = FONTFORGE_VERSIONDATE; + ffwVersionInfo.versionDate = FONTFORGE_VERSION; return &ffwVersionInfo; } @@ -170,9 +171,9 @@ void ffw_load_font(const char * filename) ffwClearAction(); } -/* - * Fight again dirty stuffs - */ +// +// Fight again dirty stuffs +// void ffw_prepare_font(void) { ffwSetAction("prepare"); @@ -181,10 +182,10 @@ void ffw_prepare_font(void) FVRemoveKerns(cur_fv); FVRemoveVKerns(cur_fv); - /* - * Remove Alternate Unicodes - * We never use them because we will do a force encoding - */ + // + // Remove Alternate Unicodes + // We never use them because we will do a force encoding + // int i; SplineFont * sf = cur_fv->sf; for(i = 0; i < sf->glyphcnt; ++i) @@ -201,10 +202,10 @@ void ffw_prepare_font(void) } } - /* - * Wipe out font name - * browsers may rejects fonts with malformed font names - */ + // + // Wipe out font name + // browsers may rejects fonts with malformed font names + // free(sf->fontname); sf->fontname = strcopy(""); ffwClearAction(); @@ -226,6 +227,7 @@ void ffw_save(const char * filename) err("Cannot save font to %s\n", filename); ffwClearAction(); } + void ffw_close(void) { ffwSetAction("close"); @@ -347,14 +349,14 @@ void ffw_cidflatten(void) return; } ffwSetAction("flatten the cid in"); - SFFlatten(cur_fv->sf->cidmaster); + SFFlatten(&(cur_fv->sf->cidmaster)); ffwClearAction(); } -/* - * There is no check if a glyph with the same unicode exists! - * TODO: let FontForge fill in the standard glyph name <- or maybe this might cause collision? - */ +// +// There is no check if a glyph with the same unicode exists! +// TODO: let FontForge fill in the standard glyph name <- or maybe this might cause collision? +// void ffw_add_empty_char(int32_t unicode, int width) { ffwSetAction("add an empty character to"); @@ -424,17 +426,17 @@ void ffw_set_metric(double ascent, double descent) if(a < 0) a = 0; if(d > 0) d = 0; - /* - sf->ascent = min(a, em); - sf->descent = em - bb.maxy; - */ + // + //sf->ascent = min(a, em); + //sf->descent = em - bb.maxy; + // - /* - * The embedded fonts are likely to have inconsistent values for the 3 sets of ascent/descent - * PDF viewers don't care, since they don't even use these values - * But have to unify them, for different browsers on different platforms - * Things may become easier when there are CSS rules for baseline-based positioning. - */ + // + // The embedded fonts are likely to have inconsistent values for the 3 sets of ascent/descent + // PDF viewers don't care, since they don't even use these values + // But have to unify them, for different browsers on different platforms + // Things may become easier when there are CSS rules for baseline-based positioning. + // info->os2_winascent = a; info->os2_typoascent = a; info->hhead_ascent = a; @@ -454,9 +456,9 @@ void ffw_set_metric(double ascent, double descent) ffwClearAction(); } -/* - * TODO:bitmap, reference have not been considered in this function - */ +// +// TODO:bitmap, reference have not been considered in this function +// void ffw_set_widths(int * width_list, int mapping_len, int stretch_narrow, int squeeze_wide) { @@ -475,9 +477,9 @@ void ffw_set_widths(int * width_list, int mapping_len, int imax = min(mapping_len, map->enccount); for(i = 0; i < imax; ++i) { - /* - * Don't mess with it if the glyphs is not used. - */ + // + // Don't mess with it if the glyphs is not used. + // if(width_list[i] == -1) { continue; diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/views.h b/pdf2htmlEX/src/util/fontforge-2.0.20170731/views.h deleted file mode 100644 index 3988e92..0000000 --- a/pdf2htmlEX/src/util/fontforge-2.0.20170731/views.h +++ /dev/null @@ -1,1496 +0,0 @@ -/* Copyright (C) 2000-2012 by George Williams */ -/* - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _VIEWS_H -#define _VIEWS_H - -#include - -#include "ttfinstrs.h" - -#include "ffglib.h" -#include "baseviews.h" - -#include -#include "dlist.h" -#include "search.h" - - -struct gfi_data; -struct contextchaindlg; -struct statemachinedlg; - - -extern struct cvshows { - int showfore, showback, showgrids, showhhints, showvhints, showdhints; - int showpoints, showfilled; - int showrulers; - int showrounds; /* 0=>no, 1=>auto, 2=>always */ - int showmdx, showmdy; /* minimum distances x,y */ - int showhmetrics, showvmetrics; /* show advance width, baseline, etc. */ - int markextrema; - int markpoi; /* Points of inflection */ - int showblues, showfamilyblues; - int showanchor; - int showcpinfo; - int showtabs; /* with the names of former glyphs */ - int showsidebearings; - int showrefnames; - int snapoutlines; - int showalmosthvlines; - int showalmosthvcurves; - int hvoffset; - int checkselfintersects; /* Not really something shown, but convenient to keep it here */ - int showdebugchanges; /* Changes the way changing rasters are displayed in tt debug mode */ - int alwaysshowcontrolpoints; //< Always show the BCP even when their splinepoint is not selected -} CVShows; - -extern struct bvshows { - int showfore, showoutline, showgrid; - int lastpixelsize; -} BVShows; - -enum debug_wins { dw_registers=0x1, dw_stack=0x2, dw_storage=0x4, dw_points=0x8, - dw_cvt=0x10, dw_raster=0x20, dw_gloss=0x40 }; - -struct instrinfo { - int isel_pos; - int16 lheight,lpos; - char *scroll, *offset; - GWindow v; - GGadget *vsb; - int16 sbw; - int16 vheight, vwidth; - int16 lstopped; - int16 as, fh; - struct instrdata *instrdata; - GFont *gfont; - unsigned int showaddr: 1; - unsigned int showhex: 1; - unsigned int mousedown: 1; - void *userdata; - void (*selection_callback)(struct instrinfo *,int ip); - int (*bpcheck)(struct instrinfo *,int ip); - int (*handle_char)(struct instrinfo *,GEvent *e); -}; - -struct reflist { - RefChar *ref; - struct reflist *parent; -}; - -typedef struct debugview { - struct debugger_context *dc; /* Local to freetype.c */ - GWindow dv, v; - /* Windows for twilight points, cvt, registers, stack, storage, stack gloss */ - GWindow regs, stack, storage, points, cvt, raster, gloss; /* order matters */ - GWindow points_v; - GGadget *cvtsb; - GGadget *pts_vsb; - GGadget *glosssb; - GGadget *storagesb; - GGadget *regsb; - GGadget *stacksb; - struct instrdata id; - struct instrinfo ii; - int dwidth, toph; - struct charview *cv; - double scalex, scaley; - int pts_head, cvt_offtop, gloss_offtop, storage_offtop, stack_offtop, reg_offtop; - int points_offtop; - - int codeSize; - uint8 initialbytes[4]; - struct reflist *active_refs; - int last_npoints; - int layer; -} DebugView; - - -/* The number of tabs allowed in the outline glyph view of former glyphs */ -#define FORMER_MAX 10 - -enum dv_coderange { cr_none=0, cr_fpgm, cr_prep, cr_glyph }; /* cleverly chosen to match ttobjs.h */ - -struct freehand { - struct tracedata *head, *last; /* for the freehand tool */ - SplinePointList *current_trace; - int ignore_wobble; /* Ignore wiggles smaller than this */ - int skip_cnt; -}; - -enum expandedge { ee_none, ee_nw, ee_up, ee_ne, ee_right, ee_se, ee_down, - ee_sw, ee_left, ee_max }; - -enum { charviewtab_charselectedsz = 1024 }; -typedef struct charviewtab -{ - char charselected[ charviewtab_charselectedsz + 1 ]; - char tablabeltxt[ charviewtab_charselectedsz + 1 ]; -} CharViewTab; - -enum { charview_cvtabssz = 100 }; - - - /* approximately BACK_LAYER_MAX / 32 */ -#define BACK_LAYERS_VIEW_MAX 8 - -typedef struct charview { - CharViewBase b; - uint32 showback[BACK_LAYERS_VIEW_MAX]; - unsigned int showfore:1; - unsigned int showgrids:1; - unsigned int showhhints:1; - unsigned int showvhints:1; - unsigned int showdhints:1; - unsigned int showpoints:1; - unsigned int alwaysshowcontrolpoints:1; - unsigned int showfilled:1; - unsigned int showrulers:1; - unsigned int showrounds:2; /* 0=>no, 1=>auto, 2=>always */ - unsigned int showmdx:1; - unsigned int showmdy:1; - unsigned int showhmetrics:1; - unsigned int showvmetrics:1; - unsigned int showblues:1; /* 16 */ - unsigned int showfamilyblues:1; - unsigned int showanchor:1; - unsigned int showpointnumbers:2; - unsigned int markextrema:1; - unsigned int markpoi:1; - unsigned int needsrasterize:1; /* Rasterization (of fill or fontview) needed on mouse up */ - unsigned int recentchange:1; /* a change happened in the grids or background. don't need to rasterize */ - unsigned int info_within: 1; /* cursor is within main window */ - unsigned int back_img_out_of_date: 1; /* Force redraw of back image pixmap */ - unsigned int cntrldown:1; - unsigned int joinvalid:1; - unsigned int widthsel:1; - unsigned int vwidthsel:1; - unsigned int lbearingsel:1; - unsigned int icsel:1; - unsigned int tah_sel:1; - unsigned int inactive:1; /* When in a search view (32) */ - unsigned int show_ft_results: 1; - unsigned int show_ft_results_live_update : 1; - unsigned int coderange: 2; /* For the debugger */ - unsigned int autonomous_ruler_w: 1; - unsigned int showcpinfo: 1; - unsigned int showtabs: 1; - unsigned int showsidebearings: 1; - unsigned int showing_spiro_pt_menu: 1; - unsigned int ruler_pressed: 1; - unsigned int ruler_pressedv: 1; - unsigned int showrefnames: 1; - unsigned int snapoutlines: 1; - unsigned int showalmosthvlines: 1; - unsigned int showalmosthvcurves: 1; - unsigned int checkselfintersects: 1; - unsigned int showdebugchanges: 1; - unsigned int inPreviewMode: 1; - unsigned int inDraggingComparisonOutline: 1; - unsigned int activeModifierControl: 1; //< Is control being held right now? - unsigned int activeModifierAlt: 1; //< Is alt being held right now? - unsigned int changedActiveGlyph: 1; //< Set in CVSwitchActiveSC() cleared in cvmouseup() - - int hvoffset; /* for showalmosthvlines */ - int layers_off_top; - real scale; - GWindow gw, v; - GGadget *vsb, *hsb, *mb, *tabs; - GFont *small, *normal; - GWindow icon; - GWindow ruler_w; - GWindow ruler_linger_w; - unichar_t ruler_linger_lines[40][80]; - int ruler_linger_num_lines; - int num_ruler_intersections; - int allocated_ruler_intersections; - BasePoint *ruler_intersections; - int start_intersection_snapped; - int end_intersection_snapped; - GFont *rfont; - GTimer *pressed; - GWindow backimgs; - GIC *gic; - GIC *gwgic; - int width, height; - float xoff, yoff; /* must be floating point, for precise zoom by scroll */ - int mbh; //< menu bar height - int charselectorh; //< char selection input box height - int infoh; //< info bar height - int rulerh; //< ruler height - int16 sas, sfh, sdh, nas, nfh; - BasePoint info; - SplinePoint *info_sp; - Spline *info_spline; - real info_t; - GPoint e; /* mouse location */ - GPoint olde; - BasePoint last_c; - BDFChar *filled; - GImage gi; /* used for fill bitmap only */ - int enc; - EncMap *map_of_enc; /* Only use for comparison against fontview's map to see if our enc be valid */ - /* Will not be updated when fontview is reencoded */ - PressedOn p; - SplinePoint *lastselpt; - spiro_cp *lastselcp; - /*GWindow tools, layers;*/ - int8 b1_tool, cb1_tool, b2_tool, cb2_tool; /* Button 3 does a popup */ - int8 b1_tool_old; /* Used by mingw port */ - int8 s1_tool, s2_tool, er_tool; /* Bindings for wacom stylus and eraser */ - int8 showing_tool, pressed_tool, pressed_display, had_control, active_tool; - int8 spacebar_hold; /* spacebar is held down */ - SplinePointList *active_spl; - SplinePoint *active_sp; - spiro_cp *active_cp; - IPoint handscroll_base; - uint16 rfh, ras; - BasePoint lastknife; - struct freehand freehand; - enum expandedge expandedge; - BasePoint expandorigin; - real expandwidth, expandheight; - SplinePointList *active_shape; - SplinePoint joinpos; - spiro_cp joincp; - SplineChar *template1, *template2; -#if HANYANG - struct jamodisplay *jamodisplay; -#endif - real oldwidth, oldvwidth; - real oldlbearing; - int16 oldic, oldtah; -#if _ModKeysAutoRepeat - GTimer *autorpt; - int keysym, oldstate; - int oldkeyx, oldkeyy; - GWindow oldkeyw; -#endif - PST *lcarets; - int16 nearcaret; - /* freetype results display */ - int16 ft_dpi, ft_ppemy, ft_ppemx, ft_depth; - real ft_pointsizey, ft_pointsizex; - struct freetype_raster *raster, *oldraster; - DebugView *dv; - uint32 mmvisible; - char *former_names[FORMER_MAX]; - int former_cnt; - AnchorPoint *apmine, *apmatch; - SplineChar *apsc; - int guide_pos; - struct qg_data *qg; - int16 note_x, note_y; - struct dlistnode* pointInfoDialogs; - GGadget* charselector; //< let the user type in more than one char to view at once. - GGadget* charselectorNext; //< move to next word in charselector - GGadget* charselectorPrev; //< move to prev word in charselector - int charselectoridx; - SplineChar* additionalCharsToShow [51]; //< additionalCharsToShowLimit + 1 in size - int additionalCharsToShowActiveIndex; - - CharViewTab cvtabs[ charview_cvtabssz+1 ]; - int oldtabnum; - -} CharView; - -typedef struct bitmapview { - BDFChar *bc; - BDFFont *bdf; - struct fontview *fv; - EncMap *map_of_enc; - int enc; - GWindow gw, v; - GGadget *vsb, *hsb, *mb; - GGadget *recalc; - GFont *small; - int xoff, yoff; - int width, height; - int infoh, mbh; - int scale; - real scscale; - struct bitmapview *next; - unsigned int showfore:1; - unsigned int showoutline:1; - unsigned int showgrid:1; - unsigned int cntrldown:1; - unsigned int recentchange:1; - unsigned int clearing:1; - unsigned int shades_hidden:1; - unsigned int shades_down:1; - /*GWindow tools, layers;*/ - int8 b1_tool, cb1_tool, b2_tool, cb2_tool; /* Button 3 does a popup */ - int8 s1_tool, s2_tool, er_tool; /* Bindings for wacom stylus and eraser */ - int8 showing_tool, pressed_tool, pressed_display, had_control, active_tool; - int pressed_x, pressed_y; - int info_x, info_y; - int event_x, event_y; - int16 sas, sfh; -#if _ModKeysAutoRepeat - GTimer *autorpt; - int keysym, oldstate; -#endif - int color; /* for greyscale fonts (between 0,255) */ - int color_under_cursor; -} BitmapView; - -struct aplist { AnchorPoint *ap; int connected_to, selected; struct aplist *next; }; - -enum mv_grids { mv_hidegrid, mv_showgrid, mv_partialgrid, mv_hidemovinggrid }; -enum mv_type { mv_kernonly, mv_widthonly, mv_kernwidth }; - -struct metricchar { - int16 dx, dwidth; /* position and width of the displayed char */ - int16 dy, dheight; /* displayed info for vertical metrics */ - int xoff, yoff; - int16 mx, mwidth; /* position and width of the text underneath */ - int16 kernafter; - unsigned int selected: 1; - GGadget *width, *lbearing, *rbearing, *kern, *name; - GGadget* updownkparray[10]; /* Cherry picked elements from width...kern allowing up/down key navigation */ -}; - -typedef struct metricsview { - struct fontview *fv; - SplineFont *sf; - int pixelsize; /* If the user has manually requested a pixelsize */ - /* then rasterize at that size no matter how large */ - /* the font is zoomed. For non-user requesed sizes */ - /* this is the pixelsize * zoom-factor */ - BDFFont *bdf; /* We can also see metric info on a bitmap font */ - BDFFont *show; /* Or the rasterized version of the outline font */ - GWindow gw, v; - GFont *font; - GGadget *hsb, *vsb, *mb, *text, *textPrev, *textNext, *script, *features, *subtable_list; - GGadget *namelab, *widthlab, *lbearinglab, *rbearinglab, *kernlab; - int16 xstart; - int16 width, height, dwidth; - int16 vwidth, vheight; - int16 mbh,sbh; - int16 topend; /* y value of the end of the region containing the text field */ - int16 displayend; /* y value of the end of the region showing filled characters */ - int16 fh, as; - int16 cmax, clen; - SplineChar **chars; /* Character input stream */ - struct opentype_str *glyphs;/* after going through the various gsub/gpos transformations */ - struct metricchar *perchar; /* One for each glyph above */ - SplineChar **sstr; /* Character input stream */ - int16 mwidth, mbase; - int16 glyphcnt, max; - int16 pressed_x, pressed_y; - int16 activeoff; - int xoff, coff, yoff; - struct metricsview *next; - unsigned int right_to_left: 1; - unsigned int pressed: 1; - unsigned int pressedwidth: 1; - unsigned int pressedkern: 1; - unsigned int showgrid: 2; - unsigned int antialias: 1; - unsigned int vertical: 1; - unsigned int type: 2; /* enum mv_type */ - unsigned int usehinting: 1; /* should the hints be used during the render */ - unsigned int pixelsize_set_by_window; - int xp, yp, ap_owner; - BasePoint ap_start; - int cursor; - int scale_index; - struct lookup_subtable *cur_subtable; - GTextInfo *scriptlangs; - int word_index; - int layer; - int fake_unicode_base; - GIC *gwgic; - int ptsize, dpi; - int ybaseline; - int oldscript, oldlang; -} MetricsView; - -enum fv_metrics { fvm_baseline=1, fvm_origin=2, fvm_advanceat=4, fvm_advanceto=8 }; -typedef struct fontview { - FontViewBase b; - BDFFont *show, *filled; - GWindow gw, v; - GFont **fontset; - GGadget *vsb, *mb; - GTimer *pressed; - GTimer *resize; - GEvent resize_event; - GIC *gic; - GIC *gwgic; - int width, height; /* of v */ - int16 infoh,mbh; - int16 lab_height, lab_as; - int16 colcnt, rowcnt; /* of display window */ - int32 rowoff, rowltot; /* Can be really big in full unicode */ - int16 cbw,cbh; /* width/height of a character box */ - int pressed_pos, end_pos; - unsigned int antialias:1; - unsigned int bbsized:1; /* displayed bitmap should be scaled by bounding box rather than emsize */ - unsigned int wasonlybitmaps:1; - /*unsigned int refstate: 3;*/ /* 0x1 => paste orig of all non exist refs, 0x2=>don't, 0x3 => don't warn about non-exist refs with no source font */ - unsigned int touched: 1; - unsigned int showhmetrics: 4; - unsigned int showvmetrics: 4; - unsigned int drag_and_drop: 1; - unsigned int has_dd_no_cursor: 1; - unsigned int any_dd_events_sent: 1; - unsigned int resize_expected: 1; - /* Some window managers do not honour my resize requests (if window is*/ - /* maximized for example), but we depend on the resize request to */ - /* fix up the window. We do get a configure notify, but the window */ - /* stays the same size, so kludge things */ - unsigned int glyphlabel: 2; - unsigned int notactive:1; /* When embedded in a dlg */ - int16 magnify; - int16 user_requested_magnify; - struct searchview *sv; - SplineChar *sc_near_top; - int sel_index; - struct lookup_subtable *cur_subtable; - struct qg_data *qg; - GPid pid_webfontserver; -} FontView; - -typedef struct findsel { - GEvent *e; - real fudge; /* One pixel fudge factor */ - real xl,xh, yl, yh; /* One pixel fudge factor */ - real c_xl,c_xh, c_yl, c_yh; /* fudge rectangle for control points, larger than above if alt is depressed */ - unsigned int select_controls: 1; /* notice control points */ - unsigned int seek_controls: 1; /* notice control points before base points */ - unsigned int all_controls: 1; /* notice control points even if the base points aren't selected (in truetype point numbering mode where all cps are visible) */ - unsigned int alwaysshowcontrolpoints:1; /* if the BCP are forced on, then we want the selection code paths - * to also know that so the user can drag the BCP of a non selected splinepoint */ - real scale; - PressedOn *p; -} FindSel; - -typedef struct searchview { - struct cvcontainer base; - FontView dummy_fv; - SplineFont dummy_sf; - LayerInfo layerinfo[2]; - SplineChar *chars[2]; - EncMap dummy_map; - int32 map[2], backmap[2]; - uint8 sel[2]; - CharView cv_srch, cv_rpl; - CharView *lastcv; -/* ****** */ - GWindow gw; - GGadget *mb; - GFont *plain, *bold; - int mbh; - int fh, as; - int rpl_x, cv_y; - int cv_width, cv_height; - short button_height, button_width; -/* ****** */ - SearchData sd; - unsigned int showsfindnext: 1; - unsigned int findenabled: 1; - unsigned int rplallenabled: 1; - unsigned int rplenabled: 1; - unsigned int isvisible: 1; -} SearchView; - -typedef struct mathkernview { - struct cvcontainer base; - FontView dummy_fv; - SplineFont dummy_sf; - LayerInfo layerinfo[2]; - SplineChar sc_topright, sc_topleft, sc_bottomright, sc_bottomleft; - SplineChar *chars[4]; - EncMap dummy_map; - int32 map[4], backmap[4]; - uint8 sel[4]; - CharView cv_topright, cv_topleft, cv_bottomright, cv_bottomleft; - CharView *lastcv; -/* ****** */ - GWindow gw; - GWindow cvparent_w; - GGadget *mb; - GFont *plain, *bold; - int mbh; - int fh, as; - int mid_space, cv_y; - int cv_width, cv_height; - short button_height, button_width; -/* ****** */ - SplineChar *cursc; - int def_layer; - struct mathkern *orig_mathkern; - uint8 saved_mathkern; /* Can't just check if orig is non-NULL, because NULL is a perfectly valid initial state */ - uint8 last_aspect; - uint8 done; -} MathKernDlg; - -# ifdef FONTFORGE_CONFIG_TILEPATH - -typedef struct tilepathdlg { - struct cvcontainer base; - FontView dummy_fv; - SplineFont dummy_sf; - LayerInfo layerinfo[2]; - SplineChar sc_first, sc_medial, sc_final, sc_isolated; - SplineChar *chars[4]; - EncMap dummy_map; - int32 map[4], backmap[4]; - uint8 sel[4]; - CharView cv_first, cv_medial, cv_final, cv_isolated; - CharView *lastcv; -/* ****** */ - GWindow gw; - GGadget *mb; - GFont *plain, *bold; - int mbh; - int fh, as; - int mid_space, cv_y; - int cv_width, cv_height; -/* ****** */ - struct tiledata *td; - SplineFont *base_sf; - uint8 done, oked; -} TilePathDlg; -extern void TPDCharViewInits(TilePathDlg *tpd, int cid); -extern void PTDCharViewInits(TilePathDlg *tpd, int cid); -#endif /* Tile Path */ - -typedef struct gradientdlg { - struct cvcontainer base; - FontView dummy_fv; - SplineFont dummy_sf; - LayerInfo layerinfo[2]; - SplineChar sc_grad; - SplineChar *chars[1]; - EncMap dummy_map; - int32 map[1], backmap[1]; - uint8 sel[1]; - CharView cv_grad; -/* ****** */ - GWindow gw; - GGadget *mb; - GFont *plain, *bold; - int mbh; - int fh, as; - int mid_space, cv_y; - int cv_width, cv_height; -/* ****** */ - uint8 done, oked; - struct gradient *active; -} GradientDlg; -extern void GDDCharViewInits(GradientDlg *gdd,int cid); - -typedef struct strokedlg { - struct cvcontainer base; - FontView dummy_fv; - SplineFont dummy_sf; - LayerInfo layerinfo[2]; - SplineChar sc_stroke; - SplineChar *chars[1]; - EncMap dummy_map; - int32 map[1], backmap[1]; - uint8 sel[1]; - CharView cv_stroke; - int cv_width, cv_height; - GGadget *mb; - int mbh; - SplineSet *old_poly; -/* ****** */ - int done; - GWindow gw; - CharView *cv; - FontView *fv; - SplineFont *sf; - void (*strokeit)(void *,StrokeInfo *,int); - StrokeInfo *si; - GRect r1, r2; - int up[2]; - int dontexpand; -} StrokeDlg; -extern void StrokeCharViewInits(StrokeDlg *sd,int cid); - -struct lksubinfo { - struct lookup_subtable *subtable; - unsigned int deleted: 1; - unsigned int new: 1; - unsigned int selected: 1; - unsigned int moved: 1; -}; - -struct lkinfo { - OTLookup *lookup; - unsigned int open: 1; - unsigned int deleted: 1; - unsigned int new: 1; - unsigned int selected: 1; - unsigned int moved: 1; - int16 subtable_cnt, subtable_max; - struct lksubinfo *subtables; -}; - -struct lkdata { - int cnt, max; - int off_top, off_left; - struct lkinfo *all; -}; - -struct anchor_shows { - CharView *cv; - SplineChar *sc; - int restart; -}; - -struct gfi_data { /* FontInfo */ - SplineFont *sf; - int def_layer; - GWindow gw; - int tn_active; - int private_aspect, ttfv_aspect, tn_aspect, tx_aspect, unicode_aspect; - int old_sel, old_aspect, old_lang, old_strid; - int ttf_set, names_set, tex_set; - int langlocalecode; /* MS code for the current locale */ - unsigned int family_untitled: 1; - unsigned int human_untitled: 1; - unsigned int done: 1; - unsigned int mpdone: 1; - unsigned int lk_drag_and_drop: 1; - unsigned int lk_dropablecursor: 1; - struct anchor_shows anchor_shows[2]; - struct texdata texdata; - GFont *font; - int as, fh; - struct lkdata tables[2]; - int lkwidth, lkheight; - int first_sel_lookup, first_sel_subtable; - int last_panose_family; -}; - -struct kf_dlg /* : fvcontainer */ { - struct fvcontainer base; - struct lookup_subtable *sub; - GWindow gw, dw; - GFont *plain, *bold; - int fh, as; - GGadget *mb, *guts, *topbox; - int mbh, label2_y, infoh; - - SplineFont *sf; - int def_layer; - struct kf_results *results; - int done; - - FontView *active; - FontView *first_fv; - FontView *second_fv; -}; - -enum genfam { gf_none, gf_macfamily, gf_ttc }; - -extern void FVMarkHintsOutOfDate(SplineChar *sc); -extern void FVRefreshChar(FontView *fv,int gid); -extern void _FVMenuOpen(FontView *fv); -extern int _FVMenuSave(FontView *fv); -extern int _FVMenuSaveAs(FontView *fv); -extern int _FVMenuGenerate(FontView *fv,int family); -extern void _FVCloseWindows(FontView *fv); -extern char *GetPostScriptFontName(char *defdir,int mult); -extern void MergeKernInfo(SplineFont *sf,EncMap *map); -extern int SFGenerateFont(SplineFont *sf,int layer, int family,EncMap *map); - -extern void NonLinearDlg(FontView *fv,struct charview *cv); -extern void FVChangeChar(FontView *fv,int encoding); -extern void FVMergeFonts(FontView *fv); -extern void FVInterpolateFonts(FontView *fv); - -extern void FVDeselectAll(FontView *fv); - -extern void FVAutoWidth2(FontView *fv); -/*extern void FVAutoKern(FontView *fv);*/ -/*extern void FVAutoWidth(FontView *fv);*/ - -extern void SC_MarkInstrDlgAsChanged(SplineChar *sc); - -extern void PythonUI_Init(void); -extern void PythonUI_namedpipe_Init(void); - -extern void SCStroke(SplineChar *sc); - -extern void PfaEditSetFallback(void); -extern void RecentFilesRemember(char *filename); -extern void LastFonts_Save(void); - -struct debugger_context; -extern void DebuggerTerminate(struct debugger_context *dc); -extern void DebuggerReset(struct debugger_context *dc,real pointsizey, real pointsizex,int dpi,int dbg_fpgm, int is_bitmap); -extern struct debugger_context *DebuggerCreate(SplineChar *sc,int layer,real pointsizey,real pointsizex,int dpi,int dbg_fpgm, int is_bitmap); -enum debug_gotype { dgt_continue, dgt_step, dgt_next, dgt_stepout }; -extern void DebuggerGo(struct debugger_context *dc,enum debug_gotype,DebugView *dv); -extern struct TT_ExecContextRec_ *DebuggerGetEContext(struct debugger_context *dc); -extern void DebuggerToggleBp(struct debugger_context *dc,int range,int ip); -extern int DebuggerBpCheck(struct debugger_context *dc,int range,int ip); -extern void DebuggerSetWatches(struct debugger_context *dc,int n, uint8 *w); -extern uint8 *DebuggerGetWatches(struct debugger_context *dc, int *n); -extern void DebuggerSetWatchStores(struct debugger_context *dc,int n, uint8 *w); -extern uint8 *DebuggerGetWatchStores(struct debugger_context *dc, int *n); -extern int DebuggerIsStorageSet(struct debugger_context *dc, int index); -extern void DebuggerSetWatchCvts(struct debugger_context *dc,int n, uint8 *w); -extern uint8 *DebuggerGetWatchCvts(struct debugger_context *dc, int *n); -extern int DebuggingFpgm(struct debugger_context *dc); - - -extern void PrintFFDlg(FontView *fv,SplineChar *sc,MetricsView *mv); -extern void PrintWindowClose(void); -extern void InsertTextDlg(CharView *cv); - -extern char *Kern2Text(SplineChar *other,KernPair *kp,int isv); -extern char *PST2Text(PST *pst,SplineFont *sf); - - - -void EmboldenDlg(FontView *fv, CharView *cv); -void CondenseExtendDlg(FontView *fv, CharView *cv); -void ObliqueDlg(FontView *fv, CharView *cv); -void GlyphChangeDlg(FontView *fv, CharView *cv, enum glyphchange_type gc); -void ItalicDlg(FontView *fv, CharView *cv); -void ChangeXHeightDlg(FontView *fv,CharView *cv); - -extern int FVParseSelectByPST(FontView *fv,struct lookup_subtable *sub, - int search_type); -extern void DropChars2Text(GWindow gw, GGadget *glyphs,GEvent *event); - - -extern void FVReplaceOutlineWithReference( FontView *fv, double fudge ); -extern void SVDestroy(struct searchview *sv); - - - -extern int SLICount(SplineFont *sf); -extern unichar_t *ClassName(const char *name,uint32 feature_tag, - uint16 flags, int script_lang_index, int merge_with, int act_type, - int macfeature,SplineFont *sf); -extern unichar_t *DecomposeClassName(const unichar_t *clsnm, unichar_t **name, - uint32 *feature_tag, int *macfeature, - uint16 *flags, uint16 *script_lang_index,int *merge_with,int *act_type, - SplineFont *sf); -extern PST *AddSubs(PST *last,uint32 tag,char *name,uint16 flags, - uint16 sli,SplineChar *sc); - - -extern void FVSetUIToMatch(FontView *destfv,FontView *srcfv); -extern void FVScrollToChar(FontView *fv,int i); -extern void FVRegenChar(FontView *fv,SplineChar *sc); -extern FontView *FontNew(void); -extern void _MenuWarnings(GWindow gw,struct gmenuitem *mi,GEvent *e); -extern void MenuPrefs(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuXRes(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuSaveAll(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuExit(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuHelp(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuIndex(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuAbout(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuLicense(GWindow base,struct gmenuitem *mi,GEvent *e); -extern void MenuNew(GWindow gw,struct gmenuitem *mi,GEvent *e); -extern void WindowMenuBuild(GWindow base,struct gmenuitem *mi,GEvent *); -extern void MenuRecentBuild(GWindow base,struct gmenuitem *mi,GEvent *); -extern void MenuScriptsBuild(GWindow base,struct gmenuitem *mi,GEvent *); -extern void mb2FreeGetText(GMenuItem2 *mb); -extern void mb2DoGetText(GMenuItem2 *mb); -extern void mbFreeGetText(GMenuItem *mb); -extern void mbDoGetText(GMenuItem *mb); -extern int RecentFilesAny(void); -extern void _aplistbuild(struct gmenuitem *mi,SplineFont *sf, - void (*func)(GWindow,struct gmenuitem *,GEvent *)); -extern int32 *ParseBitmapSizes(GGadget *g,char *msg,int *err); -extern GTextInfo *AddMacFeatures(GTextInfo *opentype,enum possub_type type,SplineFont *sf); -extern unichar_t *AskNameTag(char *title,unichar_t *def,uint32 def_tag,uint16 flags, - int script_lang_index, enum possub_type type, SplineFont *sf, SplineChar *default_script, - int merge_with,int act_type); -extern unichar_t *ShowScripts(unichar_t *usedef); -extern GTextInfo *SFLangList(SplineFont *sf,int addfinal,SplineChar *default_script); -extern GTextInfo **SFLangArray(SplineFont *sf,int addfinal); -extern int ScriptLangList(SplineFont *sf,GGadget *list,int sli); -extern void GListDelSelected(GGadget *list); -extern void GListMoveSelected(GGadget *list,int offset); -extern GTextInfo *GListChangeLine(GGadget *list,int pos, const unichar_t *line); -extern GTextInfo *GListAppendLine(GGadget *list,const unichar_t *line,int select); -extern GTextInfo *GListChangeLine8(GGadget *list,int pos, const char *line); -extern GTextInfo *GListAppendLine8(GGadget *list,const char *line,int select); -extern void CharInfoInit(void); -extern void SCLigCaretCheck(SplineChar *sc,int clean); -extern char *DevTab_Dlg(GGadget *g, int r, int c); -extern int DeviceTableOK(char *dvstr, int *_low, int *_high); -extern void VRDevTabParse(struct vr *vr,struct matrix_data *md); -extern DeviceTable *DeviceTableParse(DeviceTable *dv,char *dvstr); -extern void DevTabToString(char **str,DeviceTable *adjust); -extern void ValDevTabToStrings(struct matrix_data *mds,int first_offset,ValDevTab *adjust); -extern void KpMDParse(SplineChar *sc,struct lookup_subtable *sub, - struct matrix_data *possub,int rows,int cols,int i); -extern void GFI_LookupEnableButtons(struct gfi_data *gfi, int isgpos); -extern void GFI_LookupScrollbars(struct gfi_data *gfi, int isgpos, int refresh); -extern void FontInfo(SplineFont *sf,int layer,int aspect,int sync); -extern void FontInfoDestroy(SplineFont *sf); -extern void FontMenuFontInfo(void *fv); -extern struct enc *MakeEncoding(SplineFont *sf, EncMap *map); -extern void LoadEncodingFile(void); -extern void RemoveEncoding(void); -extern void SFPrivateInfo(SplineFont *sf); -extern void FVDelay(FontView *fv,void (*func)(FontView *)); -extern void GFI_FinishContextNew(struct gfi_data *d,FPST *fpst, int success); -extern void SCPreparePopup(GWindow gw,SplineChar *sc, struct remap *remap, int enc, int actualuni); -enum outlinesfm_flags { - sfm_stroke=0x1, - sfm_fill=0x2, - sfm_nothing=0x4, - sfm_stroke_trans = (0x1|0x8), - sfm_clip_preserve = 0x16 -}; -extern void CVDrawSplineSetSpecialized( CharView *cv, GWindow pixmap, SplinePointList *set, - Color fg, int dopoints, DRect *clip, - enum outlinesfm_flags strokeFillMode, - Color AlphaChannelOverride ); -extern void CVDrawSplineSet(CharView *cv, GWindow pixmap, SplinePointList *set, - Color fg, int dopoints, DRect *clip ); -extern void CVDrawSplineSetOutlineOnly(CharView *cv, GWindow pixmap, SplinePointList *set, - Color fg, int dopoints, DRect *clip, enum outlinesfm_flags strokeFillMode ); -extern GWindow CVMakeTools(CharView *cv); -extern GWindow CVMakeLayers(CharView *cv); -extern GWindow BVMakeTools(BitmapView *bv); -extern GWindow BVMakeLayers(BitmapView *bv); -extern void CVSetLayer(CharView *cv,int layer); -extern int CVPaletteMnemonicCheck(GEvent *event); -extern int TrueCharState(GEvent *event); -extern void CVToolsPopup(CharView *cv, GEvent *event); -extern void BVToolsPopup(BitmapView *bv, GEvent *event); -extern real CVRoundRectRadius(void); -extern int CVRectElipseCenter(void); -extern void CVRectEllipsePosDlg(CharView *cv); -extern real CVStarRatio(void); -extern int CVPolyStarPoints(void); -extern StrokeInfo *CVFreeHandInfo(void); -extern void BVToolsSetCursor(BitmapView *bv, int state,char *device); -extern void CVToolsSetCursor(CharView *cv, int state,char *device); -extern int CVPaletteIsVisible(CharView *cv,int which); -extern void CVPaletteSetVisible(CharView *cv,int which,int visible); -extern void CVPalettesRaise(CharView *cv); -extern void CVLayersSet(CharView *cv); -extern void _CVPaletteActivate(CharView *cv,int force); -extern void CVPaletteActivate(CharView *cv); -extern void CV_LayerPaletteCheck(SplineFont *sf); -extern void CVPalettesHideIfMine(CharView *cv); -extern int BVPaletteIsVisible(BitmapView *bv,int which); -extern void BVPaletteSetVisible(BitmapView *bv,int which,int visible); -extern void BVPaletteActivate(BitmapView *bv); -extern void BVPalettesHideIfMine(BitmapView *bv); -extern void BVPaletteColorChange(BitmapView *bv); -extern void BVPaletteColorUnderChange(BitmapView *bv,int color); -extern void BVPaletteChangedChar(BitmapView *bv); -extern void CVPaletteDeactivate(void); -extern void PalettesChangeDocking(void); -extern int CVPalettesWidth(void); -extern int BVPalettesWidth(void); -extern int CVInSpiro( CharView *cv ); - -extern void CVDoTransform(CharView *cv, enum cvtools cvt ); - -// apply transform to specified layer -extern void CVTransFuncLayer(CharView *cv,Layer *ly,real transform[6], enum fvtrans_flags flags); -// apply transform to the current layer only -extern void CVTransFunc(CharView *cv,real transform[6],enum fvtrans_flags); -// apply transform to all layers -extern void CVTransFuncAllLayers(CharView *cv,real transform[6], enum fvtrans_flags flags); -enum transdlg_flags { tdf_enableback=0x1, tdf_enablekerns=0x2, - tdf_defaultkerns=0x4, tdf_addapply=0x8 }; -extern void TransformDlgCreate(void *data,void (*transfunc)(void *,real *,int,BVTFunc *,enum fvtrans_flags), - int (*getorigin)(void *,BasePoint *,int), enum transdlg_flags flags, - enum cvtools cvt); -extern void BitmapDlg(FontView *fv,SplineChar *sc, int isavail); -extern int SimplifyDlg(SplineFont *sf,struct simplifyinfo *smpl); -extern void CVReviewHints(CharView *cv); -extern void CVCreateHint(CharView *cv,int ishstem,int preserveundoes); -extern void SCRemoveSelectedMinimumDistances(SplineChar *sc,int inx); -extern int CVExport(CharView *cv); -extern int BVExport(BitmapView *bv); - -extern void DrawAnchorPoint(GWindow pixmap,int x, int y,int selected); -extern void DefaultY(GRect *pos); -extern void CVDrawRubberRect(GWindow pixmap, CharView *cv); -extern void CVInfoDraw(CharView *cv, GWindow pixmap ); -extern void CVChar(CharView *cv, GEvent *event ); -extern void PI_ShowHints(SplineChar *sc, GGadget *list, int set); -extern GTextInfo *SCHintList(SplineChar *sc,HintMask *); -extern void CVResize(CharView *cv ); -extern CharView *CharViewCreate(SplineChar *sc,FontView *fv,int enc); -extern void CharViewFinishNonStatic(); - -/** - * Extended version of CharViewCreate() which allows a window to be created but - * not displayed. - */ -extern CharView *CharViewCreateExtended(SplineChar *sc, FontView *fv,int enc, int show ); -extern void CharViewFree(CharView *cv); -extern int CVValid(SplineFont *sf, SplineChar *sc, CharView *cv); -extern void CVSetCharChanged(CharView *cv,int changed); -extern int CVAnySel(CharView *cv, int *anyp, int *anyr, int *anyi, int *anya); -extern int CVAnySelPoints(CharView *cv); - -/** - * Get all the selected points in the current cv. - * Caller must g_list_free() the returned value. - */ -extern GList_Glib* CVGetSelectedPoints(CharView *cv); -extern void CVSelectPointAt(CharView *cv); -extern int CVClearSel(CharView *cv); -extern int CVSetSel(CharView *cv,int mask); -extern void CVInvertSel(CharView *cv); -extern int CVAllSelected(CharView *cv); -extern SplinePointList *CVAnySelPointList(CharView *cv); -extern int CVAnySelPoint(CharView *cv, SplinePoint **selsp, spiro_cp **selcp); -extern int CVOneThingSel(CharView *cv, SplinePoint **sp, SplinePointList **spl, - RefChar **ref, ImageList **img, AnchorPoint **ap, spiro_cp **cp); -extern int CVOneContourSel(CharView *cv, SplinePointList **_spl, - RefChar **ref, ImageList **img); -extern void CVInfoDrawText(CharView *cv, GWindow pixmap ); -extern void CVImport(CharView *cv); -extern void BVImport(BitmapView *bv); -extern void FVImport(FontView *bv); -extern void CVFindCenter(CharView *cv, BasePoint *bp, int nosel); -extern void CVStroke(CharView *cv); -extern void FVStroke(FontView *fv); -extern void FreeHandStrokeDlg(StrokeInfo *si); -extern void OutlineDlg(FontView *fv, CharView *cv,MetricsView *mv,int isinline); -extern void ShadowDlg(FontView *fv, CharView *cv,MetricsView *mv,int wireframe); -extern void CVTile(CharView *cv); -extern void FVTile(FontView *fv); -extern void CVPatternTile(CharView *cv); -extern void FVPatternTile(FontView *fv); -extern void SCCharInfo(SplineChar *sc,int deflayer,EncMap *map,int enc); -extern void CharInfoDestroy(struct charinfo *ci); -extern SplineChar *SuffixCheck(SplineChar *sc,char *suffix); -extern void SCSubtableDefaultSubsCheck(SplineChar *sc, struct lookup_subtable *sub, struct matrix_data *possub, int col_cnt, int r,int layer); -extern GImage *PST_GetImage(GGadget *pstk,SplineFont *sf,int def_layer, - struct lookup_subtable *sub,int popup_r, SplineChar *sc ); -extern GImage *NameList_GetImage(SplineFont *sf,SplineChar *sc,int def_layer, - char *namelist, int isliga ); -extern GImage *GV_GetConstructedImage(SplineChar *sc,int def_layer, struct glyphvariants *gv, - int is_horiz); -extern GImage *SC_GetLinedImage(SplineChar *sc, int def_layer, int pos, int is_italic_cor); -extern struct glyphvariants *GV_ParseConstruction(struct glyphvariants *gv, - struct matrix_data *stuff, int rows, int cols); -extern void GV_ToMD(GGadget *g, struct glyphvariants *gv); -extern void CVGetInfo(CharView *cv); -extern void CVPGetInfo(CharView *cv); -extern int SCUsedBySubs(SplineChar *sc); -extern void SCSubBy(SplineChar *sc); -extern void SCRefBy(SplineChar *sc); -extern void ApGetInfo(CharView *cv, AnchorPoint *ap); -extern void CVMakeClipPath(CharView *cv); -extern void CVAddAnchor(CharView *cv); -extern AnchorClass *AnchorClassUnused(SplineChar *sc,int *waslig); -extern void FVSetWidth(FontView *fv,enum widthtype wtype); -extern void CVSetWidth(CharView *cv,enum widthtype wtype); -extern void GenericVSetWidth(FontView *fv,SplineChar* sc,enum widthtype wtype); -extern void CVChangeSC(CharView *cv, SplineChar *sc ); -extern Undoes *CVPreserveTState(CharView *cv); -/** - * If isTState > 0 then CVPreserveTState(cv) - * otherwise CVPreserveState(cv) - */ -extern Undoes *CVPreserveMaybeState(CharView *cv, int isTState ); -extern void CVRestoreTOriginalState(CharView *cv); -extern void CVUndoCleanup(CharView *cv); - -extern void AdjustControls(SplinePoint *sp); -extern void CVAdjustPoint(CharView *cv, SplinePoint *sp); -extern void CVMergeSplineSets(CharView *cv, SplinePoint *active, SplineSet *activess, - SplinePoint *merge, SplineSet *mergess); -extern void CVAdjustControl(CharView *cv,BasePoint *cp, BasePoint *to); -extern int CVMoveSelection(CharView *cv, real dx, real dy, uint32 input_state); -extern int CVTestSelectFromEvent(CharView *cv,GEvent *event); -extern void CVMouseMovePen(CharView *cv, PressedOn *p, GEvent *event); -extern void CVMouseUpPoint(CharView *cv,GEvent *event); -extern int CVMouseMovePointer(CharView *cv, GEvent *event); -extern void CVMouseDownPointer(CharView *cv, FindSel *fs, GEvent *event); -extern void CVMouseDownRuler(CharView *cv, GEvent *event); -extern void CVMouseMoveRuler(CharView *cv, GEvent *event); -extern int CVMouseAtSpline(CharView *cv,GEvent *event); -extern void CVMouseUpRuler(CharView *cv, GEvent *event); -extern void CVMouseMoveHand(CharView *cv, GEvent *event); -extern void CVMouseDownFreeHand(CharView *cv, GEvent *event); -extern void CVMouseMoveFreeHand(CharView *cv, GEvent *event); -extern void CVMouseUpFreeHand(CharView *cv, GEvent *event); -extern void CVMouseDownShape(CharView *cv,GEvent *event); -extern void CPStartInfo(CharView *cv, GEvent *event); -extern void CPUpdateInfo(CharView *cv, GEvent *event); -extern void CPEndInfo(CharView *cv); -extern void BVChar(BitmapView *cv, GEvent *event ); -extern void CVMouseDownPoint(CharView *cv,GEvent *event); -extern void CVMouseMovePoint(CharView *cv,PressedOn *); -extern void CVMouseUpPointer(CharView *cv ); -extern void CVCheckResizeCursors(CharView *cv); -extern void CVMouseDownHand(CharView *cv); -extern void CVMouseUpHand(CharView *cv); -extern void CVMouseDownTransform(CharView *cv); -extern void CVMouseMoveTransform(CharView *cv); -extern void CVMouseUpTransform(CharView *cv); -extern void CVMouseDownKnife(CharView *cv); -extern void CVMouseMoveKnife(CharView *cv,PressedOn *); -extern void CVMouseUpKnife(CharView *cv,GEvent *event); -extern void CVMouseMoveShape(CharView *cv); -extern void CVMouseUpShape(CharView *cv); -extern void LogoExpose(GWindow pixmap,GEvent *event, GRect *r,enum drawmode dm); -extern void CVDebugPointPopup(CharView *cv); - -extern int GotoChar(SplineFont *sf,EncMap *map, int *merge_with_selection); - -extern void CVShowPoint(CharView *cv, BasePoint *me); - -extern void BitmapViewFinishNonStatic(); -extern BitmapView *BitmapViewCreate(BDFChar *bc, BDFFont *bdf, FontView *fv,int enc); -extern BitmapView *BitmapViewCreatePick(int enc, FontView *fv); -extern void BitmapViewFree(BitmapView *bv); -extern void BVMenuRotateInvoked(GWindow gw,struct gmenuitem *mi, GEvent *e); -extern void BVRotateBitmap(BitmapView *bv,enum bvtools type ); -extern int BVColor(BitmapView *bv); -extern void BCGeneralFunction(BitmapView *bv, - void (*SetPoint)(BitmapView *,int x, int y, void *data),void *data); -extern char *BVFlipNames[]; -extern void BVChangeBC(BitmapView *bv, BDFChar *bc, int fitit ); - -extern void MVSetSCs(MetricsView *mv, SplineChar **scs); -extern void MVRefreshChar(MetricsView *mv, SplineChar *sc); -extern void MVRegenChar(MetricsView *mv, SplineChar *sc); -extern void MVReKern(MetricsView *mv); -extern void MetricsViewFinishNonStatic(); -extern MetricsView *MetricsViewCreate(FontView *fv,SplineChar *sc,BDFFont *bdf); -extern void MetricsViewFree(MetricsView *mv); -extern void MVRefreshAll(MetricsView *mv); -extern void MV_FriendlyFeatures(GGadget *g, int pos); -extern GTextInfo *SLOfFont(SplineFont *sf); - -extern void DoPrefs(void); -extern void DoXRes(void); -extern void PointerDlg(CharView *cv); -extern void GListAddStr(GGadget *list,unichar_t *str, void *ud); -extern void GListReplaceStr(GGadget *list,int index, unichar_t *str, void *ud); -extern struct macname *NameGadgetsGetNames( GWindow gw ); -extern void NameGadgetsSetEnabled( GWindow gw, int enable ); -extern int GCDBuildNames(GGadgetCreateData *gcd,GTextInfo *label,int pos,struct macname *names); -extern void GCDFillMacFeat(GGadgetCreateData *mfgcd,GTextInfo *mflabels, int width, - MacFeat *all, int fromprefs, GGadgetCreateData *boxes, - GGadgetCreateData **array); -extern void Prefs_ReplaceMacFeatures(GGadget *list); - -extern unichar_t *FVOpenFont(char *title, const char *defaultfile, int mult); - - - - -extern void ShowAboutScreen(void); -extern void DelayEvent(void (*func)(void *), void *data); - -extern void FindProblems(FontView *fv,CharView *cv,SplineChar *sc); -typedef enum -{ - constrainSelection_AveragePoints = 0, - constrainSelection_SpacePoints = 1, - constrainSelection_SpaceSelectedRegions = 2 -} constrainSelection_t; -extern void CVConstrainSelection(CharView *cv, constrainSelection_t type); -extern void CVMakeParallel(CharView *cv); - -extern void ScriptDlg(FontView *fv,CharView *cv); - -# if HANYANG -extern void MenuNewComposition(GWindow gw, struct gmenuitem *, GEvent *); -extern void CVDisplayCompositions(GWindow gw, struct gmenuitem *, GEvent *); -extern void Disp_DoFinish(struct jamodisplay *d, int cancel); -extern void Disp_RefreshChar(SplineFont *sf,SplineChar *sc); -extern void Disp_DefaultTemplate(CharView *cv); -# endif - -extern SearchView *SVCreate(FontView *fv); -extern void SVCharViewInits(SearchView *sv); -extern void SV_DoClose(struct cvcontainer *cvc); -extern void SVMakeActive(SearchView *sv,CharView *cv); -extern int SVAttachFV(FontView *fv,int ask_if_difficult); -extern void SVDetachFV(FontView *fv); - -extern void MKDMakeActive(MathKernDlg *mkd,CharView *cv); -extern void MKD_DoClose(struct cvcontainer *cvc); -extern void MKDCharViewInits(MathKernDlg *mkd); -extern void MathKernDialog(SplineChar *sc,int def_layer); - -extern void ShowAtt(SplineFont *sf,int def_layer); -extern void FontCompareDlg(FontView *fv); -extern void SFShowKernPairs(SplineFont *sf,SplineChar *sc,AnchorClass *ac,int layer); -extern void SFShowLigatures(SplineFont *sf,SplineChar *sc); - -extern void SCEditInstructions(SplineChar *sc); -extern void SFEditTable(SplineFont *sf, uint32 tag); -extern void IIScrollTo(struct instrinfo *ii,int ip,int mark_stop); -extern void IIReinit(struct instrinfo *ii,int ip); -extern int ii_v_e_h(GWindow gw, GEvent *event); -extern void instr_scroll(struct instrinfo *ii,struct sbevent *sb); - -extern void CVGridFitChar(CharView *cv); -/** - * If a live preview of grid fit is somehow in effect, call CVGridFitChar() for us. - * A caller can call here after a change and any CVGridFitChar() will be updated if need be. - */ -extern void CVGridHandlePossibleFitChar(CharView *cv); -extern void CVFtPpemDlg(CharView *cv,int debug); -extern void SCDeGridFit(SplineChar *sc); -extern void SCReGridFit(SplineChar *sc,int layer); - -extern void CVDebugReInit(CharView *cv,int restart_debug,int dbg_fpgm); -extern void CVDebugFree(DebugView *dv); -extern int DVChar(DebugView *dv, GEvent *e); - -extern void KernClassD(KernClass *kc, SplineFont *sf, int layer, int isv); -extern void ShowKernClasses(SplineFont *sf,MetricsView *mv,int layer,int isv); -extern void KCLD_End(struct kernclasslistdlg *kcld); -extern void KCLD_MvDetach(struct kernclasslistdlg *kcld,MetricsView *mv); -extern void KernPairD(SplineFont *sf,SplineChar *sc1,SplineChar *sc2,int layer, int isv); -extern void KCD_DrawGlyph(GWindow pixmap,int x,int baseline,BDFChar *bdfc,int mag); -extern GTextInfo *BuildFontList(FontView *except); -extern void TFFree(GTextInfo *tf); - -extern void AnchorControl(SplineChar *sc,AnchorPoint *ap,int layer); -extern void AnchorControlClass(SplineFont *_sf,AnchorClass *ac,int layer); - -extern void FVSelectByPST(FontView *fv); - -enum hist_type { hist_hstem, hist_vstem, hist_blues }; -struct psdict; -extern void SFHistogram(SplineFont *sf,int layer, struct psdict *private,uint8 *selected, - EncMap *map, enum hist_type which); - -extern void ContextChainEdit(SplineFont *sf,FPST *fpst, - struct gfi_data *gfi,unichar_t *newname,int layer); -extern char *cu_copybetween(const unichar_t *start, const unichar_t *end); - -extern void StateMachineEdit(SplineFont *sf,ASM *sm,struct gfi_data *d); -extern void GFI_FinishSMNew(struct gfi_data *d,ASM *sm, int success,int isnew); - -extern void MMChangeBlend(MMSet *mm,FontView *fv,int tonew); -extern void MMWizard(MMSet *mm); - -extern int LayerDialog(Layer *layer,SplineFont *sf); -extern void CVLayerChange(CharView *cv); - -extern int PointOfViewDlg(struct pov_data *pov,SplineFont *sf,int flags); - -extern SplineChar *FVMakeChar(FontView *fv,int i); - -extern void CVPointOfView(CharView *cv,struct pov_data *); - -extern void DVCreateGloss(DebugView *dv); -extern void DVMarkPts(DebugView *dv,SplineSet *ss); -extern int CVXPos(DebugView *dv,int offset,int width); - -extern GMenuItem *GetEncodingMenu(void (*func)(GWindow,GMenuItem *,GEvent *), - Encoding *current); - -extern GTextInfo *TIFromName(const char *name); - -enum subtable_data_flags { - /* I have flags for each alternative because I want "unspecified" to be */ - /* an option */ - sdf_kernclass = 0x01, - sdf_kernpair = 0x02, - sdf_verticalkern = 0x04, - sdf_horizontalkern = 0x08, - sdf_dontedit = 0x10 -}; -struct subtable_data { - int flags; - SplineChar *sc; -}; - -extern GTextInfo **SFLookupListFromType(SplineFont *sf, int lookup_type ); -extern GTextInfo *SFLookupArrayFromType(SplineFont *sf, int lookup_type ); -extern GTextInfo *SFLookupArrayFromMask(SplineFont *sf, int lookup_mask ); -extern GTextInfo **SFSubtablesOfType(SplineFont *sf, int lookup_type, int kernclass, int add_none); -extern GTextInfo *SFSubtableListOfType(SplineFont *sf, int lookup_type, int kernclass, int add_none); -extern struct lookup_subtable *SFNewLookupSubtableOfType(SplineFont *sf, int lookup_type, struct subtable_data *sd, int def_layer ); -extern int EditLookup(OTLookup *otl,int isgpos,SplineFont *sf); -extern int EditSubtable(struct lookup_subtable *sub,int isgpos,SplineFont *sf, - struct subtable_data *sd,int def_layer); -extern void _LookupSubtableContents(SplineFont *sf, struct lookup_subtable *sub, - struct subtable_data *sd,int def_layer); -extern char *SCNameUniStr(SplineChar *sc); -extern unichar_t *uSCNameUniStr(SplineChar *sc); -extern char *SFNameList2NameUni(SplineFont *sf, char *str); -extern unichar_t **SFGlyphNameCompletion(SplineFont *sf,GGadget *t,int from_tab, - int new_name_after_space); -extern char *GlyphNameListDeUnicode( char *str ); -extern void AddRmLang(SplineFont *sf, struct lkdata *lk,int add_lang); -extern void FVMassGlyphRename(FontView *fv); - -extern void SFBdfProperties(SplineFont *sf, EncMap *map, BDFFont *thisone); - - - -extern GMenuItem2 helplist[]; -extern BasePoint last_ruler_offset[]; - -extern void CVCopyLayerToLayer(CharView *cv); -extern void FVCopyLayerToLayer(FontView *fv); -extern void CVCompareLayerToLayer(CharView *cv); -extern void FVCompareLayerToLayer(FontView *fv); - -extern void MathInit(void); -extern void SFMathDlg(SplineFont *sf,int def_layer); - -extern GMenuItem2 *cvpy_menu, *fvpy_menu; -extern void cvpy_tllistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e); -extern void fvpy_tllistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e); - -extern GMenuItem2 *cv_menu, *fv_menu; -extern void cv_tl2listcheck(GWindow gw,struct gmenuitem *mi,GEvent *e); -extern void fv_tl2listcheck(GWindow gw,struct gmenuitem *mi,GEvent *e); - -extern void SFValidationWindow(SplineFont *sf,int layer, enum fontformat format); -extern void ValidationDestroy(SplineFont *sf); - - - -extern const char *UI_TTFNameIds(int id); -extern const char *UI_MSLangString(int language); -extern void FontInfoInit(void); -extern void LookupUIInit(void); -extern enum psstrokeflags Ps_StrokeFlagsDlg(void); -extern struct cidmap *AskUserForCIDMap(void); - -extern void DefineGroups(struct fontview *fv); -extern void DisplayGroups(struct fontview *fv); - -extern struct Base *SFBaselines(SplineFont *sf,struct Base *old,int is_vertical); -extern void JustifyDlg(SplineFont *sf); -extern char *GlyphListDlg(SplineFont *sf, char *glyphstr); - -extern void DeltaSuggestionDlg(FontView *fv,CharView *cv); -extern void QGRmFontView(struct qg_data *qg,FontView *fv); -extern void QGRmCharView(struct qg_data *qg,CharView *cv); - - -extern struct hslrgb *SFFontCols(SplineFont *sf,struct hslrgb fontcols[6]); - -extern Color view_bgcol; /* Background color for views */ -extern void MVColInit(void); -extern void CVColInit( void ); - -extern void FontViewRemove(FontView *fv); -extern void FontViewFinishNonStatic(); -extern void FVChar(FontView *fv,GEvent *event); -extern void FVDrawInfo(FontView *fv,GWindow pixmap,GEvent *event); -extern void FVRedrawAllCharViews(FontView *fv); -extern void KFFontViewInits(struct kf_dlg *kf,GGadget *drawable); -extern char *GlyphSetFromSelection(SplineFont *sf,int def_layer,char *current); -extern void ME_ListCheck(GGadget *g,int r, int c, SplineFont *sf); -extern void ME_SetCheckUnique(GGadget *g,int r, int c, SplineFont *sf); -extern void ME_ClassCheckUnique(GGadget *g,int r, int c, SplineFont *sf); -extern void PI_Destroy(struct dlistnode *node); -struct gidata; -extern void PIChangePoint(struct gidata *ci); - -extern void CVRegenFill(CharView *cv); -extern void RulerDlg(CharView *cv); -extern int CVCountSelectedPoints(CharView *cv); -extern void _CVMenuInsertPt(CharView *cv); -extern void _CVMenuNamePoint(CharView *cv, SplinePoint *sp); -extern void _CVMenuNameContour(CharView *cv); - -extern void Prefs_LoadDefaultPreferences( void ); - - -extern CharView* CharViewFindActive(); -extern FontViewBase* FontViewFindActive(); -extern FontViewBase* FontViewFind( int (*testFunc)( FontViewBase*, void* ), void* udata ); - -extern int FontViewFind_byXUID( FontViewBase* fv, void* udata ); -extern int FontViewFind_byXUIDConnected( FontViewBase* fv, void* udata ); -extern int FontViewFind_byCollabPtr( FontViewBase* fv, void* udata ); -extern int FontViewFind_bySplineFont( FontViewBase* fv, void* udata ); -extern int FontViewFind_byCollabBasePort( FontViewBase* fv, void* udata ); - -extern void SPSelectNextPoint( SplinePoint *sp, int state ); -extern void SPSelectPrevPoint( SplinePoint *sp, int state ); - - -/** - * Is the next BCP for the sp selected, and is it the primary BCP for the selection - * @see SPIsNextCPSelected - */ -extern bool SPIsNextCPSelectedSingle( SplinePoint *sp, CharView *cv ); -/** - * Is the prev BCP for the sp selected, and is it the primary BCP for the selection - * @see SPIsNextCPSelected - */ -extern bool SPIsPrevCPSelectedSingle( SplinePoint *sp, CharView *cv ); -/** - * Is the next BCP for the sp selected, it can be the primary or any - * of the secondary selected BCP - * - * The last selected BCP is the 'primary' selected BCP. Code which - * only handles a single selected BCP will only honor the primary - * selected BCP - * - * There can also be one or more seconday selected BCP. These might be - * drawn with slightly less highlight graphically and are only handled - * by code which has been updated to allow mutliple selected BCP to be - * operated on at once. - */ -extern bool SPIsNextCPSelected( SplinePoint *sp, CharView *cv ); -/** - * Is the prev BCP for the sp selected, it can be the primary or any of the secondary selected BCP - * - * @see SPIsNextCPSelected - */ -extern bool SPIsPrevCPSelected( SplinePoint *sp, CharView *cv ); - -typedef struct FE_adjustBCPByDeltaDataS -{ - CharView *cv; //< used to update view - real dx; //< Add this to the BCP x - real dy; //< Add this to the BCP y - int keyboarddx; - -} FE_adjustBCPByDeltaData; - - -/** - * Visitor function type for visitSelectedControlPoints() - */ -typedef void (*visitSelectedControlPointsVisitor) ( void* key, - void* value, - SplinePoint* sp, - BasePoint *which, - bool isnext, - void* udata ); - -/** - * Visitor function to move each BCP by data->dx/data->dy - * - * - * Visitor: visitSelectedControlPointsVisitor - * UsedBy: CVFindAndVisitSelectedControlPoints - */ -extern void FE_adjustBCPByDelta( void* key, - void* value, - SplinePoint* sp, - BasePoint *which, - bool isnext, - void* udata ); - -extern void FE_adjustBCPByDeltaWhilePreservingBCPAngle( void* key, - void* value, - SplinePoint* sp, - BasePoint *which, - bool isnext, - void* udata ); - -/** - * Visitor function to unselect every BCP passed - * - * Visitor: visitSelectedControlPointsVisitor - * UsedBy: CVFindAndVisitSelectedControlPoints - * CVUnselectAllBCP - * - * @see SPIsNextCPSelected - */ -extern void FE_unselectBCP( void* key, - void* value, - SplinePoint* sp, - BasePoint *which, - bool isnext, - void* udata ); - -extern void FE_touchControlPoint( void* key, - void* value, - SplinePoint* sp, - BasePoint *which, - bool isnext, - void* udata ); - -/** - * Find all the selected BCP and apply the visitor function f to them - * passing the user data pointer udata to the 'f' visitor. - * - * This function doesn't use udata at all, it simply passes it on to - * your visitor function so it may do something with it like record - * results or take optional parameters. - * - * If preserveState is true and there are selected BCP then - * CVPreserveState() is called before the visitor function. - */ -extern void CVFindAndVisitSelectedControlPoints( CharView *cv, bool preserveState, - visitSelectedControlPointsVisitor f, void* udata ); -/** - * NOTE: doesn't do all, just all on selected spline. - */ -extern void CVVisitAllControlPoints( CharView *cv, bool preserveState, - visitSelectedControlPointsVisitor f, void* udata ); - -/** - * Unselect all the BCP which are currently selected. - */ -extern void CVUnselectAllBCP( CharView *cv ); - - -/** - * This will call your visitor function 'f' on any selected BCP. This - * is regardless of if the BCP is the next or prev BCP for it's - * splinepoint. - * - * This function doesn't use udata at all, it simply passes it on to - * your visitor function so it may do something with it like record - * results or take optional parameters. - */ -extern void visitSelectedControlPoints( GHashTable *col, visitSelectedControlPointsVisitor f, gpointer udata ); -/** - * NOTE: doesn't do all, just all on selected spline. - */ -extern void visitAllControlPoints( GHashTable *col, visitSelectedControlPointsVisitor f, gpointer udata ); - -extern void CVVisitAdjacentToSelectedControlPoints( CharView *cv, bool preserveState, - visitSelectedControlPointsVisitor f, void* udata ); - -extern void CVFreePreTransformSPL( CharView* cv ); - -extern bool CVShouldInterpolateCPsOnMotion( CharView* cv ); - -extern int CVNearRBearingLine( CharView* cv, real x, real fudge ); -extern int CVNearLBearingLine( CharView* cv, real x, real fudge ); - -extern void CVMenuConstrain(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)); - - - -#endif /* _VIEWS_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/Readme.md b/pdf2htmlEX/src/util/fontforge-20190801/Readme.md new file mode 100644 index 0000000..2cd385b --- /dev/null +++ b/pdf2htmlEX/src/util/fontforge-20190801/Readme.md @@ -0,0 +1,26 @@ +# FontForge: the missing headers + +The FontForge header files in this directory are taken from the +FontForge-20190801 release. + +They are headers which are not usually installed by the FontForge make +system. + + +## Required headers + +- `autowidth.h` required for FVRemoveKerns +- `bitmapchar.h` required for SFReplaceEncodingBDFProps +- `cvimages.h` required for FVImportImages +- `fvfonts.h` required for SFFindSlot +- `namelist.h` required for UniFromName +- `savefont.h` required for GenerateScript +- `splineorder2.h` required for SFConvertToOrder2 +- `splineutil.h` required for AltUniFree +- `splineutil2.h` required for SplineFontNew +- `start.h` required for InitSimpleStuff +- `tottf.h` required for SFDefaultOS2Info + +## Helpful headers + +- `encoding.h` conflicts with an existing header in the src/util directory. diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/autowidth.h b/pdf2htmlEX/src/util/fontforge-20190801/autowidth.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/autowidth.h rename to pdf2htmlEX/src/util/fontforge-20190801/autowidth.h diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/bitmapchar.h b/pdf2htmlEX/src/util/fontforge-20190801/bitmapchar.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/bitmapchar.h rename to pdf2htmlEX/src/util/fontforge-20190801/bitmapchar.h diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/cvimages.h b/pdf2htmlEX/src/util/fontforge-20190801/cvimages.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/cvimages.h rename to pdf2htmlEX/src/util/fontforge-20190801/cvimages.h index 517fd0b..7c77e43 100644 --- a/pdf2htmlEX/src/util/fontforge-2.0.20170731/cvimages.h +++ b/pdf2htmlEX/src/util/fontforge-20190801/cvimages.h @@ -3,8 +3,8 @@ #include "baseviews.h" #include "gimage.h" -#include "splinefont.h" #include "sd.h" +#include "splinefont.h" extern GImage *ImageAlterClut(GImage *image); extern int FVImportImages(FontViewBase *fv, char *path, int format, int toback, int flags); diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/encoding.h b/pdf2htmlEX/src/util/fontforge-20190801/encoding.h similarity index 98% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/encoding.h rename to pdf2htmlEX/src/util/fontforge-20190801/encoding.h index 6a46e5b..dff132b 100644 --- a/pdf2htmlEX/src/util/fontforge-2.0.20170731/encoding.h +++ b/pdf2htmlEX/src/util/fontforge-20190801/encoding.h @@ -61,7 +61,7 @@ extern int CIDFromName(char *name, SplineFont *cidmaster); extern int CountOfEncoding(Encoding *encoding_name); extern int MaxCID(struct cidmap *map); extern int NameUni2CID(struct cidmap *map, int uni, const char *name); -extern int SFFlattenByCMap(SplineFont *sf, char *cmapname); +extern int SFFlattenByCMap(SplineFont **sf, char *cmapname); extern int SFForceEncoding(SplineFont *sf, EncMap *old, Encoding *new_enc); extern int SFReencode(SplineFont *sf, const char *encname, int force); extern SplineFont *CIDFlatten(SplineFont *cidmaster, SplineChar **glyphs, int charcnt); diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/fvfonts.h b/pdf2htmlEX/src/util/fontforge-20190801/fvfonts.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/fvfonts.h rename to pdf2htmlEX/src/util/fontforge-20190801/fvfonts.h diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/namelist.h b/pdf2htmlEX/src/util/fontforge-20190801/namelist.h similarity index 89% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/namelist.h rename to pdf2htmlEX/src/util/fontforge-20190801/namelist.h index 3f87c76..6ec85ad 100644 --- a/pdf2htmlEX/src/util/fontforge-2.0.20170731/namelist.h +++ b/pdf2htmlEX/src/util/fontforge-20190801/namelist.h @@ -8,6 +8,7 @@ extern char **AllNamelistNames(void); extern char **SFTemporaryRenameGlyphsToNamelist(SplineFont *sf, NameList *new); extern const char *RenameGlyphToNamelist(char *buffer, SplineChar *sc, NameList *old, NameList *new, char **sofar); extern const char *StdGlyphName(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font); +extern const char *StdGlyphNameBoundsCheck(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font); extern int UniFromName(const char *name, enum uni_interp interp, Encoding *encname); extern NameList *DefaultNameListForNewFonts(void); extern NameList *LoadNamelist(char *filename); diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/savefont.h b/pdf2htmlEX/src/util/fontforge-20190801/savefont.h similarity index 65% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/savefont.h rename to pdf2htmlEX/src/util/fontforge-20190801/savefont.h index 1bde2a1..62296d2 100644 --- a/pdf2htmlEX/src/util/fontforge-2.0.20170731/savefont.h +++ b/pdf2htmlEX/src/util/fontforge-20190801/savefont.h @@ -32,6 +32,36 @@ #include "splinefont.h" +enum fm_flags { fm_flag_afm = 0x1, + fm_flag_pfm = 0x2, + fm_flag_shortps = 0x4, + fm_flag_nopshints = 0x8, + fm_flag_apple = 0x10, + fm_flag_pfed_comments = 0x20, + fm_flag_pfed_colors = 0x40, + fm_flag_opentype = 0x80, + fm_flag_glyphmap = 0x100, + fm_flag_TeXtable = 0x200, + fm_flag_ofm = 0x400, + fm_flag_applemode = 0x800, + // fm_flag_??? = 0x1000, + fm_flag_symbol = 0x2000, + fm_flag_dummyDSIG = 0x4000, + // fm_flag_??? = 0x8000, + fm_flag_tfm = 0x10000, + fm_flag_nohintsubs = 0x20000, + fm_flag_noflex = 0x40000, + fm_flag_nottfhints = 0x80000, + fm_flag_restrict256 = 0x100000, + fm_flag_round = 0x200000, + fm_flag_afmwithmarks = 0x400000, + fm_flag_pfed_lookups = 0x800000, + fm_flag_pfed_guides = 0x1000000, + fm_flag_pfed_layers = 0x2000000, + fm_flag_winkern = 0x4000000, + fm_flag_nomacnames = 0x8000000, + }; + extern const char (*savefont_extensions[]), (*bitmapextensions[]); extern int old_sfnt_flags; diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/splineorder2.h b/pdf2htmlEX/src/util/fontforge-20190801/splineorder2.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/splineorder2.h rename to pdf2htmlEX/src/util/fontforge-20190801/splineorder2.h diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil.h b/pdf2htmlEX/src/util/fontforge-20190801/splineutil.h similarity index 98% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil.h rename to pdf2htmlEX/src/util/fontforge-20190801/splineutil.h index c0e329b..99d21ab 100644 --- a/pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil.h +++ b/pdf2htmlEX/src/util/fontforge-20190801/splineutil.h @@ -1,6 +1,7 @@ #ifndef FONTFORGE_SPLINEUTIL_H #define FONTFORGE_SPLINEUTIL_H +#include "glif_name_hash.h" #include "psfont.h" #include "splinefont.h" #include "ttfinstrs.h" @@ -56,6 +57,8 @@ extern int SplineExistsInSS(Spline *s, SplineSet *ss); extern int SplinePointIsACorner(SplinePoint *sp); extern int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2); extern int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss, bigreal err); +extern int SplineRemoveWildControlPoints(Spline *s, bigreal distratio); +extern int SplineSetsRemoveWildControlPoints(SplineSet *ss, bigreal distratio); /* Two lines intersect in at most 1 point */ /* Two quadratics intersect in at most 4 points */ @@ -130,6 +133,7 @@ extern void GlyphVariantsFree(struct glyphvariants *gv); extern void GradientFree(struct gradient *grad); extern void GrowBufferAdd(GrowBuf *gb, int ch); extern void GrowBufferAddStr(GrowBuf *gb, char *str); +extern void GuidelineSetFree(GuidelineSet *gl); extern void ImageListsFree(ImageList *imgs); extern void JstfLangFree(struct jstf_lang *jl); extern void JustifyFree(Justify *just); @@ -172,7 +176,6 @@ extern void SFInstanciateRefs(SplineFont *sf); extern void SFReinstanciateRefs(SplineFont *sf); extern void SFRemoveAnchorClass(SplineFont *sf, AnchorClass *an); extern void SFRemoveSavedTable(SplineFont *sf, uint32 tag); -extern void SPLCategorizePointsKeepCorners(SplinePointList *spl); extern void SplineCharFindBounds(SplineChar *sc, DBounds *bounds); extern void SplineCharFreeContents(SplineChar *sc); extern void SplineCharLayerFindBounds(SplineChar *sc, int layer, DBounds *bounds); @@ -206,12 +209,9 @@ extern void TTFLangNamesFree(struct ttflangname *l); extern void TtfTablesFree(struct ttf_table *tab); extern void ValDevFree(ValDevTab *adjust); -#ifdef FF_UTHASH_GLIF_NAMES -struct glif_name_index; extern int KerningClassSeekByAbsoluteIndex(const struct splinefont *sf, int seek_index, struct kernclass **okc, int *oisv, int *oisr, int *ooffset); extern int HashKerningClassNames(SplineFont *sf, struct glif_name_index * class_name_hash); extern int HashKerningClassNamesCaps(SplineFont *sf, struct glif_name_index * class_name_hash); extern int HashKerningClassNamesFlex(SplineFont *sf, struct glif_name_index * class_name_hash, int capitalize); -#endif /* FF_UTHASH_GLIF_NAMES */ #endif /* FONTFORGE_SPLINEUTIL_H */ diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil2.h b/pdf2htmlEX/src/util/fontforge-20190801/splineutil2.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/splineutil2.h rename to pdf2htmlEX/src/util/fontforge-20190801/splineutil2.h diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/start.h b/pdf2htmlEX/src/util/fontforge-20190801/start.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/start.h rename to pdf2htmlEX/src/util/fontforge-20190801/start.h diff --git a/pdf2htmlEX/src/util/fontforge-2.0.20170731/tottf.h b/pdf2htmlEX/src/util/fontforge-20190801/tottf.h similarity index 100% rename from pdf2htmlEX/src/util/fontforge-2.0.20170731/tottf.h rename to pdf2htmlEX/src/util/fontforge-20190801/tottf.h From 7e20d11b0ada70a89c2a9c332e89b2c5d06642d5 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 10 Dec 2019 05:37:56 +0000 Subject: [PATCH 131/269] updated fontforge build script to not build xwindows ui --- buildScripts/buildFontforge | 31 ++++++++++++++++++++++++------- pdf2htmlEX/src/util/ffw.c | 7 +++++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index f2d5823..9df9001 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -17,7 +17,11 @@ echo "" # see: https://github.com/travis-ci/travis-ci/issues/5301 (unfixed) # if [ -n "$PYTHON_CFLAGS" ] ; then - export PYTHON_CFLAGS="$(pkg-config --cflags python) $PYTHON_CFLAGS" + export PYTHON_CFLAGS="$(python3-config --cflags) $PYTHON_CFLAGS" +fi + +if [ -n "$PYTHON_LIBS" ] ; then + export PYTHON_LIBS="$(python3-config --ldflags) $PYTHON_LIBS" fi echo "" @@ -26,21 +30,34 @@ echo "-------------------------------" echo $PYTHON_CFLAGS echo "-------------------------------" echo "" +echo "" +echo "PYTHON_LIBS:" +echo "-------------------------------" +echo $PYTHON_LIBS +echo "-------------------------------" +echo "" # Can use "configure --disable-silent-rules" to debug configuration/make # problems # cd fontforge + ./bootstrap -./configure + +./configure \ + --prefix=/usr/local \ + --enable-python-scripting=3 \ + --disable-dependency-tracking \ + --disable-silent-rules \ + --without-x # Apply any patches required for fontforge raw sources before we make # -for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*) -do - echo "patching fontforge using [$APATCHFILE]" - patch -p 1 < $APATCHFILE -done +#for APATCHFILE in $(ls ../patches/fontforge-$FONTFORGE_VERSION-*) +#do +# echo "patching fontforge using [$APATCHFILE]" +# patch -p 1 < $APATCHFILE +#done make $MAKE_PARALLEL diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index 91418f9..05b6385 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -146,15 +146,18 @@ void ffw_load_font(const char * filename) assert((cur_fv == NULL) && "Previous font is not destroyed"); char * _filename = strcopy(filename); - SplineFont * font = LoadSplineFont(_filename, 1); + SplineFont * font = LoadSplineFont(_filename, of_fstypepermitted); free(_filename); if(!font) err("Cannot load font %s\n", filename); - if(!font->fv) + + if(!font->fv) { + assert(fv_interface && "fv_interface not initialized!"); FVAppend(_FontViewCreate(font)); + } assert(font->fv); From ae281bc87a9a8f65b482d66a806bb7a79c0ae155 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 10 Dec 2019 06:08:49 +0000 Subject: [PATCH 132/269] moved forward t python3 --- buildScripts/getDevLibraries | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/getDevLibraries b/buildScripts/getDevLibraries index 37b80f5..dadc2e4 100755 --- a/buildScripts/getDevLibraries +++ b/buildScripts/getDevLibraries @@ -24,4 +24,4 @@ sudo apt-get $UNATTENDED install \ liblcms2-dev \ libxml2-dev \ libuninameslist-dev \ - libpython-dev + python3-dev From 6eba02cfc2da270bdd9a939015264f1ce0c2a7b9 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 10 Dec 2019 07:35:52 +0000 Subject: [PATCH 133/269] added an explicity FintProgDir to ffw_init --- pdf2htmlEX/src/util/ffw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index 05b6385..901b508 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -70,6 +70,7 @@ static void dumb_post_error(const char * title, const char * error, ...) { } void ffw_init(int debug) { ffwSetAction("initialize"); + FindProgDir(NULL); InitSimpleStuff(); if ( default_encoding==NULL ) default_encoding=FindOrMakeEncoding("ISO8859-1"); From 1e7355f6fc50561a07f57ad3fa58921c56b42b43 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 10 Dec 2019 18:49:12 +0000 Subject: [PATCH 134/269] added gutils lib --- pdf2htmlEX/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 22c3906..68d77c7 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -59,6 +59,7 @@ endif() pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.0) include_directories(${FONTFORGE_INCLUDE_DIRS}) link_directories(${FONTFORGE_LIBRARY_DIRS}) +set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES} -lgutils) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES}) # debug build flags (overwrite default cmake debug flags) From 76c64a3c2a739692528360ccb6326c5b9b15121e Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 11 Dec 2019 10:06:31 +0000 Subject: [PATCH 135/269] now use argv0 to initialize ffw --- pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h | 2 +- pdf2htmlEX/src/HTMLRenderer/general.cc | 4 ++-- pdf2htmlEX/src/pdf2htmlEX.cc | 2 +- pdf2htmlEX/src/util/ffw.c | 6 ++++-- pdf2htmlEX/src/util/ffw.h | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h b/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h index a1195e8..c71d282 100644 --- a/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h +++ b/pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h @@ -75,7 +75,7 @@ namespace pdf2htmlEX { struct HTMLRenderer : OutputDev { - HTMLRenderer(Param & param); + HTMLRenderer(const char* progPath, Param & param); virtual ~HTMLRenderer(); void process(PDFDoc * doc); diff --git a/pdf2htmlEX/src/HTMLRenderer/general.cc b/pdf2htmlEX/src/HTMLRenderer/general.cc index 459e091..7d43d13 100644 --- a/pdf2htmlEX/src/HTMLRenderer/general.cc +++ b/pdf2htmlEX/src/HTMLRenderer/general.cc @@ -41,7 +41,7 @@ using std::abs; using std::cerr; using std::endl; -HTMLRenderer::HTMLRenderer(Param & param) +HTMLRenderer::HTMLRenderer(const char* progPath, Param & param) :OutputDev() ,param(param) ,html_text_page(param, all_manager) @@ -56,7 +56,7 @@ HTMLRenderer::HTMLRenderer(Param & param) globalParams->setErrQuiet(true); } - ffw_init(param.debug); + ffw_init(progPath, param.debug); cur_mapping.resize(0x10000); cur_mapping2.resize(0x100); diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index 9191489..7f3b7e6 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -439,7 +439,7 @@ int main(int argc, char **argv) param.last_page = min(max(param.last_page, param.first_page), doc->getNumPages()); - unique_ptr(new HTMLRenderer(param))->process(doc); + unique_ptr(argv[0], new HTMLRenderer(param))->process(doc); finished = true; } diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index 901b508..fabfab9 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -19,6 +19,7 @@ #include "SignalHandler.h" #include "ffw.h" +#include "gfile.h" #include "fontforge-version-extras.h" // needed for FONTFORGE_GIT_VERSION #include "fontforge-20190801/autowidth.h" #include "fontforge-20190801/bitmapchar.h" @@ -67,10 +68,11 @@ static void dumb_logwarning(const char * format, ...) { } static void dumb_post_error(const char * title, const char * error, ...) { } -void ffw_init(int debug) +void ffw_init(const char* progPath, int debug) { ffwSetAction("initialize"); - FindProgDir(NULL); + char *localProgPath = strdup(progPath); + FindProgDir(localProgPath); InitSimpleStuff(); if ( default_encoding==NULL ) default_encoding=FindOrMakeEncoding("ISO8859-1"); diff --git a/pdf2htmlEX/src/util/ffw.h b/pdf2htmlEX/src/util/ffw.h index 5ce70e9..1e5e35f 100644 --- a/pdf2htmlEX/src/util/ffw.h +++ b/pdf2htmlEX/src/util/ffw.h @@ -21,7 +21,7 @@ extern "C" { //////////////////////// // global -void ffw_init(int debug); +void ffw_init(const char* progPath, int debug); void ffw_finalize(void); typedef struct ffw_version_info { From 7eea4d601d9ae4141120ae74de5097ff6b33bc94 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 11 Dec 2019 17:23:14 +0000 Subject: [PATCH 136/269] corrected missplaced argv0 --- pdf2htmlEX/src/pdf2htmlEX.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index 7f3b7e6..3223752 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -439,7 +439,7 @@ int main(int argc, char **argv) param.last_page = min(max(param.last_page, param.first_page), doc->getNumPages()); - unique_ptr(argv[0], new HTMLRenderer(param))->process(doc); + unique_ptr(new HTMLRenderer(argv[0], param))->process(doc); finished = true; } From e5e9b9933f8a206b138f85df6ee179b1de02aa04 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 08:05:14 +0000 Subject: [PATCH 137/269] updated comments for fontforge-20190801 include files --- pdf2htmlEX/src/util/ffw.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index fabfab9..ef09364 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -18,21 +18,21 @@ #include "SignalHandler.h" -#include "ffw.h" -#include "gfile.h" -#include "fontforge-version-extras.h" // needed for FONTFORGE_GIT_VERSION -#include "fontforge-20190801/autowidth.h" -#include "fontforge-20190801/bitmapchar.h" -#include "fontforge-20190801/cvimages.h" -#include "fontforge-20190801/encoding.h" -#include "fontforge-20190801/fvfonts.h" -#include "fontforge-20190801/namelist.h" -#include "fontforge-20190801/savefont.h" -#include "fontforge-20190801/splineorder2.h" -#include "fontforge-20190801/splineutil.h" -#include "fontforge-20190801/splineutil2.h" -#include "fontforge-20190801/start.h" -#include "fontforge-20190801/tottf.h" +#include "ffw.h" // needed for: +#include "gfile.h" // FindProgDir +#include "fontforge-version-extras.h" // FONTFORGE_GIT_VERSION +#include "fontforge-20190801/autowidth.h" // FVRemoveKerns +#include "fontforge-20190801/bitmapchar.h" // SFReplaceEncodingBDFProps +#include "fontforge-20190801/cvimages.h" // FVImportImages +#include "fontforge-20190801/encoding.h" // (helpful as we have a name conflict) +#include "fontforge-20190801/fvfonts.h" // SFFindSlot +#include "fontforge-20190801/namelist.h" // UniFromName +#include "fontforge-20190801/savefont.h" // GenerateScript +#include "fontforge-20190801/splineorder2.h" // SFConvertToOrder2 +#include "fontforge-20190801/splineutil.h" // AltUniFree +#include "fontforge-20190801/splineutil2.h" // SplineFontNew +#include "fontforge-20190801/start.h" // InitSimpleStuff +#include "fontforge-20190801/tottf.h" // SFDefaultOS2Info static real EPS=1e-6; From 0344f5121de96446083bd1a4f583135f400d6eae Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 09:05:16 +0000 Subject: [PATCH 138/269] allowed uploadImages to be executed by all local users --- buildScripts/uploadImages | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 buildScripts/uploadImages diff --git a/buildScripts/uploadImages b/buildScripts/uploadImages old mode 100644 new mode 100755 From 53bba3d3e7178f5e8759bdcc33a5665b05d3181f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 09:20:31 +0000 Subject: [PATCH 139/269] begun work on updating pdf2htmlEX to poppler-0.83.0 --- buildScripts/buildInstallLocally | 2 +- buildScripts/getPdf2htmlEX | 2 +- .../3rdparty/poppler/git/CairoFontEngine.cc | 5 +++-- .../3rdparty/poppler/git/CairoFontEngine.h | 4 ++-- .../3rdparty/poppler/git/CairoOutputDev.cc | 21 +++++++++---------- .../3rdparty/poppler/git/CairoOutputDev.h | 12 +++++------ .../3rdparty/poppler/git/CairoRescaleBox.cc | 6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally index 4c15ffe..419c9c9 100755 --- a/buildScripts/buildInstallLocally +++ b/buildScripts/buildInstallLocally @@ -10,7 +10,7 @@ export MAKE_PARALLEL="-j $(nproc)" # choose one of the following... # -export PDF2HTMLEX_BRANCH=fontforge-update +export PDF2HTMLEX_BRANCH=update-poppler # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" ################ diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEX index 7075601..abc7e18 100755 --- a/buildScripts/getPdf2htmlEX +++ b/buildScripts/getPdf2htmlEX @@ -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/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc index 3a479e4..bcfa095 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc @@ -36,8 +36,9 @@ // //======================================================================== -#include +#include +#include "config.h" #include #include "CairoFontEngine.h" #include "CairoOutputDev.h" @@ -90,7 +91,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 2a55af1..34802c1 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 @@ public: 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 846c81a..28f3ae6 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc @@ -38,7 +38,7 @@ // //======================================================================== -#include +#include #include #include @@ -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 @@ finish: 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 @@ private: GfxRGB *lookup; int width; GfxImageColorMap *colorMap; - int *maskColors; + const int *maskColors; int current_row; bool imageError; @@ -3078,7 +3077,7 @@ public: 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 0fbbf0d..9e6f497 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h @@ -192,13 +192,13 @@ public: 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 @@ public: 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 @@ public: 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 @@ protected: 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 @@ public: 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 2c0e1ed..04b0955 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc @@ -44,7 +44,7 @@ /* This implements a box filter that supports non-integer box sizes */ -#include +#include #include #include @@ -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 */ From 59dcc07638897cd6803d40fe9237b7bc839c146c Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 09:24:01 +0000 Subject: [PATCH 140/269] bumped poppler version --- buildScripts/versionEnvs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 54b12f4..569db01 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 From a8323f1c16ce0eb123f0ba85279a315354674ce4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 11:27:54 +0000 Subject: [PATCH 141/269] initial pass at updating pdf2htmlEX to use poppler-0.83.0 --- pdf2htmlEX/CMakeLists.txt | 6 ++++-- .../CairoBackgroundRenderer.cc | 2 +- .../BackgroundRenderer/CairoBackgroundRenderer.h | 2 +- .../SplashBackgroundRenderer.cc | 2 +- .../SplashBackgroundRenderer.h | 2 +- pdf2htmlEX/src/DrawingTracer.cc | 8 ++++---- pdf2htmlEX/src/DrawingTracer.h | 2 +- pdf2htmlEX/src/HTMLRenderer/HTMLRenderer.h | 4 +++- pdf2htmlEX/src/HTMLRenderer/font.cc | 3 ++- pdf2htmlEX/src/HTMLRenderer/image.cc | 4 +++- pdf2htmlEX/src/HTMLRenderer/text.cc | 2 +- pdf2htmlEX/src/Preprocessor.cc | 2 +- pdf2htmlEX/src/Preprocessor.h | 2 +- pdf2htmlEX/src/pdf2htmlEX.cc | 16 +++++++++++----- pdf2htmlEX/src/util/unicode.cc | 2 +- pdf2htmlEX/src/util/unicode.h | 2 +- 16 files changed, 37 insertions(+), 24 deletions(-) diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 68d77c7..3f65ae7 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 a7eaed8..ae5c809 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 d5c8637..f8bbc07 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h +++ b/pdf2htmlEX/src/BackgroundRenderer/CairoBackgroundRenderer.h @@ -42,7 +42,7 @@ public: 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 be14222..757f0a1 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 55baeb3..b8e07c0 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.h @@ -44,7 +44,7 @@ public: 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 7086565..5d23d42 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 3a0bc88..0d186d0 100644 --- a/pdf2htmlEX/src/DrawingTracer.h +++ b/pdf2htmlEX/src/DrawingTracer.h @@ -65,7 +65,7 @@ public: 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 c71d282..6f2c24c 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 3392a9e..466f691 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 ef51ffc..b4d84cc 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 06df7aa..506f947 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 42318b2..643bbc7 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 d121b59..756993d 100644 --- a/pdf2htmlEX/src/Preprocessor.h +++ b/pdf2htmlEX/src/Preprocessor.h @@ -39,7 +39,7 @@ public: 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 3223752..edf32ee 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 31ec4f8..2ebc88e 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 c789dea..d4a5d48 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 From 1d29159ecbc1e9615c7d4a755b13e3945b4d0a02 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 11:44:20 +0000 Subject: [PATCH 142/269] added build script to list files by change times --- buildScripts/listFilesByChangeTime | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 buildScripts/listFilesByChangeTime diff --git a/buildScripts/listFilesByChangeTime b/buildScripts/listFilesByChangeTime new file mode 100755 index 0000000..e88213f --- /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- From 4007aa64e544ed9b051ef822f5417b7f55748514 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 12:06:45 +0000 Subject: [PATCH 143/269] corrected 3rdParty poppler files --- pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc | 3 +-- pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc | 2 +- pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc index bcfa095..776b6de 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc @@ -36,9 +36,8 @@ // //======================================================================== -#include +#include -#include "config.h" #include #include "CairoFontEngine.h" #include "CairoOutputDev.h" diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc index 28f3ae6..0f3c156 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc @@ -38,7 +38,7 @@ // //======================================================================== -#include +#include #include #include diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc index 04b0955..1c7ccd1 100644 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc +++ b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc @@ -44,7 +44,7 @@ /* This implements a box filter that supports non-integer box sizes */ -#include +#include #include #include From 99fc35b8b517f6332633fbc6d08346266ea567d7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 13:44:50 +0000 Subject: [PATCH 144/269] corrected font forge build --- buildScripts/buildFontforge | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 9df9001..a2f75b3 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 "" From c75471f1315aad0a6b415cfc91ed7187892f8f5f Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 14:26:05 +0000 Subject: [PATCH 145/269] turned travis back on --- .travis.yml.off => .travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .travis.yml.off => .travis.yml (100%) diff --git a/.travis.yml.off b/.travis.yml similarity index 100% rename from .travis.yml.off rename to .travis.yml From 34da5a01a0111136db86b6a786c08b7aeea5d024 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 14:33:16 +0000 Subject: [PATCH 146/269] pushed again to force travis --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e86e656..c4bd168 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: From 23830c24f0921e70af006bb57fae93501fadb26b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 13 Dec 2019 21:54:01 +0000 Subject: [PATCH 147/269] corrected travis homebrew to remove python 2 --- buildScripts/travisHomeBrewDoItAll | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index cbc2879..d04f76d 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 From 5fc7d42a1656e3280f0dc336bf1a5a80520bb592 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 06:15:03 +0000 Subject: [PATCH 148/269] added get tools and libraries using both apt and brew --- buildScripts/buildInstallLocally | 41 ------------------- buildScripts/buildInstallLocallyApt | 41 +++++++++++++++++++ buildScripts/buildInstallLocallyBrew | 41 +++++++++++++++++++ .../{getBuildTools => getBuildToolsApt} | 0 buildScripts/getBuildToolsBrew | 24 +++++++++++ .../{getDevLibraries => getDevLibrariesApt} | 0 buildScripts/getDevLibrariesBrew | 21 ++++++++++ buildScripts/getPoppler | 8 ++++ 8 files changed, 135 insertions(+), 41 deletions(-) delete mode 100755 buildScripts/buildInstallLocally create mode 100755 buildScripts/buildInstallLocallyApt create mode 100755 buildScripts/buildInstallLocallyBrew rename buildScripts/{getBuildTools => getBuildToolsApt} (100%) create mode 100755 buildScripts/getBuildToolsBrew rename buildScripts/{getDevLibraries => getDevLibrariesApt} (100%) create mode 100755 buildScripts/getDevLibrariesBrew diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally deleted file mode 100755 index 419c9c9..0000000 --- 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=update-poppler -# 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 0000000..49ba59c --- /dev/null +++ b/buildScripts/buildInstallLocallyApt @@ -0,0 +1,41 @@ +#!/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)" + +################ +# 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 0000000..aa32c7c --- /dev/null +++ b/buildScripts/buildInstallLocallyBrew @@ -0,0 +1,41 @@ +#!/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)" + +################ +# 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/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 0000000..1ee11e1 --- /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 100% rename from buildScripts/getDevLibraries rename to buildScripts/getDevLibrariesApt diff --git a/buildScripts/getDevLibrariesBrew b/buildScripts/getDevLibrariesBrew new file mode 100755 index 0000000..0938300 --- /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/getPoppler b/buildScripts/getPoppler index ca25e1c..528cfe4 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 From 45e6d8e80b1b79eccaec4c921c38a4f4f777177d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:01:02 +0000 Subject: [PATCH 149/269] updated how poppler-data in built --- buildScripts/buildPoppler | 4 ++++ buildScripts/createAppImage | 6 +++++- buildScripts/createDockerImage | 6 +++++- buildScripts/getDevLibrariesApt | 1 - 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 52df3e9..baf305b 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -14,3 +14,7 @@ cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ -DENABLE_LIBOPENJPEG=none .. make $MAKE_PARALLEL + +cd ../../poppler-data + +make install prefix=/usr/local diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 4ebebd6..6fe9eb8 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 DESTDIR=../../imageBuild/appDir + +cd ../imageBuild # force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig) # diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 71e2287..e31daa4 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 DESTDIR=../../imageBuild/dockerDir + + cd ../imageBuild/dockerDir copy_deps diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibrariesApt index dadc2e4..ce518a2 100755 --- a/buildScripts/getDevLibrariesApt +++ 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 \ From c46d2ad73347821447ce96604e0bb0b8293114b7 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:06:00 +0000 Subject: [PATCH 150/269] create getPdf2htmlEXBrew for home/linux brew users --- .../{getPdf2htmlEX => getPdf2htmlEXApt} | 0 buildScripts/getPdf2htmlEXBrew | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+) rename buildScripts/{getPdf2htmlEX => getPdf2htmlEXApt} (100%) create mode 100755 buildScripts/getPdf2htmlEXBrew diff --git a/buildScripts/getPdf2htmlEX b/buildScripts/getPdf2htmlEXApt similarity index 100% rename from buildScripts/getPdf2htmlEX rename to buildScripts/getPdf2htmlEXApt diff --git a/buildScripts/getPdf2htmlEXBrew b/buildScripts/getPdf2htmlEXBrew new file mode 100755 index 0000000..4754fe0 --- /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 From 8f496afa8b894167386bb3997e647973ed6331e4 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:23:39 +0000 Subject: [PATCH 151/269] refactored install directory to PDF2HTMLEX_PREFIX --- buildScripts/buildFontforge | 2 +- buildScripts/buildInstallLocallyApt | 2 ++ buildScripts/buildInstallLocallyBrew | 2 ++ buildScripts/buildPdf2htmlEX | 2 +- buildScripts/buildPdf2htmlEXClang | 2 +- buildScripts/buildPoppler | 6 +----- buildScripts/createAppImage | 10 +++++----- buildScripts/createDockerImage | 2 +- buildScripts/installPoppler | 23 ++++++++++++++--------- 9 files changed, 28 insertions(+), 23 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index a2f75b3..c41fd68 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -40,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/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 49ba59c..75b45bd 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -13,6 +13,8 @@ export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH=update-poppler # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +export PDF2HTMLEX_PREFIX=/usr/local + ################ # do the build diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew index aa32c7c..1cb4849 100755 --- a/buildScripts/buildInstallLocallyBrew +++ b/buildScripts/buildInstallLocallyBrew @@ -13,6 +13,8 @@ export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH=update-poppler # export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +export PDF2HTMLEX_PREFIX=toBeDetermined + ################ # do the build diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index 1d49382..cf6dd00 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 3ea3a3f..eb65509 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 baf305b..9845412 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -11,10 +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 - -cd ../../poppler-data - -make install prefix=/usr/local diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 6fe9eb8..796567a 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -41,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 e31daa4..a075492 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -62,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/installPoppler b/buildScripts/installPoppler index 2ae5b15..42ce6ce 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 + From f7295b7388ac366ba769fedfd310045ec76a51ed Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:44:24 +0000 Subject: [PATCH 152/269] put pdf2htmlex_prefix into reSourceVersionEnvs --- buildScripts/buildInstallLocallyApt | 2 ++ buildScripts/buildInstallLocallyBrew | 2 ++ buildScripts/reportEnvs | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 75b45bd..8e6537f 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -15,6 +15,8 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=/usr/local +echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs + ################ # do the build diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew index 1cb4849..3147fad 100755 --- a/buildScripts/buildInstallLocallyBrew +++ b/buildScripts/buildInstallLocallyBrew @@ -15,6 +15,8 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=toBeDetermined +echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs + ################ # do the build diff --git a/buildScripts/reportEnvs b/buildScripts/reportEnvs index 941d538..d49fedf 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:" From 64531afddaff4f4c8904834820ffe64a4fbdac91 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 16:48:24 +0000 Subject: [PATCH 153/269] refactored build prefix --- buildScripts/buildInstallLocallyApt | 2 -- buildScripts/buildInstallLocallyBrew | 2 -- buildScripts/versionEnvs | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 8e6537f..75b45bd 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -15,8 +15,6 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=/usr/local -echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs - ################ # do the build diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew index 3147fad..1cb4849 100755 --- a/buildScripts/buildInstallLocallyBrew +++ b/buildScripts/buildInstallLocallyBrew @@ -15,8 +15,6 @@ export PDF2HTMLEX_BRANCH=update-poppler export PDF2HTMLEX_PREFIX=toBeDetermined -echo "export PDF2HTMLEX_PREFIX=\"$PDF2HTMLEX_PREFIX\"" >> buildScripts/reSourceVersionEnvs - ################ # do the build diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 569db01..77b3597 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -32,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 From b4df602953bac9d6dac43ed8bd3a9a4dc5c24a37 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 17:24:05 +0000 Subject: [PATCH 154/269] continued work on the use of prefix --- buildScripts/buildInstallLocallyApt | 4 ++++ buildScripts/createAppImage | 2 +- buildScripts/createDockerImage | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 75b45bd..72aeced 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -13,6 +13,10 @@ export MAKE_PARALLEL="-j $(nproc)" 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 ################ diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 796567a..77c5b25 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -27,7 +27,7 @@ make install DESTDIR=../../imageBuild/appDir cd ../../poppler-data -make install DESTDIR=../../imageBuild/appDir +make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/appDir cd ../imageBuild diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index a075492..9858825 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -50,7 +50,7 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi cd ../../poppler-data - make install DESTDIR=../../imageBuild/dockerDir + make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/dockerDir cd ../imageBuild/dockerDir From 8d6e9636ad8e1e80923e5c2a6b542e44e54a4c2d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 17 Dec 2019 17:45:56 +0000 Subject: [PATCH 155/269] updated image creation for poppler-data --- buildScripts/createAppImage | 2 +- buildScripts/createDockerImage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 77c5b25..360d0fd 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -27,7 +27,7 @@ make install DESTDIR=../../imageBuild/appDir cd ../../poppler-data -make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/appDir +make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/appDir cd ../imageBuild diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 9858825..aca0d3a 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -50,7 +50,7 @@ echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersi cd ../../poppler-data - make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../../imageBuild/dockerDir + make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/dockerDir cd ../imageBuild/dockerDir From 1456c255bf41354b2d523ef3f90334d590ada92b Mon Sep 17 00:00:00 2001 From: stephengaito <1078196+stephengaito@users.noreply.github.com> Date: Thu, 28 May 2020 08:11:20 +0100 Subject: [PATCH 156/269] updated .gitignore to ignore imageBuild poppler-data and reSourceVersionEvns buildScript --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index c082415..c855e82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +imageBuild +poppler-data +buildScripts/reSourceVersionEnvs brewFormula fontforge *.tar.* From 124cae5d21c0b6dde09c61248041b892759f53e2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 May 2020 10:59:27 +0000 Subject: [PATCH 157/269] updated createAppImage and createDockerImage scripts to be able to work inside a docker container --- buildScripts/createAppImage | 19 ++++++-- buildScripts/createDockerImage | 79 ++++++++++++++++++---------------- 2 files changed, 57 insertions(+), 41 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 360d0fd..1cb86d2 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -41,11 +41,22 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LI chmod a+x $LINUX_DEPLOY_APP_IMAGE -./$LINUX_DEPLOY_APP_IMAGE \ +if [ -f /.dockerenv ] ; then + # WE ARE INSIDE A DOCKER CONTAINER... + # + # We explicilty extract the appimage to a squashfs to allow it to be used + # inside Docker containers + # + ./$LINUX_DEPLOY_APP_IMAGE --appimage-extract + # + LINUX_DEPLOY_APP_IMAGE=squashfs-root/AppRun +fi + +./$LINUX_DEPLOY_APP_IMAGE \ -e appDir/$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX \ - --create-desktop-file \ - -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ - --appdir=appDir \ + --create-desktop-file \ + -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ + --appdir=appDir \ --output appimage diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index aca0d3a..52321b7 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -8,53 +8,58 @@ echo "CREATING pdf2htmlEX Docker Image" echo "-------------------------------------------------------------------" echo "" -if [ -x "$(which docker)" ]; then +# Collect everything that will be needed... - source buildScripts/reSourceVersionEnvs +source buildScripts/reSourceVersionEnvs - source buildScripts/dockerFunctions +source buildScripts/dockerFunctions + + +mkdir -p imageBuild/dockerDir + +cd pdf2htmlEX/build + +sudo rm -rf install_manifest.txt + +make install DESTDIR=../../imageBuild/dockerDir + +cd ../../poppler-data + +make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/dockerDir + +cd ../imageBuild/dockerDir + +copy_deps + +# Now. IF we have docker, THEN build the docker image... + + if [ -x "$(which docker)" ]; then -if [ -z "$DOCKER_FROM" ]; then - echo "" - read -p "Enter the docker image for the 'from' base: " DOCKER_FROM - echo "" if [ -z "$DOCKER_FROM" ]; then - echo "DOCKER_FROM not set... so we can not build the docker image" - exit 1 + echo "" + read -p "Enter the docker image for the 'from' base: " DOCKER_FROM + echo "" + if [ -z "$DOCKER_FROM" ]; then + echo "DOCKER_FROM not set... so we can not build the docker image" + exit 1 + fi fi -fi -if [ -z "$DOCKER_USERNAME" ]; then - echo "" - read -p "Enter a docker username: " DOCKER_USERNAME - echo "" if [ -z "$DOCKER_USERNAME" ]; then - echo "DOCKER_USERNAME not set... so we can not build the docker image" - exit 1 + echo "" + read -p "Enter a docker username: " DOCKER_USERNAME + echo "" + if [ -z "$DOCKER_USERNAME" ]; then + echo "DOCKER_USERNAME not set... so we can not build the docker image" + exit 1 + fi fi -fi -export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME" + export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME" -echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs -echo "export DOCKER_USERNAME=\"$DOCKER_USERNAME\"" >> buildScripts/reSourceVersionEnvs -echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs - - mkdir -p imageBuild/dockerDir - - cd pdf2htmlEX/build - - sudo rm -rf install_manifest.txt - - make install DESTDIR=../../imageBuild/dockerDir - - cd ../../poppler-data - - make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/dockerDir - - cd ../imageBuild/dockerDir - - copy_deps + echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> buildScripts/reSourceVersionEnvs + echo "export DOCKER_USERNAME=\"$DOCKER_USERNAME\"" >> buildScripts/reSourceVersionEnvs + echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> buildScripts/reSourceVersionEnvs delete_blacklisted From 6ff6689d9f3b5609a3e6b9a715fe824d315001c5 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 May 2020 11:42:35 +0000 Subject: [PATCH 158/269] minor correction to createDockerImage --- buildScripts/createDockerImage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 52321b7..c33f74d 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -33,7 +33,7 @@ copy_deps # Now. IF we have docker, THEN build the docker image... - if [ -x "$(which docker)" ]; then +if [ -x "$(which docker)" ]; then if [ -z "$DOCKER_FROM" ]; then echo "" From 0cfb9720ab36a503a756ade663d7ae00d28d3fe0 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 May 2020 06:58:52 +0100 Subject: [PATCH 159/269] added new poppler and fontforge release targets --- buildScripts/versionEnvs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 77b3597..3412c83 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -3,11 +3,28 @@ # This bash script exports environment variables for the latest software # versions +# see: https://poppler.freedesktop.org/releases.html +# current working: 0.83.0 + +#export POPPLER_VERSION=poppler-0.89.0 +#export POPPLER_VERSION=poppler-0.88.0 +#export POPPLER_VERSION=poppler-0.87.0 +#export POPPLER_VERSION=poppler-0.86.1 +#export POPPLER_VERSION=poppler-0.86.0 +#export POPPLER_VERSION=poppler-0.85.0 +#export POPPLER_VERSION=poppler-0.84.0 export POPPLER_VERSION=poppler-0.83.0 #export POPPLER_VERSION=poppler-0.82.0 #export POPPLER_VERSION=poppler-0.81.0 +# see: https://github.com/fontforge/fontforge/releases +# current working: 20190801 + +#export FONTFORGE_VERSION=20200314 export FONTFORGE_VERSION=20190801 +#export FONTFORGE_VERSION=20190413 +#export FONTFORGE_VERSION=20190413 +#export FONTFORGE_VERSION=20190317 #export FONTFORGE_VERSION=20170731 if [ -z "$PDF2HTMLEX_BRANCH" ]; then From 83ec96f0e3778961e7a3f1ee9bc7d741c3b59b7a Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 May 2020 15:48:42 +0000 Subject: [PATCH 160/269] initial attempt at building poppler and fontforge statically and linking into pdf2html --- buildScripts/buildFontforge | 9 +- buildScripts/buildInstallLocallyApt | 4 +- buildScripts/buildPoppler | 8 +- buildScripts/getPoppler | 2 + pdf2htmlEX/CMakeLists.txt | 63 ++++- pdf2htmlEX/src/util/ffw.c | 24 +- .../src/util/fontforge-20190801/Readme.md | 26 --- .../src/util/fontforge-20190801/autowidth.h | 81 ------- .../src/util/fontforge-20190801/bitmapchar.h | 24 -- .../src/util/fontforge-20190801/cvimages.h | 22 -- .../src/util/fontforge-20190801/encoding.h | 85 ------- .../src/util/fontforge-20190801/fvfonts.h | 34 --- .../src/util/fontforge-20190801/namelist.h | 20 -- .../src/util/fontforge-20190801/savefont.h | 80 ------- .../util/fontforge-20190801/splineorder2.h | 29 --- .../src/util/fontforge-20190801/splineutil.h | 217 ------------------ .../src/util/fontforge-20190801/splineutil2.h | 85 ------- .../src/util/fontforge-20190801/start.h | 8 - .../src/util/fontforge-20190801/tottf.h | 33 --- 19 files changed, 83 insertions(+), 771 deletions(-) delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/Readme.md delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/autowidth.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/bitmapchar.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/cvimages.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/encoding.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/fvfonts.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/namelist.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/savefont.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/splineorder2.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/splineutil.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/splineutil2.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/start.h delete mode 100644 pdf2htmlEX/src/util/fontforge-20190801/tottf.h diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index c41fd68..0dad173 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -39,11 +39,16 @@ cd fontforge ./bootstrap -./configure \ +./configure \ --prefix=$PDF2HTMLEX_PREFIX \ --enable-python-scripting=3 \ --disable-dependency-tracking \ - --disable-silent-rules \ + --disable-silent-rules \ + --disable-python-scripting \ + --disable-python-extension \ + --disable-shared \ + --enable-static \ + --with-pic \ --without-x # Apply any patches required for fontforge raw sources before we make diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 72aeced..608a16d 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -34,13 +34,13 @@ export PDF2HTMLEX_PREFIX=/usr/local ./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } -./buildScripts/installPoppler || { echo 'installPoppler 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/installFontforge || { echo 'installFontforge FAILED' ; exit 1 ; } ./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 9845412..6375760 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -11,6 +11,10 @@ echo "" cd poppler mkdir build cd build -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX \ - -DENABLE_LIBOPENJPEG=none .. +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX \ + -DENABLE_LIBOPENJPEG=none \ + .. make $MAKE_PARALLEL diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index 528cfe4..6314ef8 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -16,6 +16,8 @@ echo "Getting poppler version: $POPPLER_VERSION" rm -rf $POPPLER_VERSION.tar.xz rm -rf poppler +rm -rf poppler-data-0.4.9.tar.gz +rm -rf poppler-data wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 3f65ae7..7cb7cd0 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -20,10 +20,24 @@ add_custom_target(dist find_package(PkgConfig) -pkg_check_modules(POPPLER REQUIRED poppler>=0.81.0) -include_directories(${POPPLER_INCLUDE_DIRS}) -link_directories(${POPPLER_LIBRARY_DIRS}) -set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES}) +# SINCE we have a very intimate relationship with a particular version of +# poppler... we explicitly describe the poppler include and library +# paths. + +include_directories( + ../poppler/build/poppler + ../poppler/build + ../poppler/poppler + ../poppler +) + +#link_directories( +# ../poppler/build +#) +set(POPPLER_LIBRARIES ${POPPLER_LIBRARIES} + ${CMAKE_SOURCE_DIR}/../poppler/build/libpoppler.a + ${CMAKE_SOURCE_DIR}/../poppler/build/glib/libpoppler-glib.a +) if(ENABLE_SVG) pkg_check_modules(CAIRO REQUIRED cairo>=1.10.0) @@ -54,13 +68,44 @@ if(ENABLE_SVG) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FREETYPE_LIBRARIES}) endif() -# fontforge starts using pkg-config 'correctly' since 2.0.0 -#pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.20170731) -pkg_check_modules(FONTFORGE REQUIRED libfontforge>=2.0.0) +# SINCE we have a very intimate relationship with a particular version of +# fontforge... we explicitly describe the fontforge include and library +# paths. + +include_directories( + ../fontforge/fontforge + ../fontforge + ../fontforge/build/inc + ../fontforge/inc +) + include_directories(${FONTFORGE_INCLUDE_DIRS}) link_directories(${FONTFORGE_LIBRARY_DIRS}) -set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES} -lgutils) -set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FONTFORGE_LIBRARIES}) +set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES} + ${CMAKE_SOURCE_DIR}/../fontforge/fontforge/.libs/libfontforge.a + ${CMAKE_SOURCE_DIR}/../fontforge/Unicode/.libs/libgunicode.a + ${CMAKE_SOURCE_DIR}/../fontforge/gutils/.libs/libgutils.a +) + +set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} + ${POPPLER_LIBRARIES} + ${FONTFORGE_LIBRARIES} + -lfreetype + -lfontconfig + -ljpeg + -lz + -llcms2 + -lpng + -lz + -llcms2 + -pthread + -lspiro + -luninameslist + -lm + -lxml2 + -lglib-2.0 + -lgio-2.0 +) # debug build flags (overwrite default cmake debug flags) set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg") diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index ef09364..9dc1d0a 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -21,18 +21,18 @@ #include "ffw.h" // needed for: #include "gfile.h" // FindProgDir #include "fontforge-version-extras.h" // FONTFORGE_GIT_VERSION -#include "fontforge-20190801/autowidth.h" // FVRemoveKerns -#include "fontforge-20190801/bitmapchar.h" // SFReplaceEncodingBDFProps -#include "fontforge-20190801/cvimages.h" // FVImportImages -#include "fontforge-20190801/encoding.h" // (helpful as we have a name conflict) -#include "fontforge-20190801/fvfonts.h" // SFFindSlot -#include "fontforge-20190801/namelist.h" // UniFromName -#include "fontforge-20190801/savefont.h" // GenerateScript -#include "fontforge-20190801/splineorder2.h" // SFConvertToOrder2 -#include "fontforge-20190801/splineutil.h" // AltUniFree -#include "fontforge-20190801/splineutil2.h" // SplineFontNew -#include "fontforge-20190801/start.h" // InitSimpleStuff -#include "fontforge-20190801/tottf.h" // SFDefaultOS2Info +#include "fontforge/autowidth.h" // FVRemoveKerns +#include "fontforge/bitmapchar.h" // SFReplaceEncodingBDFProps +#include "fontforge/cvimages.h" // FVImportImages +#include "fontforge/encoding.h" // (helpful as we have a name conflict) +#include "fontforge/fvfonts.h" // SFFindSlot +#include "fontforge/namelist.h" // UniFromName +#include "fontforge/savefont.h" // GenerateScript +#include "fontforge/splineorder2.h" // SFConvertToOrder2 +#include "fontforge/splineutil.h" // AltUniFree +#include "fontforge/splineutil2.h" // SplineFontNew +#include "fontforge/start.h" // InitSimpleStuff +#include "fontforge/tottf.h" // SFDefaultOS2Info static real EPS=1e-6; diff --git a/pdf2htmlEX/src/util/fontforge-20190801/Readme.md b/pdf2htmlEX/src/util/fontforge-20190801/Readme.md deleted file mode 100644 index 2cd385b..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/Readme.md +++ /dev/null @@ -1,26 +0,0 @@ -# FontForge: the missing headers - -The FontForge header files in this directory are taken from the -FontForge-20190801 release. - -They are headers which are not usually installed by the FontForge make -system. - - -## Required headers - -- `autowidth.h` required for FVRemoveKerns -- `bitmapchar.h` required for SFReplaceEncodingBDFProps -- `cvimages.h` required for FVImportImages -- `fvfonts.h` required for SFFindSlot -- `namelist.h` required for UniFromName -- `savefont.h` required for GenerateScript -- `splineorder2.h` required for SFConvertToOrder2 -- `splineutil.h` required for AltUniFree -- `splineutil2.h` required for SplineFontNew -- `start.h` required for InitSimpleStuff -- `tottf.h` required for SFDefaultOS2Info - -## Helpful headers - -- `encoding.h` conflicts with an existing header in the src/util directory. diff --git a/pdf2htmlEX/src/util/fontforge-20190801/autowidth.h b/pdf2htmlEX/src/util/fontforge-20190801/autowidth.h deleted file mode 100644 index 4f97778..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/autowidth.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef FONTFORGE_AUTOWIDTH_H -#define FONTFORGE_AUTOWIDTH_H - -#include "baseviews.h" -#include "splinefont.h" - -struct charone { - real lbearing, rmax; - real newl, newr; - int baseserif, lefttops, righttops; /* serif zones which affect this character */ - SplineChar *sc; - int base, top; /* bottom of character, number of decimation zones we've got */ - short *ledge; - short *redge; - struct charpair *asleft; - struct charpair *asright; -}; - -struct charpair { - struct charone *left, *right; - struct charpair *nextasleft, *nextasright; - int base, top; - short *distances; - short visual; -}; - -typedef struct widthinfo { - real spacing; /* desired spacing between letters */ - real decimation; - real serifsize; - real seriflength; - real caph; - real descent; - real xheight; - real n_stem_exterior_width, n_stem_interior_width; - real current_I_spacing; - int serifs[4][2]; /* Four serif zones: descent, baseline, xheight, cap */ - int lcnt, rcnt; /* count of left and right chars respectively */ - int real_lcnt, real_rcnt; /* what the user asked for. We might add I */ - int tcnt; /* sum of r+l cnt */ - int pcnt; /* pair count, often r*l cnt */ - int l_Ipos, r_Ipos; - struct charone **left, **right; - struct charpair **pairs; - int space_guess; - int threshold; - SplineFont *sf; - FontViewBase *fv; - int layer; - unsigned int done: 1; - unsigned int autokern: 1; - unsigned int onlynegkerns: 1; - struct lookup_subtable *subtable; -} WidthInfo; - -#define NOTREACHED -9999.0 - -extern struct charone *AW_MakeCharOne(SplineChar *sc); -extern void AW_InitCharPairs(WidthInfo *wi); -extern void AW_FreeCharList(struct charone **list); -extern void AW_FreeCharPairs(struct charpair **list, int cnt); -extern void AW_ScriptSerifChecker(WidthInfo *wi); -extern int AW_ReadKernPairFile(char *fn,WidthInfo *wi); -extern void AW_BuildCharPairs(WidthInfo *wi); -extern void AW_AutoKern(WidthInfo *wi); -extern void AW_AutoWidth(WidthInfo *wi); -extern void AW_FindFontParameters(WidthInfo *wi); -extern void AW_KernRemoveBelowThreshold(SplineFont *sf,int threshold); - -extern SplineFont *aw_old_sf; -extern int aw_old_spaceguess; - -extern int AutoKernScript(FontViewBase *fv, int spacing, int threshold, struct lookup_subtable *sub, char *kernfile); -extern int AutoWidthScript(FontViewBase *fv, int spacing); -extern int KernThreshold(SplineFont *sf, int cnt); -extern real SFGuessItalicAngle(SplineFont *sf); -extern void FVRemoveKerns(FontViewBase *fv); -extern void FVRemoveVKerns(FontViewBase *fv); -extern void FVVKernFromHKern(FontViewBase *fv); - -#endif /* FONTFORGE_AUTOWIDTH_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/bitmapchar.h b/pdf2htmlEX/src/util/fontforge-20190801/bitmapchar.h deleted file mode 100644 index 430086b..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/bitmapchar.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef FONTFORGE_BITMAPCHAR_H -#define FONTFORGE_BITMAPCHAR_H - -#include "splinefont.h" -#include "uiinterface.h" - -extern BDFChar *BDFMakeChar(BDFFont *bdf, EncMap *map, int enc); -extern BDFChar *BDFMakeGID(BDFFont *bdf, int gid); -extern BDFProperties *BdfPropsCopy(BDFProperties *props, int cnt); -extern const char *BdfPropHasString(BDFFont *font, const char *key, const char *def); -extern int BdfPropHasInt(BDFFont *font, const char *key, int def); -extern int IsUnsignedBDFKey(const char *key); -extern void BCClearAll(BDFChar *bc); -extern void BDFDefaultProps(BDFFont *bdf, EncMap *map, int res); -extern void Default_Properties(BDFFont *bdf, EncMap *map, char *onlyme); -extern void Default_XLFD(BDFFont *bdf, EncMap *map, int res); -extern void def_Charset_Enc(EncMap *map, char *reg, char *enc); -extern void FF_SetBCInterface(struct bc_interface *bci); -extern void SFReplaceEncodingBDFProps(SplineFont *sf, EncMap *map); -extern void SFReplaceFontnameBDFProps(SplineFont *sf); -extern void XLFD_CreateComponents(BDFFont *font, EncMap *map, int res, struct xlfd_components *components); -extern void XLFD_GetComponents(const char *xlfd, struct xlfd_components *components); - -#endif /* FONTFORGE_BITMAPCHAR_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/cvimages.h b/pdf2htmlEX/src/util/fontforge-20190801/cvimages.h deleted file mode 100644 index 7c77e43..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/cvimages.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef FONTFORGE_CVIMAGES_H -#define FONTFORGE_CVIMAGES_H - -#include "baseviews.h" -#include "gimage.h" -#include "sd.h" -#include "splinefont.h" - -extern GImage *ImageAlterClut(GImage *image); -extern int FVImportImages(FontViewBase *fv, char *path, int format, int toback, int flags); -extern int FVImportImageTemplate(FontViewBase *fv, char *path, int format, int toback, int flags); -extern void SCAddScaleImage(SplineChar *sc, GImage *image, int doclear, int layer); -extern void SCAppendEntityLayers(SplineChar *sc, Entity *ent); -extern void SCImportFig(SplineChar *sc, int layer, char *path, int doclear); -extern void SCImportGlif(SplineChar *sc, int layer, char *path, char *memory, int memlen, int doclear); -extern void SCImportPDFFile(SplineChar *sc, int layer, FILE *pdf, int doclear, int flags); -extern void SCImportPlateFile(SplineChar *sc, int layer, FILE *plate, int doclear); -extern void SCImportPSFile(SplineChar *sc, int layer, FILE *ps, int doclear, int flags); -extern void SCImportSVG(SplineChar *sc, int layer, char *path, char *memory, int memlen, int doclear); -extern void SCInsertImage(SplineChar *sc, GImage *image, real scale, real yoff, real xoff, int layer); - -#endif /* FONTFORGE_CVIMAGES_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/encoding.h b/pdf2htmlEX/src/util/fontforge-20190801/encoding.h deleted file mode 100644 index dff132b..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/encoding.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef FONTFORGE_ENCODING_H -#define FONTFORGE_ENCODING_H - -#include "baseviews.h" -#include "splinefont.h" - -struct cidaltuni { - struct cidaltuni *next; - int uni; - int cid; -}; - -struct cidmap { - char *registry, *ordering; - int supplement, maxsupple; - int cidmax; /* Max cid found in the charset */ - int namemax; /* Max cid with useful info */ - uint32 *unicode; - char **name; - struct cidaltuni *alts; - struct cidmap *next; -}; - -extern struct cidmap *cidmaps; - -extern void DeleteEncoding(Encoding *me); -extern void EncodingFree(Encoding *item); -extern void RemoveMultiples(Encoding *item); -extern char *ParseEncodingFile(char *filename, char *encodingname); -extern char *SFEncodingName(SplineFont *sf, EncMap *map); -extern const char *FindUnicharName(void); -extern EncMap *CompactEncMap(EncMap *map, SplineFont *sf); -extern EncMap *EncMapFromEncoding(SplineFont *sf, Encoding *enc); -extern Encoding *FindOrMakeEncoding(const char *name); -extern Encoding *_FindOrMakeEncoding(const char *name, int make_it); -extern int32 EncFromName(const char *name, enum uni_interp interp, Encoding *encname); -extern int32 EncFromUni(int32 uni, Encoding *enc); -extern int32 UniFromEnc(int enc, Encoding *encname); - -/* The "Encoding" here is a little different from what you normally see*/ -/* It isn't a mapping from a byte stream to unicode, but from an int */ -/* to unicode. If we have an 8/16 encoding (EUC or SJIS) then the */ -/* single byte entries will be numbers less than <256 and the */ -/* multibyte entries will be numbers >=256. So an encoding might be */ -/* valid for the domain [0x20..0x7f] [0xa1a1..0xfefe] */ -/* In other words, we're interested in the ordering displayed in the */ -/* fontview. Nothing else */ -/* The max value need not be exact (though it should be at least as big)*/ -/* if you create a new font with the given encoding, then the font will */ -/* have max slots in it by default */ -/* A return value of -1 (from an EncFunc) indicates no mapping */ -/* AddEncoding returns 1 if the encoding was added, 2 if it replaced */ -/* an existing encoding, 0 if you attempt to replace a builtin */ -/* encoding */ -typedef int (*EncFunc)(int); -extern int AddEncoding(char *name, EncFunc enc_to_uni, EncFunc uni_to_enc, int max); - -extern int CID2NameUni(struct cidmap *map, int cid, char *buffer, int len); -extern int CID2Uni(struct cidmap *map, int cid); -extern int CIDFromName(char *name, SplineFont *cidmaster); -extern int CountOfEncoding(Encoding *encoding_name); -extern int MaxCID(struct cidmap *map); -extern int NameUni2CID(struct cidmap *map, int uni, const char *name); -extern int SFFlattenByCMap(SplineFont **sf, char *cmapname); -extern int SFForceEncoding(SplineFont *sf, EncMap *old, Encoding *new_enc); -extern int SFReencode(SplineFont *sf, const char *encname, int force); -extern SplineFont *CIDFlatten(SplineFont *cidmaster, SplineChar **glyphs, int charcnt); -extern SplineFont *MakeCIDMaster(SplineFont *sf, EncMap *oldmap, int bycmap, char *cmapfilename, struct cidmap *cidmap); -extern struct altuni *CIDSetAltUnis(struct cidmap *map, int cid); -extern struct cidmap *FindCidMap(char *registry, char *ordering, int supplement, SplineFont *sf); -extern struct cidmap *LoadMapFromFile(char *file, char *registry, char *ordering, int supplement); -extern void BDFOrigFixup(BDFFont *bdf, int orig_cnt, SplineFont *sf); -extern void CIDMasterAsDes(SplineFont *sf); -extern void DumpPfaEditEncodings(void); -extern void FVAddEncodingSlot(FontViewBase *fv, int gid); -extern void LoadPfaEditEncodings(void); -extern void MMMatchGlyphs(MMSet *mm); -extern void SFAddEncodingSlot(SplineFont *sf, int gid); -extern void SFAddGlyphAndEncode(SplineFont *sf, SplineChar *sc, EncMap *basemap, int baseenc); -extern void SFEncodeToMap(SplineFont *sf, struct cidmap *map); -extern void SFExpandGlyphCount(SplineFont *sf, int newcnt); -extern void SFMatchGlyphs(SplineFont *sf, SplineFont *target, int addempties); -extern void SFRemoveGlyph(SplineFont *sf, SplineChar *sc); - -#endif /* FONTFORGE_ENCODING_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/fvfonts.h b/pdf2htmlEX/src/util/fontforge-20190801/fvfonts.h deleted file mode 100644 index 304c7a0..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/fvfonts.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef FONTFORGE_FVFONTS_H -#define FONTFORGE_FVFONTS_H - -#include "baseviews.h" -#include "splinefont.h" - -extern AnchorClass *MCConvertAnchorClass(struct sfmergecontext *mc, AnchorClass *ac); -extern BDFChar *BDFCharCopy(BDFChar *bc); -extern int SFCIDFindCID(SplineFont *sf, int unienc, const char *name); -extern int SFCIDFindExistingChar(SplineFont *sf, int unienc, const char *name); -extern int SFFindExistingSlot(SplineFont *sf, int unienc, const char *name); -extern int SFFindGID(SplineFont *sf, int unienc, const char *name); -extern int SFFindSlot(SplineFont *sf, EncMap *map, int unienc, const char *name); -extern int SFHasChar(SplineFont *sf, int unienc, const char *name); -extern int SFHasCID(SplineFont *sf, int cid); -extern PST *PSTCopy(PST *base, SplineChar *sc, struct sfmergecontext *mc); -extern RefChar *RefCharsCopy(RefChar *ref); -extern SplineChar *SFGetChar(SplineFont *sf, int unienc, const char *name); -extern SplineChar *SFGetOrMakeCharFromUnicodeBasic(SplineFont *sf, int ch); -extern SplineChar *SFHashName(SplineFont *sf, const char *name); -extern SplineChar *SplineCharCopy(SplineChar *sc, SplineFont *into, struct sfmergecontext *mc); -extern SplineChar *SplineCharInterpolate(SplineChar *base, SplineChar *other, real amount, SplineFont *newfont); -extern SplineFont *InterpolateFont(SplineFont *base, SplineFont *other, real amount, Encoding *enc); -extern SplineSet *SplineSetsInterpolate(SplineSet *base, SplineSet *other, real amount, SplineChar *sc); -extern struct altuni *AltUniCopy(struct altuni *altuni, SplineFont *noconflicts); -extern struct lookup_subtable *MCConvertSubtable(struct sfmergecontext *mc, struct lookup_subtable *sub); -extern void BitmapsCopy(SplineFont *to, SplineFont *from, int to_index, int from_index); -extern void GlyphHashFree(SplineFont *sf); -extern void __GlyphHashFree(struct glyphnamehash *hash); -extern void MergeFont(FontViewBase *fv, SplineFont *other, int preserveCrossFontKerning); -extern void SFFinishMergeContext(struct sfmergecontext *mc); -extern void SFHashGlyph(SplineFont *sf, SplineChar *sc); - -#endif /* FONTFORGE_FVFONTS_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/namelist.h b/pdf2htmlEX/src/util/fontforge-20190801/namelist.h deleted file mode 100644 index 6ec85ad..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/namelist.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef FONTFORGE_NAMELIST_H -#define FONTFORGE_NAMELIST_H - -#include "splinefont.h" - -extern char **AllGlyphNames(int uni, NameList *for_this_font, SplineChar *sc); -extern char **AllNamelistNames(void); -extern char **SFTemporaryRenameGlyphsToNamelist(SplineFont *sf, NameList *new); -extern const char *RenameGlyphToNamelist(char *buffer, SplineChar *sc, NameList *old, NameList *new, char **sofar); -extern const char *StdGlyphName(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font); -extern const char *StdGlyphNameBoundsCheck(char *buffer, int uni, enum uni_interp interp, NameList *for_this_font); -extern int UniFromName(const char *name, enum uni_interp interp, Encoding *encname); -extern NameList *DefaultNameListForNewFonts(void); -extern NameList *LoadNamelist(char *filename); -extern NameList *NameListByName(const char *name); -extern void LoadNamelistDir(char *dir); -extern void SFRenameGlyphsToNamelist(SplineFont *sf, NameList *new); -extern void SFTemporaryRestoreGlyphNames(SplineFont *sf, char **former); - -#endif /* FONTFORGE_NAMELIST_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/savefont.h b/pdf2htmlEX/src/util/fontforge-20190801/savefont.h deleted file mode 100644 index 62296d2..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/savefont.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (C) 2007-2012 by George Williams */ -/* - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FONTFORGE_SAVEFONT_H -#define FONTFORGE_SAVEFONT_H - -#include - -#include "splinefont.h" - -enum fm_flags { fm_flag_afm = 0x1, - fm_flag_pfm = 0x2, - fm_flag_shortps = 0x4, - fm_flag_nopshints = 0x8, - fm_flag_apple = 0x10, - fm_flag_pfed_comments = 0x20, - fm_flag_pfed_colors = 0x40, - fm_flag_opentype = 0x80, - fm_flag_glyphmap = 0x100, - fm_flag_TeXtable = 0x200, - fm_flag_ofm = 0x400, - fm_flag_applemode = 0x800, - // fm_flag_??? = 0x1000, - fm_flag_symbol = 0x2000, - fm_flag_dummyDSIG = 0x4000, - // fm_flag_??? = 0x8000, - fm_flag_tfm = 0x10000, - fm_flag_nohintsubs = 0x20000, - fm_flag_noflex = 0x40000, - fm_flag_nottfhints = 0x80000, - fm_flag_restrict256 = 0x100000, - fm_flag_round = 0x200000, - fm_flag_afmwithmarks = 0x400000, - fm_flag_pfed_lookups = 0x800000, - fm_flag_pfed_guides = 0x1000000, - fm_flag_pfed_layers = 0x2000000, - fm_flag_winkern = 0x4000000, - fm_flag_nomacnames = 0x8000000, - }; - -extern const char (*savefont_extensions[]), (*bitmapextensions[]); -extern int old_sfnt_flags; - -void PrepareUnlinkRmOvrlp(SplineFont *sf,const char *filename,int layer); -void RestoreUnlinkRmOvrlp(SplineFont *sf,const char *filename,int layer); -int _DoSave(SplineFont *sf,char *newname,int32 *sizes,int res, - EncMap *map, char *subfontdefinition,int layer); -int CheckIfTransparent(SplineFont *sf); - -extern int GenerateScript(SplineFont *sf, char *filename, const char *bitmaptype, int fmflags, int res, char *subfontdirectory, struct sflist *sfs, EncMap *map, NameList *rename_to, int layer); - -#ifdef FONTFORGE_CONFIG_WRITE_PFM -extern int WritePfmFile(char *filename, SplineFont *sf, EncMap *map, int layer); -#endif - -#endif /* FONTFORGE_SAVEFONT_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/splineorder2.h b/pdf2htmlEX/src/util/fontforge-20190801/splineorder2.h deleted file mode 100644 index b94430c..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/splineorder2.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef FONTFORGE_SPLINEORDER2_H -#define FONTFORGE_SPLINEORDER2_H - -#include "splinefont.h" - -extern SplinePoint *SplineTtfApprox(Spline *ps); -extern SplineSet *SplineSetsConvertOrder(SplineSet *ss, int to_order2); -extern SplineSet *SplineSetsPSApprox(SplineSet *ss); -extern SplineSet *SplineSetsTTFApprox(SplineSet *ss); -extern SplineSet *SSPSApprox(SplineSet *ss); -extern SplineSet *SSttfApprox(SplineSet *ss); -extern Spline *SplineMake2(SplinePoint *from, SplinePoint *to); -extern void SCConvertLayerToOrder2(SplineChar *sc, int layer); -extern void SCConvertLayerToOrder3(SplineChar *sc, int layer); -extern void SCConvertOrder(SplineChar *sc, int to_order2); -extern void SCConvertToOrder2(SplineChar *sc); -extern void SCConvertToOrder3(SplineChar *sc); -extern void SFConvertGridToOrder2(SplineFont *_sf); -extern void SFConvertGridToOrder3(SplineFont *_sf); -extern void SFConvertLayerToOrder2(SplineFont *_sf, int layer); -extern void SFConvertLayerToOrder3(SplineFont *_sf, int layer); -extern void SFConvertToOrder2(SplineFont *_sf); -extern void SFConvertToOrder3(SplineFont *_sf); -extern void SplinePointNextCPChanged2(SplinePoint *sp); -extern void SplinePointPrevCPChanged2(SplinePoint *sp); -extern void SplineRefigure2(Spline *spline); -extern void SplineRefigureFixup(Spline *spline); - -#endif /* FONTFORGE_SPLINEORDER2_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/splineutil.h b/pdf2htmlEX/src/util/fontforge-20190801/splineutil.h deleted file mode 100644 index 99d21ab..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/splineutil.h +++ /dev/null @@ -1,217 +0,0 @@ -#ifndef FONTFORGE_SPLINEUTIL_H -#define FONTFORGE_SPLINEUTIL_H - -#include "glif_name_hash.h" -#include "psfont.h" -#include "splinefont.h" -#include "ttfinstrs.h" -#include "views.h" - -extern AnchorClass *SFFindOrAddAnchorClass(SplineFont *sf, char *name, struct lookup_subtable *sub); -extern AnchorPoint *AnchorPointsCopy(AnchorPoint *alist); -extern AnchorPoint *APAnchorClassMerge(AnchorPoint *anchors, AnchorClass *into, AnchorClass *from); -extern bigreal DistanceBetweenPoints(BasePoint *p1, BasePoint *p2); -extern bigreal SplineCurvature(Spline *s, bigreal t); -extern bigreal SplineMinDistanceToPoint(Spline *s, BasePoint *p); - -extern size_t count_caps(const char * input); -extern char *upper_case(const char * input); -extern char *same_case(const char * input); -extern char *delimit_null(const char * input, char delimiter); - -extern char *strconcat3(const char *str1, const char *str2, const char *str3); -extern char **StringExplode(const char *input, char delimiter); -extern char *XUIDFromFD(int xuid[20]); -extern DeviceTable *DeviceTableCopy(DeviceTable *orig); -extern double CheckExtremaForSingleBitErrors(const Spline1D *sp, double t, double othert); -extern DStemInfo *DStemInfoCopy(DStemInfo *h); -extern EncMap *EncMap1to1(int enccount); -extern EncMap *EncMapCopy(EncMap *map); -extern EncMap *EncMapNew(int enccount, int backmax, Encoding *enc); - -/* Uses an iterative approximation */ -extern extended IterateSplineSolve(const Spline1D *sp, extended tmin, extended tmax, extended sought_y); -/* Uses an iterative approximation and then tries to fix things up */ -extern extended IterateSplineSolveFixup(const Spline1D *sp, extended tmin, extended tmax, extended sought_y); - -extern FPST *FPSTCopy(FPST *fpst); -extern HintMask *HintMaskFromTransformedRef(RefChar *ref, BasePoint *trans, SplineChar *basesc,HintMask *hm); -extern ImageList *ImageListCopy(ImageList *cimg); -extern ImageList *ImageListTransform(ImageList *img, real transform[6], int everything); -extern int CountKerningClasses(SplineFont *sf); -extern int _CubicSolve(const Spline1D *sp, bigreal sought, extended ts[3]); -extern int GroupNameType(const char *input); -extern int IntersectLines(BasePoint *inter, BasePoint *line1_1, BasePoint *line1_2, BasePoint *line2_1, BasePoint *line2_2); -extern int IntersectLinesClip(BasePoint *inter, BasePoint *line1_1, BasePoint *line1_2, BasePoint *line2_1, BasePoint *line2_2); -extern int IntersectLinesSlopes(BasePoint *inter, BasePoint *line1, BasePoint *slope1, BasePoint *line2, BasePoint *slope2); -extern int LineTangentToSplineThroughPt(Spline *s, BasePoint *pt, extended ts[4], extended tmin, extended tmax); -extern int NearSpline(FindSel *fs, Spline *spline); -extern int SCRoundToCluster(SplineChar *sc, int layer, int sel, bigreal within, bigreal max); -extern int SFKerningGroupExistsSpecific(const struct splinefont *sf, const char *groupname, int isv, int isr); -extern int SpExistsInSS(SplinePoint *sp, SplineSet *ss); -extern int Spline2DFindExtrema(const Spline *sp, extended extrema[4]); -extern int Spline2DFindPointsOfInflection(const Spline *sp, extended poi[2]); -extern int SplineAtInflection(Spline1D *sp, bigreal t); -extern int SplineAtMinMax(Spline1D *sp, bigreal t); -extern int SplineExistsInSS(Spline *s, SplineSet *ss); -extern int SplinePointIsACorner(SplinePoint *sp); -extern int SplineSetIntersect(SplineSet *spl, Spline **_spline, Spline **_spline2); -extern int SplineSetsRemoveAnnoyingExtrema(SplineSet *ss, bigreal err); -extern int SplineRemoveWildControlPoints(Spline *s, bigreal distratio); -extern int SplineSetsRemoveWildControlPoints(SplineSet *ss, bigreal distratio); - -/* Two lines intersect in at most 1 point */ -/* Two quadratics intersect in at most 4 points */ -/* Two cubics intersect in at most 9 points */ /* Plus an extra space for a trailing -1 */ -extern int SplinesIntersect(const Spline *s1, const Spline *s2, BasePoint pts[9], extended t1s[10], extended t2s[10]); - -extern int SplineT2SpiroIndex(Spline *spline, bigreal t, SplineSet *spl); -extern int SSBoundsWithin(SplineSet *ss, bigreal z1, bigreal z2, bigreal *wmin, bigreal *wmax, int major); -extern int SSExistsInLayer(SplineSet *ss, SplineSet *lots); -extern int SSHasClip(SplineSet *ss); -extern int SSHasDrawn(SplineSet *ss); -extern int SSPointWithin(SplineSet *spl, BasePoint *pt); -extern int StringInStrings(char const* const* space, int length, const char *target); -extern KernClass *KernClassCopy(KernClass *kc); -extern LinearApprox *SplineApproximate(Spline *spline, real scale); -extern MinimumDistance *MinimumDistanceCopy(MinimumDistance *md); -extern real SplineNearPoint(Spline *spline, BasePoint *bp, real fudge); -extern RefChar *RefCharCreate(void); -extern SplineChar *SFSplineCharCreate(SplineFont *sf); -extern SplineFont *SplineFontFromPSFont(FontDict *fd); -extern SplinePointList *SPLCopyTransformedHintMasks(RefChar *r, SplineChar *basesc, BasePoint *trans,int layer); -extern SplinePointList *SPLCopyTranslatedHintMasks(SplinePointList *base, SplineChar *basesc, SplineChar *subsc, BasePoint *trans); -extern SplinePointList *SplinePointListCopy1(const SplinePointList *spl); -extern SplinePointList *SplinePointListCopySelected(SplinePointList *base); -extern SplinePointList *SplinePointListCopySpiroSelected(SplinePointList *base); -extern SplinePointList *SplinePointListRemoveSelected(SplineChar *sc, SplinePointList *base); -extern SplinePointList *SplinePointListShift(SplinePointList *base, real xoff, enum transformPointType allpoints); -extern SplinePointList *SplinePointListSpiroTransform(SplinePointList *base, real transform[6], int allpoints); -extern SplinePointList *SplinePointListTransformExtended(SplinePointList *base, real transform[6], enum transformPointType tpt, enum transformPointMask tpmask); - -extern SplinePoint *SplineBisect(Spline *spline, extended t); -extern SplinePoint *SplinePointCreate(real x, real y); -extern SplineSet *LayerAllSplines(Layer *layer); -extern SplineSet *LayerUnAllSplines(Layer *layer); -extern Spline *SplineMake3(SplinePoint *from, SplinePoint *to); -extern Spline *SplineSplit(Spline *spline, extended ts[3]); -extern struct baselangextent *BaseLangCopy(struct baselangextent *extent); -extern struct ff_glyphclasses *SFGetGroup(const struct splinefont *sf, int index, const char *name); -extern struct glyphvariants *GlyphVariantsCopy(struct glyphvariants *gv); -extern struct gradient *GradientCopy(struct gradient *old, real transform[6]); -extern struct jstf_lang *JstfLangsCopy(struct jstf_lang *jl); -extern struct mathkern *MathKernCopy(struct mathkern *mk); -extern struct pattern *PatternCopy(struct pattern *old, real transform[6]); -extern ValDevTab *ValDevTabCopy(ValDevTab *orig); -extern void AltUniFree(struct altuni *altuni); -extern void AnchorClassesFree(AnchorClass *an); -extern void AnchorPointsFree(AnchorPoint *ap); -extern void ApTransform(AnchorPoint *ap, real transform[6]); -extern void ASMFree(ASM *sm); -extern void BaseFree(struct Base *base); -extern void BaseLangFree(struct baselangextent *extent); -extern void BaseScriptFree(struct basescript *bs); -extern void BpTransform(BasePoint *to, BasePoint *from, real transform[6]); -extern void BrushCopy(struct brush *into, struct brush *from, real transform[6]); -extern void CIDLayerFindBounds(SplineFont *cidmaster, int layer, DBounds *bounds); -extern void DeviceTableFree(DeviceTable *dt); -extern void DeviceTableSet(DeviceTable *adjust, int size, int correction); -extern void DStemInfoFree(DStemInfo *h); -extern void DStemInfosFree(DStemInfo *h); -extern void EncMapFree(EncMap *map); -extern void ExplodedStringFree(char **input); -extern void FeatureScriptLangListFree(FeatureScriptLangList *fl); -extern void FPSTClassesFree(FPST *fpst); -extern void FPSTFree(FPST *fpst); -extern void FPSTRuleContentsFree(struct fpst_rule *r, enum fpossub_format format); -extern void FPSTRulesFree(struct fpst_rule *r, enum fpossub_format format, int rcnt); -extern void GlyphGroupFree(struct ff_glyphclasses* group); -extern void GlyphGroupKernFree(struct ff_rawoffsets* groupkern); -extern void GlyphGroupKernsFree(struct ff_rawoffsets* root); -extern void GlyphGroupsFree(struct ff_glyphclasses* root); -extern void GlyphVariantsFree(struct glyphvariants *gv); -extern void GradientFree(struct gradient *grad); -extern void GrowBufferAdd(GrowBuf *gb, int ch); -extern void GrowBufferAddStr(GrowBuf *gb, char *str); -extern void GuidelineSetFree(GuidelineSet *gl); -extern void ImageListsFree(ImageList *imgs); -extern void JstfLangFree(struct jstf_lang *jl); -extern void JustifyFree(Justify *just); -extern void KernClassClearSpecialContents(KernClass *kc); -extern void KernClassFreeContents(KernClass *kc); -extern void KernClassListClearSpecialContents(KernClass *kc); -extern void KernClassListFree(KernClass *kc); -extern void KernPairsFree(KernPair *kp); -extern void LayerDefault(Layer *layer); -extern void LayerFreeContents(SplineChar *sc, int layer); -extern void LinearApproxFree(LinearApprox *la); -extern void LineListFree(LineList *ll); -extern void MacFeatListFree(MacFeat *mf); -extern void MacNameListFree(struct macname *mn); -extern void MacSettingListFree(struct macsetting *ms); -extern void MarkClassFree(int cnt, char **classes, char **names); -extern void MarkSetFree(int cnt, char **classes, char **names); -extern void MathKernFree(struct mathkern *mk); -extern void MathKernVContentsFree(struct mathkernvertex *mk); -extern void MinimumDistancesFree(MinimumDistance *md); -extern void MMSetClearSpecial(MMSet *mm); -extern void MMSetFreeContents(MMSet *mm); -extern void OtfFeatNameListFree(struct otffeatname *fn); -extern void OtfNameListFree(struct otfname *on); -extern void OTLookupFree(OTLookup *lookup); -extern void OTLookupListFree(OTLookup *lookup); -extern void PatternFree(struct pattern *pat); -extern void PenCopy(struct pen *into, struct pen *from, real transform[6]); -extern void RefCharFindBounds(RefChar *rf); -extern void RefCharFree(RefChar *ref); -extern void RefCharsFree(RefChar *ref); -extern void SCCategorizePoints(SplineChar *sc); -extern void SCMakeDependent(SplineChar *dependent, SplineChar *base); -extern void SCRefToSplines(SplineChar *sc, RefChar *rf, int layer); -extern void SCReinstanciateRefChar(SplineChar *sc, RefChar *rf, int layer); -extern void SCRemoveDependent(SplineChar *dependent, RefChar *rf, int layer); -extern void SCRemoveDependents(SplineChar *dependent); -extern void SCRemoveLayerDependents(SplineChar *dependent, int layer); -extern void SFInstanciateRefs(SplineFont *sf); -extern void SFReinstanciateRefs(SplineFont *sf); -extern void SFRemoveAnchorClass(SplineFont *sf, AnchorClass *an); -extern void SFRemoveSavedTable(SplineFont *sf, uint32 tag); -extern void SplineCharFindBounds(SplineChar *sc, DBounds *bounds); -extern void SplineCharFreeContents(SplineChar *sc); -extern void SplineCharLayerFindBounds(SplineChar *sc, int layer, DBounds *bounds); -extern void SplineCharLayerQuickBounds(SplineChar *sc, int layer, DBounds *bounds); -extern void SplineCharListsFree(struct splinecharlist *dlist); -extern void SplineCharQuickBounds(SplineChar *sc, DBounds *b); -extern void SplineCharQuickConservativeBounds(SplineChar *sc, DBounds *b); -extern void SplineFindExtrema(const Spline1D *sp, extended *_t1, extended *_t2); -extern void SplineFontClearSpecial(SplineFont *sf); -extern void SplineFontFindBounds(SplineFont *sf, DBounds *bounds); -extern void SplineFontFree(SplineFont *sf); -extern void SplineFontLayerFindBounds(SplineFont *sf, int layer, DBounds *bounds); -extern void SplineFontQuickConservativeBounds(SplineFont *sf, DBounds *b); -extern void SplineFree(Spline *spline); -extern void SplinePointCategorize(SplinePoint *sp); -extern void SplinePointFree(SplinePoint *sp); -extern void SplinePointListFree(SplinePointList *spl); -extern void SplinePointListMDFree(SplineChar *sc, SplinePointList *spl); -extern void SplinePointListSelect(SplinePointList *spl, int sel); -extern void SplinePointListsFree(SplinePointList *spl); -extern void SplinePointListsMDFree(SplineChar *sc, SplinePointList *spl); -extern void SplinePointMDFree(SplineChar *sc, SplinePoint *sp); -extern void SplinePointsFree(SplinePointList *spl); -extern void SplineRemoveExtremaTooClose(Spline1D *sp, extended *_t1, extended *_t2); -extern void SplineSetBeziersClear(SplinePointList *spl); -extern void SplineSetFindBounds(const SplinePointList *spl, DBounds *bounds); -extern void SplineSetQuickBounds(SplineSet *ss, DBounds *b); -extern void SplineSetQuickConservativeBounds(SplineSet *ss, DBounds *b); -extern void SplineSetSpirosClear(SplineSet *spl); -extern void TTFLangNamesFree(struct ttflangname *l); -extern void TtfTablesFree(struct ttf_table *tab); -extern void ValDevFree(ValDevTab *adjust); - -extern int KerningClassSeekByAbsoluteIndex(const struct splinefont *sf, int seek_index, struct kernclass **okc, int *oisv, int *oisr, int *ooffset); -extern int HashKerningClassNames(SplineFont *sf, struct glif_name_index * class_name_hash); -extern int HashKerningClassNamesCaps(SplineFont *sf, struct glif_name_index * class_name_hash); -extern int HashKerningClassNamesFlex(SplineFont *sf, struct glif_name_index * class_name_hash, int capitalize); - -#endif /* FONTFORGE_SPLINEUTIL_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/splineutil2.h b/pdf2htmlEX/src/util/fontforge-20190801/splineutil2.h deleted file mode 100644 index b5ed7fa..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/splineutil2.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef FONTFORGE_SPLINEUTIL2_H -#define FONTFORGE_SPLINEUTIL2_H - -#include "splinefont.h" - -enum ae_type { ae_all, ae_between_selected, ae_only_good, ae_only_good_rm_later }; - -extern bigreal PathLength(SplineSet *ss); -extern bigreal SplineLengthRange(Spline *spline, real from_t, real to_t); -extern char *GetNextUntitledName(void); -extern int PointListIsSelected(SplinePointList *spl); -extern int PointsDiagonalable(SplineFont *sf, BasePoint **bp, BasePoint *unit); -extern int RealApprox(real a, real b); -extern int RealNearish(real a, real b); -extern int RealRatio(real a, real b, real fudge); -extern int RealWithin(real a, real b, real fudge); -extern int SPInterpolate(const SplinePoint *sp); -extern int SpIsExtremum(SplinePoint *sp); -extern int Spline1DCantExtremeX(const Spline *s); -extern int Spline1DCantExtremeY(const Spline *s); -extern int SplineInSplineSet(Spline *spline, SplineSet *spl); -extern int SplineIsLinearMake(Spline *spline); -extern int SplinePointListIsClockwise(const SplineSet *spl); -extern int SPLNearlyLines(SplineChar *sc, SplineSet *ss, bigreal err); -extern int Within16RoundingErrors(bigreal v1, bigreal v2); -extern int Within4RoundingErrors(bigreal v1, bigreal v2); -extern int Within64RoundingErrors(bigreal v1, bigreal v2); -extern Spline *ApproximateSplineFromPointsSlopes(SplinePoint *from, SplinePoint *to, TPoint *mid, int cnt, int order2); -extern SplineFont *SplineFontBlank(int charcnt); -extern SplineFont *SplineFontEmpty(void); -extern SplineFont *SplineFontNew(void); -extern Spline *PathFindDistance(SplineSet *path, bigreal d, bigreal *_t); -extern SplineSet *SplineCharRemoveTiny(SplineChar *sc, SplineSet *head); -extern SplineSet *SplineCharSimplify(SplineChar *sc, SplineSet *head, struct simplifyinfo *smpl); -extern SplineSet *SplineSetBindToPath(SplineSet *ss, int doscale, int glyph_as_unit, int align, real offset, SplineSet *path); -extern SplineSet *SplineSetJoin(SplineSet *start, int doall, real fudge, int *changed); -extern SplineSet *SplineSetReverse(SplineSet *spl); -extern SplineSet *SplineSetsAntiCorrect(SplineSet *base); -extern SplineSet *SplineSetsCorrect(SplineSet *base, int *changed); -extern SplineSet *SplineSetsDetectDir(SplineSet **_base, int *_lastscan); -extern SplineSet *SplineSetsExtractOpen(SplineSet **tbase); -extern SplineSet *SSRemoveZeroLengthSplines(SplineSet *base); -extern Spline *SplineAddExtrema(Spline *s, int always, real lenbound, real offsetbound, DBounds *b); -extern void BP_HVForce(BasePoint *vector); -extern void CanonicalContours(SplineChar *sc, int layer); -extern void SFIncrementXUID(SplineFont *sf); -extern void SFRandomChangeXUID(SplineFont *sf); -extern void SPAdjustControl(SplinePoint *sp, BasePoint *cp, BasePoint *to, int order2); -extern void SPAverageCps(SplinePoint *sp); -extern void SPHVCurveForce(SplinePoint *sp); -extern void SPLAverageCps(SplinePointList *spl); -extern void SplineCharAddExtrema(SplineChar *sc, SplineSet *head, enum ae_type between_selected, int emsize); -extern void SplineCharDefaultNextCP(SplinePoint *base); -extern void SplineCharDefaultPrevCP(SplinePoint *base); -extern void SplineCharMerge(SplineChar *sc, SplineSet **head, int type); -extern void SplineCharTangentNextCP(SplinePoint *sp); -extern void SplineCharTangentPrevCP(SplinePoint *sp); -extern void SplinePointListSet(SplinePointList *tobase, SplinePointList *frombase); -extern void SplinePointListSimplify(SplineChar *sc, SplinePointList *spl, struct simplifyinfo *smpl); -extern void SplineSetAddExtrema(SplineChar *sc, SplineSet *ss, enum ae_type between_selected, int emsize); -extern void SplineSetJoinCpFixup(SplinePoint *sp); -extern void SplineSetsInsertOpen(SplineSet **tbase, SplineSet *open); -extern void SplineSetsUntick(SplineSet *spl); -extern void SplinesRemoveBetween(SplineChar *sc, SplinePoint *from, SplinePoint *to, int type); -extern void SPLNearlyHvCps(SplineChar *sc, SplineSet *ss, bigreal err); -extern void SPLNearlyHvLines(SplineChar *sc, SplineSet *ss, bigreal err); -extern void SPLsStartToLeftmost(SplineChar *sc, int layer); -extern void SPLStartToLeftmost(SplineChar *sc, SplinePointList *spl, int *changed); -extern void SPSmoothJoint(SplinePoint *sp); - -/** - * This is like SPAdjustControl but you have not wanting to move the - * BCP at all, but you would like the current location of the passed - * BCP to reshape the spline through the splinepoint. For example, if - * you drag the spline between two points then you might like to touch - * the inside BCP between the two splinepoints to reshape the whole - * curve through a curve point. - */ -extern void SPTouchControl(SplinePoint *sp, BasePoint *which, int order2); - -extern void SPWeightedAverageCps(SplinePoint *sp); -extern void SSOverlapClusterCpAngles(SplineSet *base, bigreal within); -extern void SSRemoveStupidControlPoints(SplineSet *base); - -#endif /* FONTFORGE_SPLINEUTIL2_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/start.h b/pdf2htmlEX/src/util/fontforge-20190801/start.h deleted file mode 100644 index 037731b..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/start.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FONTFORGE_START_H -#define FONTFORGE_START_H - -extern void doinitFontForgeMain(void); -extern void doversion(const char *source_version_str); -extern void InitSimpleStuff(void); - -#endif /* FONTFORGE_START_H */ diff --git a/pdf2htmlEX/src/util/fontforge-20190801/tottf.h b/pdf2htmlEX/src/util/fontforge-20190801/tottf.h deleted file mode 100644 index 28895f7..0000000 --- a/pdf2htmlEX/src/util/fontforge-20190801/tottf.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef FONTFORGE_TOTTF_H -#define FONTFORGE_TOTTF_H - -#include "splinefont.h" -#include "ttf.h" - -extern char *utf8_verify_copy(const char *str); -extern int32 filechecksum(FILE *file); - -extern int AlreadyMSSymbolArea(SplineFont *sf, EncMap *map); -extern int RefDepth(RefChar *ref, int layer); -extern int SFFigureDefWidth(SplineFont *sf, int *_nomwid); -extern int SFHasInstructions(SplineFont *sf); -extern int SSAddPoints(SplineSet *ss, int ptcnt, BasePoint *bp, char *flags); -extern int ttfcopyfile(FILE *ttf, FILE *other, int pos, const char *tab_name); -extern int WriteTTC(const char *filename, struct sflist *sfs, enum fontformat format, enum bitmapformat bf, int flags, int layer, enum ttc_flags ttcflags); -extern int WriteTTFFont(char *fontname, SplineFont *sf, enum fontformat format, int32 *bsizes, enum bitmapformat bf, int flags, EncMap *enc, int layer); -extern int _WriteTTFFont(FILE *ttf, SplineFont *sf, enum fontformat format, int32 *bsizes, enum bitmapformat bf, int flags, EncMap *enc, int layer); -extern int _WriteType42SFNTS(FILE *type42, SplineFont *sf, enum fontformat format, int flags, EncMap *enc, int layer); -extern void cvt_unix_to_1904(long long time, int32 result[2]); -extern void DefaultTTFEnglishNames(struct ttflangname *dummy, SplineFont *sf); -extern void OS2FigureCodePages(SplineFont *sf, uint32 CodePage[2]); -extern void OS2FigureUnicodeRanges(SplineFont *sf, uint32 Ranges[4]); -extern void SFDefaultOS2Info(struct pfminfo *pfminfo, SplineFont *sf, char *fontname); -extern void SFDefaultOS2Simple(struct pfminfo *pfminfo, SplineFont *sf); -extern void SFDefaultOS2SubSuper(struct pfminfo *pfminfo, int emsize, double italic_angle); -extern void SFDummyUpCIDs(struct glyphinfo *gi, SplineFont *sf); - -extern void putfixed(FILE *file, real dval); -extern void putlong(FILE *file, int val); -extern void putshort(FILE *file, int sval); - -#endif /* FONTFORGE_TOTTF_H */ From d42b1c1a2e1b7303fb1ad280e7e518b5e60f49d9 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 29 May 2020 18:16:50 +0000 Subject: [PATCH 161/269] removed poppler Cairo source copies inside pdf2htmlEX source tree --- pdf2htmlEX/3rdparty/poppler/COPYING3 | 674 ---- .../3rdparty/poppler/git/CairoFontEngine.cc | 856 ---- .../3rdparty/poppler/git/CairoFontEngine.h | 128 - .../3rdparty/poppler/git/CairoOutputDev.cc | 3573 ----------------- .../3rdparty/poppler/git/CairoOutputDev.h | 525 --- .../3rdparty/poppler/git/CairoRescaleBox.cc | 379 -- .../3rdparty/poppler/git/CairoRescaleBox.h | 64 - pdf2htmlEX/CMakeLists.txt | 29 +- 8 files changed, 10 insertions(+), 6218 deletions(-) delete mode 100644 pdf2htmlEX/3rdparty/poppler/COPYING3 delete mode 100644 pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc delete mode 100644 pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h delete mode 100644 pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc delete mode 100644 pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h delete mode 100644 pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc delete mode 100644 pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.h diff --git a/pdf2htmlEX/3rdparty/poppler/COPYING3 b/pdf2htmlEX/3rdparty/poppler/COPYING3 deleted file mode 100644 index 94a9ed0..0000000 --- a/pdf2htmlEX/3rdparty/poppler/COPYING3 +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc deleted file mode 100644 index 776b6de..0000000 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc +++ /dev/null @@ -1,856 +0,0 @@ -//======================================================================== -// -// CairoFontEngine.cc -// -// Copyright 2003 Glyph & Cog, LLC -// Copyright 2004 Red Hat, Inc -// -//======================================================================== - -//======================================================================== -// -// 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) 2005-2007 Jeff Muizelaar -// Copyright (C) 2005, 2006 Kristian Høgsberg -// Copyright (C) 2005 Martin Kretzschmar -// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017-2019 Albert Astals Cid -// Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos -// Copyright (C) 2007 Koji Otani -// Copyright (C) 2008, 2009 Chris Wilson -// Copyright (C) 2008, 2012, 2014, 2016, 2017 Adrian Johnson -// Copyright (C) 2009 Darren Kenny -// Copyright (C) 2010 Suzuki Toshiya -// Copyright (C) 2010 Jan Kümmel -// Copyright (C) 2012 Hib Eris -// Copyright (C) 2013 Thomas Freitag -// Copyright (C) 2015, 2016 Jason Crain -// Copyright (C) 2018 Adam Reichold -// Copyright (C) 2019 Christian Persch -// -// 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 - -#include -#include "CairoFontEngine.h" -#include "CairoOutputDev.h" -#include "GlobalParams.h" -#include -#include -#include "goo/gfile.h" -#include "Error.h" -#include "XRef.h" -#include "Gfx.h" -#include "Page.h" - -#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_MMAN_H) && defined(HAVE_SYS_STAT_H) -#include -#include -#include -#define CAN_CHECK_OPEN_FACES 1 -#endif - -//------------------------------------------------------------------------ -// CairoFont -//------------------------------------------------------------------------ - -CairoFont::CairoFont(Ref refA, - cairo_font_face_t *cairo_font_faceA, - int *codeToGIDA, - unsigned int codeToGIDLenA, - bool substituteA, - bool printingA) : ref(refA), - cairo_font_face(cairo_font_faceA), - codeToGID(codeToGIDA), - codeToGIDLen(codeToGIDLenA), - substitute(substituteA), - printing(printingA) { } - -CairoFont::~CairoFont() { - cairo_font_face_destroy (cairo_font_face); - gfree(codeToGID); -} - -bool -CairoFont::matches(Ref &other, bool printingA) { - return (other == ref); -} - -cairo_font_face_t * -CairoFont::getFontFace(void) { - return cairo_font_face; -} - -unsigned long -CairoFont::getGlyph(CharCode code, - const Unicode *u, int uLen) { - FT_UInt gid; - - if (codeToGID && code < codeToGIDLen) { - gid = (FT_UInt)codeToGID[code]; - } else { - gid = (FT_UInt)code; - } - return gid; -} - -double -CairoFont::getSubstitutionCorrection(GfxFont *gfxFont) -{ - double w1, w2, w3; - CharCode code; - const char *name; - - // for substituted fonts: adjust the font matrix -- compare the - // width of 'm' in the original font and the substituted font - if (isSubstitute() && !gfxFont->isCIDFont()) { - for (code = 0; code < 256; ++code) { - if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) && - name[0] == 'm' && name[1] == '\0') { - break; - } - } - if (code < 256) { - w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code); - { - cairo_matrix_t m; - cairo_matrix_init_identity(&m); - cairo_font_options_t *options = cairo_font_options_create(); - cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE); - cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_OFF); - cairo_scaled_font_t *scaled_font = cairo_scaled_font_create(cairo_font_face, &m, &m, options); - - cairo_text_extents_t extents; - cairo_scaled_font_text_extents(scaled_font, "m", &extents); - - cairo_scaled_font_destroy(scaled_font); - cairo_font_options_destroy(options); - w2 = extents.x_advance; - } - w3 = ((Gfx8BitFont *)gfxFont)->getWidth(0); - if (!gfxFont->isSymbolic() && w2 > 0 && w1 > w3) { - // if real font is substantially narrower than substituted - // font, reduce the font size accordingly - if (w1 > 0.01 && w1 < 0.9 * w2) { - w1 /= w2; - return w1; - } - } - } - } - return 1.0; -} - -//------------------------------------------------------------------------ -// CairoFreeTypeFont -//------------------------------------------------------------------------ - -static cairo_user_data_key_t _ft_cairo_key; - -static void -_ft_done_face_uncached (void *closure) -{ - FT_Face face = (FT_Face) closure; - FT_Done_Face (face); -} - -static bool -_ft_new_face_uncached (FT_Library lib, - const char *filename, - char *font_data, - int font_data_len, - FT_Face *face_out, - cairo_font_face_t **font_face_out) -{ - FT_Face face; - cairo_font_face_t *font_face; - - if (font_data == nullptr) { - if (FT_New_Face (lib, filename, 0, &face)) - return false; - } else { - if (FT_New_Memory_Face (lib, (unsigned char *)font_data, font_data_len, 0, &face)) - return false; - } - - font_face = cairo_ft_font_face_create_for_ft_face (face, - FT_LOAD_NO_HINTING | - FT_LOAD_NO_BITMAP); - if (cairo_font_face_set_user_data (font_face, - &_ft_cairo_key, - face, - _ft_done_face_uncached)) - { - _ft_done_face_uncached (face); - cairo_font_face_destroy (font_face); - return false; - } - - *face_out = face; - *font_face_out = font_face; - return true; -} - -#ifdef CAN_CHECK_OPEN_FACES -static struct _ft_face_data { - struct _ft_face_data *prev, *next, **head; - - int fd; - unsigned long hash; - size_t size; - unsigned char *bytes; - - FT_Library lib; - FT_Face face; - cairo_font_face_t *font_face; -} *_ft_open_faces; - -static unsigned long -_djb_hash (const unsigned char *bytes, size_t len) -{ - unsigned long hash = 5381; - while (len--) { - unsigned char c = *bytes++; - hash *= 33; - hash ^= c; - } - return hash; -} - -static bool -_ft_face_data_equal (struct _ft_face_data *a, struct _ft_face_data *b) -{ - if (a->lib != b->lib) - return false; - if (a->size != b->size) - return false; - if (a->hash != b->hash) - return false; - - return memcmp (a->bytes, b->bytes, a->size) == 0; -} - -static void -_ft_done_face (void *closure) -{ - struct _ft_face_data *data = (struct _ft_face_data *) closure; - - if (data->next) - data->next->prev = data->prev; - if (data->prev) - data->prev->next = data->next; - else - _ft_open_faces = data->next; - - if (data->fd != -1) { -#if defined(__SUNPRO_CC) && defined(__sun) && defined(__SVR4) - munmap ((char*)data->bytes, data->size); -#else - munmap (data->bytes, data->size); -#endif - close (data->fd); - } else { - gfree (data->bytes); - } - - FT_Done_Face (data->face); - gfree (data); -} - -static bool -_ft_new_face (FT_Library lib, - const char *filename, - char *font_data, - int font_data_len, - FT_Face *face_out, - cairo_font_face_t **font_face_out) -{ - struct _ft_face_data *l; - struct stat st; - struct _ft_face_data tmpl; - - tmpl.fd = -1; - - if (font_data == nullptr) { - /* if we fail to mmap the file, just pass it to FreeType instead */ - tmpl.fd = openFileDescriptor (filename, O_RDONLY); - if (tmpl.fd == -1) - return _ft_new_face_uncached (lib, filename, font_data, font_data_len, face_out, font_face_out); - - if (fstat (tmpl.fd, &st) == -1) { - close (tmpl.fd); - return _ft_new_face_uncached (lib, filename, font_data, font_data_len, face_out, font_face_out); - } - - tmpl.bytes = (unsigned char *) mmap (nullptr, st.st_size, - PROT_READ, MAP_PRIVATE, - tmpl.fd, 0); - if (tmpl.bytes == MAP_FAILED) { - close (tmpl.fd); - return _ft_new_face_uncached (lib, filename, font_data, font_data_len, face_out, font_face_out); - } - tmpl.size = st.st_size; - } else { - tmpl.bytes = (unsigned char*) font_data; - tmpl.size = font_data_len; - } - - /* check to see if this is a duplicate of any of the currently open fonts */ - tmpl.lib = lib; - tmpl.hash = _djb_hash (tmpl.bytes, tmpl.size); - - for (l = _ft_open_faces; l; l = l->next) { - if (_ft_face_data_equal (l, &tmpl)) { - if (tmpl.fd != -1) { -#if defined(__SUNPRO_CC) && defined(__sun) && defined(__SVR4) - munmap ((char*)tmpl.bytes, tmpl.size); -#else - munmap (tmpl.bytes, tmpl.size); -#endif - close (tmpl.fd); - } else { - gfree (tmpl.bytes); - } - *face_out = l->face; - *font_face_out = cairo_font_face_reference (l->font_face); - return true; - } - } - - /* not a dup, open and insert into list */ - if (FT_New_Memory_Face (lib, - (FT_Byte *) tmpl.bytes, tmpl.size, - 0, &tmpl.face)) - { - if (tmpl.fd != -1) { -#if defined(__SUNPRO_CC) && defined(__sun) && defined(__SVR4) - munmap ((char*)tmpl.bytes, tmpl.size); -#else - munmap (tmpl.bytes, tmpl.size); -#endif - - close (tmpl.fd); - } - return false; - } - - l = (struct _ft_face_data *) gmallocn (1, sizeof (struct _ft_face_data)); - *l = tmpl; - l->prev = nullptr; - l->next = _ft_open_faces; - if (_ft_open_faces) - _ft_open_faces->prev = l; - _ft_open_faces = l; - - l->font_face = cairo_ft_font_face_create_for_ft_face (tmpl.face, - FT_LOAD_NO_HINTING | - FT_LOAD_NO_BITMAP); - if (cairo_font_face_set_user_data (l->font_face, - &_ft_cairo_key, - l, - _ft_done_face)) - { - cairo_font_face_destroy (l->font_face); - _ft_done_face (l); - return false; - } - - *face_out = l->face; - *font_face_out = l->font_face; - return true; -} -#else -#define _ft_new_face _ft_new_face_uncached -#endif - -CairoFreeTypeFont::CairoFreeTypeFont(Ref refA, - cairo_font_face_t *cairo_font_faceA, - int *codeToGIDA, - unsigned int codeToGIDLenA, - bool substituteA) : CairoFont(refA, - cairo_font_faceA, - codeToGIDA, - codeToGIDLenA, - substituteA, - true) { } - -CairoFreeTypeFont::~CairoFreeTypeFont() { } - -CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, - FT_Library lib, bool useCIDs) { - GooString *fileName; - const char *fileNameC; - char *font_data; - int font_data_len; - int i, n; - GfxFontType fontType; - GfxFontLoc *fontLoc; - char **enc; - const char *name; - FoFiTrueType *ff; - FoFiType1C *ff1c; - Ref ref; - FT_Face face; - cairo_font_face_t *font_face; - - int *codeToGID; - unsigned int codeToGIDLen; - - codeToGID = nullptr; - codeToGIDLen = 0; - font_data = nullptr; - font_data_len = 0; - fileName = nullptr; - fileNameC = nullptr; - - bool substitute = false; - - ref = *gfxFont->getID(); - fontType = gfxFont->getType(); - - if (!(fontLoc = gfxFont->locateFont(xref, nullptr))) { - error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->c_str() - : "(unnamed)"); - goto err2; - } - - // embedded font - if (fontLoc->locType == gfxFontLocEmbedded) { - font_data = gfxFont->readEmbFontFile(xref, &font_data_len); - if (nullptr == font_data) - goto err2; - - // external font - } else { // gfxFontLocExternal - fileName = fontLoc->path; - fontType = fontLoc->fontType; - substitute = true; - } - - if (fileName != nullptr) { - fileNameC = fileName->c_str(); - } - - switch (fontType) { - case fontType1: - case fontType1C: - case fontType1COT: - if (! _ft_new_face (lib, fileNameC, font_data, font_data_len, &face, &font_face)) { - error(errSyntaxError, -1, "could not create type1 face"); - goto err2; - } - - enc = ((Gfx8BitFont *)gfxFont)->getEncoding(); - - codeToGID = (int *)gmallocn(256, sizeof(int)); - codeToGIDLen = 256; - for (i = 0; i < 256; ++i) { - codeToGID[i] = 0; - if ((name = enc[i])) { - codeToGID[i] = FT_Get_Name_Index(face, (char*)name); - if (codeToGID[i] == 0) { - Unicode u; - u = globalParams->mapNameToUnicodeText (name); - codeToGID[i] = FT_Get_Char_Index (face, u); - } - if (codeToGID[i] == 0) { - name = GfxFont::getAlternateName(name); - if (name) { - codeToGID[i] = FT_Get_Name_Index(face, (char*)name); - } - } - } - } - break; - case fontCIDType2: - case fontCIDType2OT: - codeToGID = nullptr; - n = 0; - if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { - n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); - if (n) { - codeToGID = (int *)gmallocn(n, sizeof(int)); - memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), - n * sizeof(int)); - } - } else { - if (font_data != nullptr) { - ff = FoFiTrueType::make(font_data, font_data_len); - } else { - ff = FoFiTrueType::load(fileNameC); - } - if (! ff) - goto err2; - codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n); - delete ff; - } - codeToGIDLen = n; - /* Fall through */ - case fontTrueType: - case fontTrueTypeOT: - if (font_data != nullptr) { - ff = FoFiTrueType::make(font_data, font_data_len); - } else { - ff = FoFiTrueType::load(fileNameC); - } - if (! ff) { - error(errSyntaxError, -1, "failed to load truetype font\n"); - goto err2; - } - /* This might be set already for the CIDType2 case */ - if (fontType == fontTrueType || fontType == fontTrueTypeOT) { - codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff); - codeToGIDLen = 256; - } - delete ff; - if (! _ft_new_face (lib, fileNameC, font_data, font_data_len, &face, &font_face)) { - error(errSyntaxError, -1, "could not create truetype face\n"); - goto err2; - } - break; - - case fontCIDType0: - case fontCIDType0C: - - codeToGID = nullptr; - codeToGIDLen = 0; - - if (!useCIDs) - { - if (font_data != nullptr) { - ff1c = FoFiType1C::make(font_data, font_data_len); - } else { - ff1c = FoFiType1C::load(fileNameC); - } - if (ff1c) { - codeToGID = ff1c->getCIDToGIDMap((int *)&codeToGIDLen); - delete ff1c; - } - } - - if (! _ft_new_face (lib, fileNameC, font_data, font_data_len, &face, &font_face)) { - error(errSyntaxError, -1, "could not create cid face\n"); - goto err2; - } - break; - - case fontCIDType0COT: - codeToGID = nullptr; - n = 0; - if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { - n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); - if (n) { - codeToGID = (int *)gmallocn(n, sizeof(int)); - memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), - n * sizeof(int)); - } - } - codeToGIDLen = n; - - if (!codeToGID) { - if (!useCIDs) { - if (font_data != nullptr) { - ff = FoFiTrueType::make(font_data, font_data_len); - } else { - ff = FoFiTrueType::load(fileNameC); - } - if (ff) { - if (ff->isOpenTypeCFF()) { - codeToGID = ff->getCIDToGIDMap((int *)&codeToGIDLen); - } - delete ff; - } - } - } - if (! _ft_new_face (lib, fileNameC, font_data, font_data_len, &face, &font_face)) { - error(errSyntaxError, -1, "could not create cid (OT) face\n"); - goto err2; - } - break; - - default: - fprintf (stderr, "font type %d not handled\n", (int)fontType); - goto err2; - break; - } - - delete fontLoc; - return new CairoFreeTypeFont(ref, - font_face, - codeToGID, codeToGIDLen, - substitute); - - err2: - /* hmm? */ - delete fontLoc; - gfree (codeToGID); - gfree (font_data); - fprintf (stderr, "some font thing failed\n"); - return nullptr; -} - -//------------------------------------------------------------------------ -// CairoType3Font -//------------------------------------------------------------------------ - -static const cairo_user_data_key_t type3_font_key = {0}; - -typedef struct _type3_font_info { - GfxFont *font; - PDFDoc *doc; - CairoFontEngine *fontEngine; - bool printing; - XRef *xref; -} type3_font_info_t; - -static void -_free_type3_font_info(void *closure) -{ - type3_font_info_t *info = (type3_font_info_t *) closure; - - info->font->decRefCnt(); - free (info); -} - -static cairo_status_t -_init_type3_glyph (cairo_scaled_font_t *scaled_font, - cairo_t *cr, - cairo_font_extents_t *extents) -{ - type3_font_info_t *info; - GfxFont *font; - - info = (type3_font_info_t *) - cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font), - &type3_font_key); - font = info->font; - const double *mat = font->getFontBBox(); - extents->ascent = mat[3]; /* y2 */ - extents->descent = -mat[3]; /* -y1 */ - extents->height = extents->ascent + extents->descent; - extents->max_x_advance = mat[2] - mat[1]; /* x2 - x1 */ - extents->max_y_advance = 0; - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_render_type3_glyph (cairo_scaled_font_t *scaled_font, - unsigned long glyph, - cairo_t *cr, - cairo_text_extents_t *metrics) -{ - Dict *charProcs; - Object charProc; - CairoOutputDev *output_dev; - cairo_matrix_t matrix, invert_y_axis; - const double *mat; - double wx, wy; - PDFRectangle box; - type3_font_info_t *info; - GfxFont *font; - Dict *resDict; - Gfx *gfx; - - info = (type3_font_info_t *) - cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font), - &type3_font_key); - - font = info->font; - resDict = ((Gfx8BitFont *)font)->getResources(); - charProcs = ((Gfx8BitFont *)(info->font))->getCharProcs(); - if (!charProcs) - return CAIRO_STATUS_USER_FONT_ERROR; - - if ((int)glyph >= charProcs->getLength()) - return CAIRO_STATUS_USER_FONT_ERROR; - - mat = font->getFontMatrix(); - matrix.xx = mat[0]; - matrix.yx = mat[1]; - matrix.xy = mat[2]; - matrix.yy = mat[3]; - matrix.x0 = mat[4]; - matrix.y0 = mat[5]; - cairo_matrix_init_scale (&invert_y_axis, 1, -1); - cairo_matrix_multiply (&matrix, &matrix, &invert_y_axis); - cairo_transform (cr, &matrix); - - output_dev = new CairoOutputDev(); - output_dev->setCairo(cr); - output_dev->setPrinting(info->printing); - - mat = font->getFontBBox(); - box.x1 = mat[0]; - box.y1 = mat[1]; - box.x2 = mat[2]; - box.y2 = mat[3]; - gfx = new Gfx(info->doc, output_dev, resDict, &box, nullptr); - output_dev->startDoc(info->doc, info->fontEngine); - output_dev->startPage (1, gfx->getState(), gfx->getXRef()); - output_dev->setInType3Char(true); - charProc = charProcs->getVal(glyph); - gfx->display(&charProc); - - output_dev->getType3GlyphWidth (&wx, &wy); - cairo_matrix_transform_distance (&matrix, &wx, &wy); - metrics->x_advance = wx; - metrics->y_advance = wy; - if (output_dev->hasType3GlyphBBox()) { - double *bbox = output_dev->getType3GlyphBBox(); - - cairo_matrix_transform_point (&matrix, &bbox[0], &bbox[1]); - cairo_matrix_transform_point (&matrix, &bbox[2], &bbox[3]); - metrics->x_bearing = bbox[0]; - metrics->y_bearing = bbox[1]; - metrics->width = bbox[2] - bbox[0]; - metrics->height = bbox[3] - bbox[1]; - } - - delete gfx; - delete output_dev; - - return CAIRO_STATUS_SUCCESS; -} - - -CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, - CairoFontEngine *fontEngine, - bool printing, XRef *xref) { - type3_font_info_t *info; - cairo_font_face_t *font_face; - Ref ref; - int *codeToGID; - unsigned int codeToGIDLen; - int i, j; - char **enc; - Dict *charProcs; - char *name; - - charProcs = ((Gfx8BitFont *)gfxFont)->getCharProcs(); - info = (type3_font_info_t *) malloc(sizeof(*info)); - ref = *gfxFont->getID(); - font_face = cairo_user_font_face_create(); - cairo_user_font_face_set_init_func (font_face, _init_type3_glyph); - cairo_user_font_face_set_render_glyph_func (font_face, _render_type3_glyph); - gfxFont->incRefCnt(); - info->font = gfxFont; - info->doc = doc; - info->fontEngine = fontEngine; - info->printing = printing; - info->xref = xref; - - cairo_font_face_set_user_data (font_face, &type3_font_key, (void *) info, _free_type3_font_info); - - enc = ((Gfx8BitFont *)gfxFont)->getEncoding(); - codeToGID = (int *)gmallocn(256, sizeof(int)); - codeToGIDLen = 256; - for (i = 0; i < 256; ++i) { - codeToGID[i] = 0; - if (charProcs && (name = enc[i])) { - for (j = 0; j < charProcs->getLength(); j++) { - if (strcmp(name, charProcs->getKey(j)) == 0) { - codeToGID[i] = j; - } - } - } - } - - return new CairoType3Font(ref, font_face, codeToGID, codeToGIDLen, printing, xref); -} - -CairoType3Font::CairoType3Font(Ref refA, - cairo_font_face_t *cairo_font_faceA, - int *codeToGIDA, - unsigned int codeToGIDLenA, - bool printingA, XRef *xref) : CairoFont(refA, - cairo_font_faceA, - codeToGIDA, - codeToGIDLenA, - false, - printingA) -{ } - -CairoType3Font::~CairoType3Font() { } - -bool -CairoType3Font::matches(Ref &other, bool printingA) { - return (other == ref && printing == printingA); -} - - -//------------------------------------------------------------------------ -// CairoFontEngine -//------------------------------------------------------------------------ - -#define fontEngineLocker() std::unique_lock locker(mutex) - -CairoFontEngine::CairoFontEngine(FT_Library libA) { - int i; - - lib = libA; - for (i = 0; i < cairoFontCacheSize; ++i) { - fontCache[i] = nullptr; - } - - FT_Int major, minor, patch; - // as of FT 2.1.8, CID fonts are indexed by CID instead of GID - FT_Library_Version(lib, &major, &minor, &patch); - useCIDs = major > 2 || - (major == 2 && (minor > 1 || (minor == 1 && patch > 7))); -} - -CairoFontEngine::~CairoFontEngine() { - int i; - - for (i = 0; i < cairoFontCacheSize; ++i) { - if (fontCache[i]) - delete fontCache[i]; - } -} - -CairoFont * -CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, bool printing, XRef *xref) { - int i, j; - Ref ref; - CairoFont *font; - GfxFontType fontType; - - fontEngineLocker(); - ref = *gfxFont->getID(); - - for (i = 0; i < cairoFontCacheSize; ++i) { - font = fontCache[i]; - if (font && font->matches(ref, printing)) { - for (j = i; j > 0; --j) { - fontCache[j] = fontCache[j-1]; - } - fontCache[0] = font; - return font; - } - } - - fontType = gfxFont->getType(); - if (fontType == fontType3) - font = CairoType3Font::create (gfxFont, doc, this, printing, xref); - else - font = CairoFreeTypeFont::create (gfxFont, xref, lib, useCIDs); - - //XXX: if font is null should we still insert it into the cache? - if (fontCache[cairoFontCacheSize - 1]) { - delete fontCache[cairoFontCacheSize - 1]; - } - for (j = cairoFontCacheSize - 1; j > 0; --j) { - fontCache[j] = fontCache[j-1]; - } - fontCache[0] = font; - return font; -} diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h b/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h deleted file mode 100644 index 34802c1..0000000 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h +++ /dev/null @@ -1,128 +0,0 @@ -//======================================================================== -// -// CairoFontEngine.h -// -// Copyright 2003 Glyph & Cog, LLC -// Copyright 2004 Red Hat, Inc -// -//======================================================================== - -//======================================================================== -// -// 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) 2005, 2006 Kristian Høgsberg -// 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 -// Copyright (C) 2013 Thomas Freitag -// Copyright (C) 2018 Adam Reichold -// -// 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 CAIROFONTENGINE_H -#define CAIROFONTENGINE_H - -#include - -#include "poppler-config.h" -#include - -#include "GfxFont.h" -#include "PDFDoc.h" - -class CairoFontEngine; - -class CairoFont { -public: - CairoFont(Ref ref, - cairo_font_face_t *face, - int *codeToGID, - unsigned int codeToGIDLen, - bool substitute, - bool printing); - virtual ~CairoFont(); - CairoFont(const CairoFont &) = delete; - CairoFont& operator=(const CairoFont &other) = delete; - - virtual bool matches(Ref &other, bool printing); - cairo_font_face_t *getFontFace(void); - unsigned long getGlyph(CharCode code, const Unicode *u, int uLen); - double getSubstitutionCorrection(GfxFont *gfxFont); - - bool isSubstitute() { return substitute; } -protected: - Ref ref; - cairo_font_face_t *cairo_font_face; - - int *codeToGID; - unsigned int codeToGIDLen; - - bool substitute; - bool printing; -}; - -//------------------------------------------------------------------------ - -class CairoFreeTypeFont : public CairoFont { -public: - static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, bool useCIDs); - ~CairoFreeTypeFont(); - -private: - CairoFreeTypeFont(Ref ref, cairo_font_face_t *cairo_font_face, - int *codeToGID, unsigned int codeToGIDLen, bool substitute); -}; - -//------------------------------------------------------------------------ - -class CairoType3Font : public CairoFont { -public: - static CairoType3Font *create(GfxFont *gfxFont, PDFDoc *doc, - CairoFontEngine *fontEngine, - bool printing, XRef *xref); - ~CairoType3Font(); - - bool matches(Ref &other, bool printing) override; - -private: - CairoType3Font(Ref ref, - cairo_font_face_t *cairo_font_face, - int *codeToGID, unsigned int codeToGIDLen, - bool printing, XRef *xref); -}; - -//------------------------------------------------------------------------ - -#define cairoFontCacheSize 64 - -//------------------------------------------------------------------------ -// CairoFontEngine -//------------------------------------------------------------------------ - -class CairoFontEngine { -public: - - // Create a font engine. - CairoFontEngine(FT_Library libA); - ~CairoFontEngine(); - CairoFontEngine(const CairoFontEngine &) = delete; - CairoFontEngine& operator=(const CairoFontEngine &other) = delete; - - CairoFont *getFont(GfxFont *gfxFont, PDFDoc *doc, bool printing, XRef *xref); - -private: - CairoFont *fontCache[cairoFontCacheSize]; - FT_Library lib; - bool useCIDs; - mutable std::recursive_mutex mutex; -}; - -#endif diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc deleted file mode 100644 index 0f3c156..0000000 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.cc +++ /dev/null @@ -1,3573 +0,0 @@ -//======================================================================== -// -// CairoOutputDev.cc -// -// Copyright 2003 Glyph & Cog, LLC -// Copyright 2004 Red Hat, Inc -// -//======================================================================== - -//======================================================================== -// -// 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) 2005-2008 Jeff Muizelaar -// Copyright (C) 2005, 2006 Kristian Høgsberg -// Copyright (C) 2005, 2009, 2012, 2017-2019 Albert Astals Cid -// Copyright (C) 2005 Nickolay V. Shmyrev -// Copyright (C) 2006-2011, 2013, 2014, 2017, 2018 Carlos Garcia Campos -// Copyright (C) 2008 Carl Worth -// Copyright (C) 2008-2018 Adrian Johnson -// Copyright (C) 2008 Michael Vrable -// Copyright (C) 2008, 2009 Chris Wilson -// Copyright (C) 2008, 2012 Hib Eris -// Copyright (C) 2009, 2010 David Benjamin -// Copyright (C) 2011-2014 Thomas Freitag -// Copyright (C) 2012 Patrick Pfeifer -// Copyright (C) 2012, 2015, 2016 Jason Crain -// Copyright (C) 2015 Suzuki Toshiya -// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// Copyright (C) 2018 Adam Reichold -// Copyright (C) 2019 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 -// -//======================================================================== - -#include - -#include -#include -#include -#include -#include - -#include "goo/gfile.h" -#include "GlobalParams.h" -#include "Error.h" -#include "Object.h" -#include "Gfx.h" -#include "GfxState.h" -#include "GfxFont.h" -#include "Page.h" -#include "Link.h" -#include "FontEncodingTables.h" -#include "PDFDocEncoding.h" -#include -#include -#include "CairoOutputDev.h" -#include "CairoFontEngine.h" -#include "CairoRescaleBox.h" -#include "UnicodeMap.h" -#include "JBIG2Stream.h" -//------------------------------------------------------------------------ - -// #define LOG_CAIRO - -// To limit memory usage and improve performance when printing, limit -// cairo images to this size. 8192 is sufficient for an A2 sized -// 300ppi image. -#define MAX_PRINT_IMAGE_SIZE 8192 - -#ifdef LOG_CAIRO -#define LOG(x) (x) -#else -#define LOG(x) -#endif - - -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) - - -//------------------------------------------------------------------------ -// CairoImage -//------------------------------------------------------------------------ - -CairoImage::CairoImage (double x1A, double y1A, double x2A, double y2A) { - image = nullptr; - x1 = x1A; - y1 = y1A; - x2 = x2A; - y2 = y2A; -} - -CairoImage::~CairoImage () { - if (image) - cairo_surface_destroy (image); -} - -void CairoImage::setImage (cairo_surface_t *i) { - if (image) - cairo_surface_destroy (image); - image = cairo_surface_reference (i); -} - -//------------------------------------------------------------------------ -// CairoOutputDev -//------------------------------------------------------------------------ - -// We cannot tie the lifetime of an FT_Library object to that of -// CairoOutputDev, since any FT_Faces created with it may end up with a -// reference by Cairo which can be held long after the CairoOutputDev is -// deleted. The simplest way to avoid problems is to never tear down the -// FT_Library instance; to avoid leaks, just use a single global instance -// initialized the first time it is needed. -FT_Library CairoOutputDev::ft_lib; -bool CairoOutputDev::ft_lib_initialized = false; - -CairoOutputDev::CairoOutputDev() { - doc = nullptr; - - if (!ft_lib_initialized) { - FT_Init_FreeType(&ft_lib); - ft_lib_initialized = true; - } - - fontEngine = nullptr; - fontEngine_owner = false; - glyphs = nullptr; - fill_pattern = nullptr; - fill_color.r = fill_color.g = fill_color.b = 0; - stroke_pattern = nullptr; - stroke_color.r = stroke_color.g = stroke_color.b = 0; - stroke_opacity = 1.0; - fill_opacity = 1.0; - textClipPath = nullptr; - strokePathClip = nullptr; - cairo = nullptr; - currentFont = nullptr; -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - prescaleImages = false; -#else - prescaleImages = true; -#endif - printing = true; - use_show_text_glyphs = false; - inUncoloredPattern = false; - inType3Char = false; - t3_glyph_has_bbox = false; - text_matrix_valid = true; - antialias = CAIRO_ANTIALIAS_DEFAULT; - - groupColorSpaceStack = nullptr; - maskStack = nullptr; - group = nullptr; - mask = nullptr; - shape = nullptr; - cairo_shape = nullptr; - knockoutCount = 0; - - textPage = nullptr; - actualText = nullptr; - - // the SA parameter supposedly defaults to false, but Acrobat - // apparently hardwires it to true - stroke_adjust = true; - align_stroke_coords = false; - adjusted_stroke_width = false; - xref = nullptr; -} - -CairoOutputDev::~CairoOutputDev() { - if (fontEngine_owner && fontEngine) { - delete fontEngine; - } - - if (cairo) - cairo_destroy (cairo); - cairo_pattern_destroy (stroke_pattern); - cairo_pattern_destroy (fill_pattern); - if (group) - cairo_pattern_destroy (group); - if (mask) - cairo_pattern_destroy (mask); - if (shape) - cairo_pattern_destroy (shape); - if (textPage) - textPage->decRefCnt(); - if (actualText) - delete actualText; -} - -void CairoOutputDev::setCairo(cairo_t *c) -{ - if (cairo != nullptr) { - cairo_status_t status = cairo_status (cairo); - if (status) { - error(errInternal, -1, "cairo context error: {0:s}\n", cairo_status_to_string(status)); - } - cairo_destroy (cairo); - assert(!cairo_shape); - } - if (c != nullptr) { - cairo = cairo_reference (c); - /* save the initial matrix so that we can use it for type3 fonts. */ - //XXX: is this sufficient? could we miss changes to the matrix somehow? - cairo_get_matrix(cairo, &orig_matrix); - setContextAntialias(cairo, antialias); - } else { - cairo = nullptr; - cairo_shape = nullptr; - } -} - -void CairoOutputDev::setTextPage(TextPage *text) -{ - if (textPage) - textPage->decRefCnt(); - if (actualText) - delete actualText; - if (text) { - textPage = text; - textPage->incRefCnt(); - actualText = new ActualText(text); - } else { - textPage = nullptr; - actualText = nullptr; - } -} - -void CairoOutputDev::setAntialias(cairo_antialias_t a) -{ - antialias = a; - if (cairo) - setContextAntialias (cairo, antialias); - if (cairo_shape) - setContextAntialias (cairo_shape, antialias); -} - -void CairoOutputDev::setContextAntialias(cairo_t *cr, cairo_antialias_t antialias) -{ - cairo_font_options_t *font_options; - cairo_set_antialias (cr, antialias); - font_options = cairo_font_options_create (); - cairo_get_font_options (cr, font_options); - cairo_font_options_set_antialias (font_options, antialias); - cairo_set_font_options (cr, font_options); - cairo_font_options_destroy (font_options); -} - -void CairoOutputDev::startDoc(PDFDoc *docA, - CairoFontEngine *parentFontEngine) { - doc = docA; - if (parentFontEngine) { - fontEngine = parentFontEngine; - } else { - if (fontEngine) { - delete fontEngine; - } - fontEngine = new CairoFontEngine(ft_lib); - fontEngine_owner = true; - } - xref = doc->getXRef(); -} - -void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { - /* set up some per page defaults */ - cairo_pattern_destroy(fill_pattern); - cairo_pattern_destroy(stroke_pattern); - - fill_pattern = cairo_pattern_create_rgb(0., 0., 0.); - fill_color.r = fill_color.g = fill_color.b = 0; - stroke_pattern = cairo_pattern_reference(fill_pattern); - stroke_color.r = stroke_color.g = stroke_color.b = 0; - - if (textPage) - textPage->startPage(state); - if (xrefA != nullptr) { - xref = xrefA; - } -} - -void CairoOutputDev::endPage() { - if (textPage) { - textPage->endPage(); - textPage->coalesce(true, 0, false); - } -} - -void CairoOutputDev::saveState(GfxState *state) { - LOG(printf ("save\n")); - cairo_save (cairo); - if (cairo_shape) - cairo_save (cairo_shape); - - MaskStack *ms = new MaskStack; - ms->mask = cairo_pattern_reference(mask); - ms->mask_matrix = mask_matrix; - ms->next = maskStack; - maskStack = ms; - - if (strokePathClip) - strokePathClip->ref_count++; -} - -void CairoOutputDev::restoreState(GfxState *state) { - LOG(printf ("restore\n")); - cairo_restore (cairo); - if (cairo_shape) - cairo_restore (cairo_shape); - - text_matrix_valid = true; - - /* These aren't restored by cairo_restore() since we keep them in - * the output device. */ - updateFillColor(state); - updateStrokeColor(state); - updateFillOpacity(state); - updateStrokeOpacity(state); - updateBlendMode(state); - - MaskStack* ms = maskStack; - if (ms) { - if (mask) - cairo_pattern_destroy(mask); - mask = ms->mask; - mask_matrix = ms->mask_matrix; - maskStack = ms->next; - delete ms; - } - - if (strokePathClip && --strokePathClip->ref_count == 0) { - delete strokePathClip->path; - if (strokePathClip->dashes) - gfree (strokePathClip->dashes); - gfree (strokePathClip); - strokePathClip = nullptr; - } -} - -void CairoOutputDev::updateAll(GfxState *state) { - updateLineDash(state); - updateLineJoin(state); - updateLineCap(state); - updateLineWidth(state); - updateFlatness(state); - updateMiterLimit(state); - updateFillColor(state); - updateStrokeColor(state); - updateFillOpacity(state); - updateStrokeOpacity(state); - updateBlendMode(state); - needFontUpdate = true; - if (textPage) - textPage->updateFont(state); -} - -void CairoOutputDev::setDefaultCTM(const double *ctm) { - cairo_matrix_t matrix; - matrix.xx = ctm[0]; - matrix.yx = ctm[1]; - matrix.xy = ctm[2]; - matrix.yy = ctm[3]; - matrix.x0 = ctm[4]; - matrix.y0 = ctm[5]; - - cairo_transform (cairo, &matrix); - if (cairo_shape) - cairo_transform (cairo_shape, &matrix); - - OutputDev::setDefaultCTM(ctm); -} - -void CairoOutputDev::updateCTM(GfxState *state, double m11, double m12, - double m21, double m22, - double m31, double m32) { - cairo_matrix_t matrix, invert_matrix; - matrix.xx = m11; - matrix.yx = m12; - matrix.xy = m21; - matrix.yy = m22; - matrix.x0 = m31; - matrix.y0 = m32; - - /* Make sure the matrix is invertible before setting it. - * cairo will blow up if we give it a matrix that's not - * invertible, so we need to check before passing it - * to cairo_transform. Ignoring it is likely to give better - * results than not rendering anything at all. See #14398 - * - * Ideally, we could do the cairo_transform - * and then check if anything went wrong and fix it then - * instead of having to invert the matrix. */ - invert_matrix = matrix; - if (cairo_matrix_invert(&invert_matrix)) { - error(errSyntaxWarning, -1, "matrix not invertible\n"); - return; - } - - cairo_transform (cairo, &matrix); - if (cairo_shape) - cairo_transform (cairo_shape, &matrix); - updateLineDash(state); - updateLineJoin(state); - updateLineCap(state); - updateLineWidth(state); -} - -void CairoOutputDev::updateLineDash(GfxState *state) { - double *dashPattern; - int dashLength; - double dashStart; - - state->getLineDash(&dashPattern, &dashLength, &dashStart); - cairo_set_dash (cairo, dashPattern, dashLength, dashStart); - if (cairo_shape) - cairo_set_dash (cairo_shape, dashPattern, dashLength, dashStart); -} - -void CairoOutputDev::updateFlatness(GfxState *state) { - // cairo_set_tolerance (cairo, state->getFlatness()); -} - -void CairoOutputDev::updateLineJoin(GfxState *state) { - switch (state->getLineJoin()) { - case 0: - cairo_set_line_join (cairo, CAIRO_LINE_JOIN_MITER); - break; - case 1: - cairo_set_line_join (cairo, CAIRO_LINE_JOIN_ROUND); - break; - case 2: - cairo_set_line_join (cairo, CAIRO_LINE_JOIN_BEVEL); - break; - } - if (cairo_shape) - cairo_set_line_join (cairo_shape, cairo_get_line_join(cairo)); -} - -void CairoOutputDev::updateLineCap(GfxState *state) { - switch (state->getLineCap()) { - case 0: - cairo_set_line_cap (cairo, CAIRO_LINE_CAP_BUTT); - break; - case 1: - cairo_set_line_cap (cairo, CAIRO_LINE_CAP_ROUND); - break; - case 2: - cairo_set_line_cap (cairo, CAIRO_LINE_CAP_SQUARE); - break; - } - if (cairo_shape) - cairo_set_line_cap (cairo_shape, cairo_get_line_cap(cairo)); -} - -void CairoOutputDev::updateMiterLimit(GfxState *state) { - cairo_set_miter_limit (cairo, state->getMiterLimit()); - if (cairo_shape) - cairo_set_miter_limit (cairo_shape, state->getMiterLimit()); -} - -void CairoOutputDev::updateLineWidth(GfxState *state) { - LOG(printf ("line width: %f\n", state->getLineWidth())); - adjusted_stroke_width = false; - double width = state->getLineWidth(); - if (stroke_adjust && !printing) { - double x, y; - x = y = width; - - /* find out line width in device units */ - cairo_user_to_device_distance(cairo, &x, &y); - if (fabs(x) <= 1.0 && fabs(y) <= 1.0) { - /* adjust width to at least one device pixel */ - x = y = 1.0; - cairo_device_to_user_distance(cairo, &x, &y); - width = MIN(fabs(x),fabs(y)); - adjusted_stroke_width = true; - } - } else if (width == 0.0) { - /* Cairo does not support 0 line width == 1 device pixel. Find out - * how big pixels (device unit) are in the x and y - * directions. Choose the smaller of the two as our line width. - */ - double x = 1.0, y = 1.0; - if (printing) { - // assume printer pixel size is 1/600 inch - x = 72.0/600; - y = 72.0/600; - } - cairo_device_to_user_distance(cairo, &x, &y); - width = MIN(fabs(x),fabs(y)); - } - cairo_set_line_width (cairo, width); - if (cairo_shape) - cairo_set_line_width (cairo_shape, cairo_get_line_width (cairo)); -} - -void CairoOutputDev::updateFillColor(GfxState *state) { - GfxRGB color = fill_color; - - if (inUncoloredPattern) - return; - - state->getFillRGB(&fill_color); - if (cairo_pattern_get_type (fill_pattern) != CAIRO_PATTERN_TYPE_SOLID || - color.r != fill_color.r || - color.g != fill_color.g || - color.b != fill_color.b) - { - cairo_pattern_destroy(fill_pattern); - fill_pattern = cairo_pattern_create_rgba(colToDbl(fill_color.r), - colToDbl(fill_color.g), - colToDbl(fill_color.b), - fill_opacity); - - LOG(printf ("fill color: %d %d %d\n", - fill_color.r, fill_color.g, fill_color.b)); - } -} - -void CairoOutputDev::updateStrokeColor(GfxState *state) { - GfxRGB color = stroke_color; - - if (inUncoloredPattern) - return; - - state->getStrokeRGB(&stroke_color); - if (cairo_pattern_get_type (fill_pattern) != CAIRO_PATTERN_TYPE_SOLID || - color.r != stroke_color.r || - color.g != stroke_color.g || - color.b != stroke_color.b) - { - cairo_pattern_destroy(stroke_pattern); - stroke_pattern = cairo_pattern_create_rgba(colToDbl(stroke_color.r), - colToDbl(stroke_color.g), - colToDbl(stroke_color.b), - stroke_opacity); - - LOG(printf ("stroke color: %d %d %d\n", - stroke_color.r, stroke_color.g, stroke_color.b)); - } -} - -void CairoOutputDev::updateFillOpacity(GfxState *state) { - double opacity = fill_opacity; - - if (inUncoloredPattern) - return; - - fill_opacity = state->getFillOpacity(); - if (opacity != fill_opacity) { - cairo_pattern_destroy(fill_pattern); - fill_pattern = cairo_pattern_create_rgba(colToDbl(fill_color.r), - colToDbl(fill_color.g), - colToDbl(fill_color.b), - fill_opacity); - - LOG(printf ("fill opacity: %f\n", fill_opacity)); - } -} - -void CairoOutputDev::updateStrokeOpacity(GfxState *state) { - double opacity = stroke_opacity; - - if (inUncoloredPattern) - return; - - stroke_opacity = state->getStrokeOpacity(); - if (opacity != stroke_opacity) { - cairo_pattern_destroy(stroke_pattern); - stroke_pattern = cairo_pattern_create_rgba(colToDbl(stroke_color.r), - colToDbl(stroke_color.g), - colToDbl(stroke_color.b), - stroke_opacity); - - LOG(printf ("stroke opacity: %f\n", stroke_opacity)); - } -} - -void CairoOutputDev::updateFillColorStop(GfxState *state, double offset) { - if (inUncoloredPattern) - return; - - state->getFillRGB(&fill_color); - - cairo_pattern_add_color_stop_rgba(fill_pattern, offset, - colToDbl(fill_color.r), - colToDbl(fill_color.g), - colToDbl(fill_color.b), - fill_opacity); - LOG(printf ("fill color stop: %f (%d, %d, %d)\n", - offset, fill_color.r, fill_color.g, fill_color.b)); -} - -void CairoOutputDev::updateBlendMode(GfxState *state) { - switch (state->getBlendMode()) { - default: - case gfxBlendNormal: - cairo_set_operator (cairo, CAIRO_OPERATOR_OVER); - break; - case gfxBlendMultiply: - cairo_set_operator (cairo, CAIRO_OPERATOR_MULTIPLY); - break; - case gfxBlendScreen: - cairo_set_operator (cairo, CAIRO_OPERATOR_SCREEN); - break; - case gfxBlendOverlay: - cairo_set_operator (cairo, CAIRO_OPERATOR_OVERLAY); - break; - case gfxBlendDarken: - cairo_set_operator (cairo, CAIRO_OPERATOR_DARKEN); - break; - case gfxBlendLighten: - cairo_set_operator (cairo, CAIRO_OPERATOR_LIGHTEN); - break; - case gfxBlendColorDodge: - cairo_set_operator (cairo, CAIRO_OPERATOR_COLOR_DODGE); - break; - case gfxBlendColorBurn: - cairo_set_operator (cairo, CAIRO_OPERATOR_COLOR_BURN); - break; - case gfxBlendHardLight: - cairo_set_operator (cairo, CAIRO_OPERATOR_HARD_LIGHT); - break; - case gfxBlendSoftLight: - cairo_set_operator (cairo, CAIRO_OPERATOR_SOFT_LIGHT); - break; - case gfxBlendDifference: - cairo_set_operator (cairo, CAIRO_OPERATOR_DIFFERENCE); - break; - case gfxBlendExclusion: - cairo_set_operator (cairo, CAIRO_OPERATOR_EXCLUSION); - break; - case gfxBlendHue: - cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_HUE); - break; - case gfxBlendSaturation: - cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_SATURATION); - break; - case gfxBlendColor: - cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_COLOR); - break; - case gfxBlendLuminosity: - cairo_set_operator (cairo, CAIRO_OPERATOR_HSL_LUMINOSITY); - break; - } - LOG(printf ("blend mode: %d\n", (int)state->getBlendMode())); -} - -void CairoOutputDev::updateFont(GfxState *state) { - cairo_font_face_t *font_face; - cairo_matrix_t matrix, invert_matrix; - - LOG(printf ("updateFont() font=%s\n", state->getFont()->getName()->c_str())); - - needFontUpdate = false; - - //FIXME: use cairo font engine? - if (textPage) - textPage->updateFont(state); - - currentFont = fontEngine->getFont (state->getFont(), doc, printing, xref); - - if (!currentFont) - return; - - font_face = currentFont->getFontFace(); - cairo_set_font_face (cairo, font_face); - - use_show_text_glyphs = state->getFont()->hasToUnicodeCMap() && - cairo_surface_has_show_text_glyphs (cairo_get_target (cairo)); - - double fontSize = state->getFontSize(); - const double *m = state->getTextMat(); - /* NOTE: adjusting by a constant is hack. The correct solution - * is probably to use user-fonts and compute the scale on a per - * glyph basis instead of for the entire font */ - double w = currentFont->getSubstitutionCorrection(state->getFont()); - matrix.xx = m[0] * fontSize * state->getHorizScaling() * w; - matrix.yx = m[1] * fontSize * state->getHorizScaling() * w; - matrix.xy = -m[2] * fontSize; - matrix.yy = -m[3] * fontSize; - matrix.x0 = 0; - matrix.y0 = 0; - - LOG(printf ("font matrix: %f %f %f %f\n", matrix.xx, matrix.yx, matrix.xy, matrix.yy)); - - /* Make sure the font matrix is invertible before setting it. cairo - * will blow up if we give it a matrix that's not invertible, so we - * need to check before passing it to cairo_set_font_matrix. Ignoring it - * is likely to give better results than not rendering anything at - * all. See #18254. - */ - invert_matrix = matrix; - if (cairo_matrix_invert(&invert_matrix)) { - error(errSyntaxWarning, -1, "font matrix not invertible"); - text_matrix_valid = false; - return; - } - - cairo_set_font_matrix (cairo, &matrix); - text_matrix_valid = true; -} - -/* Tolerance in pixels for checking if strokes are horizontal or vertical - * lines in device space */ -#define STROKE_COORD_TOLERANCE 0.5 - -/* Align stroke coordinate i if the point is the start or end of a - * horizontal or vertical line */ -void CairoOutputDev::alignStrokeCoords(const GfxSubpath *subpath, int i, double *x, double *y) -{ - double x1, y1, x2, y2; - bool align = false; - - x1 = subpath->getX(i); - y1 = subpath->getY(i); - cairo_user_to_device (cairo, &x1, &y1); - - // Does the current coord and prev coord form a horiz or vert line? - if (i > 0 && !subpath->getCurve(i - 1)) { - x2 = subpath->getX(i - 1); - y2 = subpath->getY(i - 1); - cairo_user_to_device (cairo, &x2, &y2); - if (fabs(x2 - x1) < STROKE_COORD_TOLERANCE || fabs(y2 - y1) < STROKE_COORD_TOLERANCE) - align = true; - } - - // Does the current coord and next coord form a horiz or vert line? - if (i < subpath->getNumPoints() - 1 && !subpath->getCurve(i + 1)) { - x2 = subpath->getX(i + 1); - y2 = subpath->getY(i + 1); - cairo_user_to_device (cairo, &x2, &y2); - if (fabs(x2 - x1) < STROKE_COORD_TOLERANCE || fabs(y2 - y1) < STROKE_COORD_TOLERANCE) - align = true; - } - - *x = subpath->getX(i); - *y = subpath->getY(i); - if (align) { - /* see http://www.cairographics.org/FAQ/#sharp_lines */ - cairo_user_to_device (cairo, x, y); - *x = floor(*x) + 0.5; - *y = floor(*y) + 0.5; - cairo_device_to_user (cairo, x, y); - } -} - -#undef STROKE_COORD_TOLERANCE - -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) { - const GfxSubpath *subpath = path->getSubpath(i); - if (subpath->getNumPoints() > 0) { - if (align_stroke_coords) { - alignStrokeCoords(subpath, 0, &x, &y); - } else { - x = subpath->getX(0); - y = subpath->getY(0); - } - cairo_move_to (c, x, y); - j = 1; - while (j < subpath->getNumPoints()) { - if (subpath->getCurve(j)) { - if (align_stroke_coords) { - alignStrokeCoords(subpath, j + 2, &x, &y); - } else { - x = subpath->getX(j+2); - y = subpath->getY(j+2); - } - cairo_curve_to( c, - subpath->getX(j), subpath->getY(j), - subpath->getX(j+1), subpath->getY(j+1), - x, y); - - j += 3; - } else { - if (align_stroke_coords) { - alignStrokeCoords(subpath, j, &x, &y); - } else { - x = subpath->getX(j); - y = subpath->getY(j); - } - cairo_line_to (c, x, y); - ++j; - } - } - if (subpath->isClosed()) { - LOG (printf ("close\n")); - cairo_close_path (c); - } - } - } -} - -void CairoOutputDev::stroke(GfxState *state) { - if (inType3Char) { - GfxGray gray; - state->getFillGray(&gray); - if (colToDbl(gray) > 0.5) - return; - } - - if (adjusted_stroke_width) - align_stroke_coords = true; - doPath (cairo, state, state->getPath()); - align_stroke_coords = false; - cairo_set_source (cairo, stroke_pattern); - LOG(printf ("stroke\n")); - if (strokePathClip) { - cairo_push_group (cairo); - cairo_stroke (cairo); - cairo_pop_group_to_source (cairo); - fillToStrokePathClip (state); - } else { - cairo_stroke (cairo); - } - if (cairo_shape) { - doPath (cairo_shape, state, state->getPath()); - cairo_stroke (cairo_shape); - } -} - -void CairoOutputDev::fill(GfxState *state) { - if (inType3Char) { - GfxGray gray; - state->getFillGray(&gray); - if (colToDbl(gray) > 0.5) - return; - } - - doPath (cairo, state, state->getPath()); - cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING); - cairo_set_source (cairo, fill_pattern); - LOG(printf ("fill\n")); - //XXX: how do we get the path - if (mask) { - cairo_save (cairo); - cairo_clip (cairo); - if (strokePathClip) { - cairo_push_group (cairo); - fillToStrokePathClip (state); - cairo_pop_group_to_source (cairo); - } - cairo_set_matrix (cairo, &mask_matrix); - cairo_mask (cairo, mask); - cairo_restore (cairo); - } else if (strokePathClip) { - fillToStrokePathClip(state); - } else { - cairo_fill (cairo); - } - if (cairo_shape) { - cairo_set_fill_rule (cairo_shape, CAIRO_FILL_RULE_WINDING); - doPath (cairo_shape, state, state->getPath()); - cairo_fill (cairo_shape); - } -} - -void CairoOutputDev::eoFill(GfxState *state) { - doPath (cairo, state, state->getPath()); - cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_EVEN_ODD); - cairo_set_source (cairo, fill_pattern); - LOG(printf ("fill-eo\n")); - - if (mask) { - cairo_save (cairo); - cairo_clip (cairo); - cairo_set_matrix (cairo, &mask_matrix); - cairo_mask (cairo, mask); - cairo_restore (cairo); - } else { - cairo_fill (cairo); - } - if (cairo_shape) { - cairo_set_fill_rule (cairo_shape, CAIRO_FILL_RULE_EVEN_ODD); - doPath (cairo_shape, state, state->getPath()); - cairo_fill (cairo_shape); - } - -} - -bool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, - const double *pmat, int paintType, int /*tilingType*/, Dict *resDict, - const double *mat, const double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep) -{ - PDFRectangle box; - Gfx *gfx; - cairo_pattern_t *pattern; - cairo_surface_t *surface; - cairo_matrix_t matrix; - cairo_matrix_t pattern_matrix; - cairo_t *old_cairo; - double xMin, yMin, xMax, yMax; - double width, height; - double scaleX, scaleY; - int surface_width, surface_height; - StrokePathClip *strokePathTmp; - bool adjusted_stroke_width_tmp; - cairo_pattern_t *maskTmp; - - width = bbox[2] - bbox[0]; - height = bbox[3] - bbox[1]; - - if (xStep != width || yStep != height) - return false; - /* TODO: implement the other cases here too */ - - // Find the width and height of the transformed pattern - cairo_get_matrix (cairo, &matrix); - cairo_matrix_init (&pattern_matrix, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]); - cairo_matrix_multiply (&matrix, &matrix, &pattern_matrix); - - double widthX = width, widthY = 0; - cairo_matrix_transform_distance (&matrix, &widthX, &widthY); - surface_width = ceil (sqrt (widthX * widthX + widthY * widthY)); - - double heightX = 0, heightY = height; - cairo_matrix_transform_distance (&matrix, &heightX, &heightY); - surface_height = ceil (sqrt (heightX * heightX + heightY * heightY)); - scaleX = surface_width / width; - scaleY = surface_height / height; - - surface = cairo_surface_create_similar (cairo_get_target (cairo), - CAIRO_CONTENT_COLOR_ALPHA, - surface_width, surface_height); - if (cairo_surface_status (surface)) - return false; - - old_cairo = cairo; - cairo = cairo_create (surface); - cairo_surface_destroy (surface); - setContextAntialias(cairo, antialias); - - box.x1 = bbox[0]; box.y1 = bbox[1]; - box.x2 = bbox[2]; box.y2 = bbox[3]; - cairo_scale (cairo, scaleX, scaleY); - cairo_translate (cairo, -box.x1, -box.y1); - - strokePathTmp = strokePathClip; - strokePathClip = nullptr; - adjusted_stroke_width_tmp = adjusted_stroke_width; - maskTmp = mask; - mask = nullptr; - gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA); - if (paintType == 2) - inUncoloredPattern = true; - gfx->display(str); - if (paintType == 2) - inUncoloredPattern = false; - delete gfx; - strokePathClip = strokePathTmp; - adjusted_stroke_width = adjusted_stroke_width_tmp; - mask = maskTmp; - - pattern = cairo_pattern_create_for_surface (cairo_get_target (cairo)); - cairo_destroy (cairo); - cairo = old_cairo; - if (cairo_pattern_status (pattern)) - return false; - - state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); - cairo_rectangle (cairo, xMin, yMin, xMax - xMin, yMax - yMin); - - cairo_matrix_init_scale (&matrix, scaleX, scaleY); - cairo_matrix_translate (&matrix, -box.x1, -box.y1); - cairo_pattern_set_matrix (pattern, &matrix); - - cairo_transform (cairo, &pattern_matrix); - cairo_set_source (cairo, pattern); - cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); - if (strokePathClip) { - fillToStrokePathClip(state); - } else { - cairo_fill (cairo); - } - - cairo_pattern_destroy (pattern); - - return true; -} - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) -bool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) -{ - // Function shaded fills are subdivided to rectangles that are the - // following size in device space. Note when printing this size is - // in points. - const int subdivide_pixels = 10; - - double x_begin, x_end, x1, x2; - double y_begin, y_end, y1, y2; - double x_step; - double y_step; - GfxColor color; - GfxRGB rgb; - cairo_matrix_t mat; - - const double *matrix = shading->getMatrix(); - mat.xx = matrix[0]; - mat.yx = matrix[1]; - mat.xy = matrix[2]; - mat.yy = matrix[3]; - mat.x0 = matrix[4]; - mat.y0 = matrix[5]; - if (cairo_matrix_invert(&mat)) { - error(errSyntaxWarning, -1, "matrix not invertible\n"); - return false; - } - - // get cell size in pattern space - x_step = y_step = subdivide_pixels; - cairo_matrix_transform_distance (&mat, &x_step, &y_step); - - cairo_pattern_destroy(fill_pattern); - fill_pattern = cairo_pattern_create_mesh (); - cairo_pattern_set_matrix(fill_pattern, &mat); - shading->getDomain(&x_begin, &y_begin, &x_end, &y_end); - - for (x1 = x_begin; x1 < x_end; x1 += x_step) { - x2 = x1 + x_step; - if (x2 > x_end) - x2 = x_end; - - for (y1 = y_begin; y1 < y_end; y1 += y_step) { - y2 = y1 + y_step; - if (y2 > y_end) - y2 = y_end; - - cairo_mesh_pattern_begin_patch (fill_pattern); - cairo_mesh_pattern_move_to (fill_pattern, x1, y1); - cairo_mesh_pattern_line_to (fill_pattern, x2, y1); - cairo_mesh_pattern_line_to (fill_pattern, x2, y2); - cairo_mesh_pattern_line_to (fill_pattern, x1, y2); - - shading->getColor(x1, y1, &color); - shading->getColorSpace()->getRGB(&color, &rgb); - cairo_mesh_pattern_set_corner_color_rgb (fill_pattern, 0, - colToDbl(rgb.r), - colToDbl(rgb.g), - colToDbl(rgb.b)); - - shading->getColor(x2, y1, &color); - shading->getColorSpace()->getRGB(&color, &rgb); - cairo_mesh_pattern_set_corner_color_rgb (fill_pattern, 1, - colToDbl(rgb.r), - colToDbl(rgb.g), - colToDbl(rgb.b)); - - shading->getColor(x2, y2, &color); - shading->getColorSpace()->getRGB(&color, &rgb); - cairo_mesh_pattern_set_corner_color_rgb (fill_pattern, 2, - colToDbl(rgb.r), - colToDbl(rgb.g), - colToDbl(rgb.b)); - - shading->getColor(x1, y2, &color); - shading->getColorSpace()->getRGB(&color, &rgb); - cairo_mesh_pattern_set_corner_color_rgb (fill_pattern, 3, - colToDbl(rgb.r), - colToDbl(rgb.g), - colToDbl(rgb.b)); - - cairo_mesh_pattern_end_patch (fill_pattern); - } - } - - double xMin, yMin, xMax, yMax; - // get the clip region bbox - state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); - state->moveTo(xMin, yMin); - state->lineTo(xMin, yMax); - state->lineTo(xMax, yMax); - state->lineTo(xMax, yMin); - state->closePath(); - fill(state); - state->clearPath(); - - return true; -} -#endif /* CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) */ - -bool CairoOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { - double x0, y0, x1, y1; - double dx, dy; - - shading->getCoords(&x0, &y0, &x1, &y1); - dx = x1 - x0; - dy = y1 - y0; - - cairo_pattern_destroy(fill_pattern); - fill_pattern = cairo_pattern_create_linear (x0 + tMin * dx, y0 + tMin * dy, - x0 + tMax * dx, y0 + tMax * dy); - if (!shading->getExtend0() && !shading->getExtend1()) - cairo_pattern_set_extend (fill_pattern, CAIRO_EXTEND_NONE); - else - cairo_pattern_set_extend (fill_pattern, CAIRO_EXTEND_PAD); - - LOG (printf ("axial-sh\n")); - - // TODO: use the actual stops in the shading in the case - // of linear interpolation (Type 2 Exponential functions with N=1) - return false; -} - -bool CairoOutputDev::axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) -{ - return (shading->getExtend0() == shading->getExtend1()); -} - -bool CairoOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) { - double x0, y0, r0, x1, y1, r1; - double dx, dy, dr; - cairo_matrix_t matrix; - double scale; - - shading->getCoords(&x0, &y0, &r0, &x1, &y1, &r1); - dx = x1 - x0; - dy = y1 - y0; - dr = r1 - r0; - - // Cairo/pixman do not work well with a very large or small scaled - // matrix. See cairo bug #81657. - // - // As a workaround, scale the pattern by the average of the vertical - // and horizontal scaling of the current transformation matrix. - cairo_get_matrix(cairo, &matrix); - scale = (sqrt(matrix.xx * matrix.xx + matrix.yx * matrix.yx) - + sqrt(matrix.xy * matrix.xy + matrix.yy * matrix.yy)) / 2; - cairo_matrix_init_scale(&matrix, scale, scale); - - cairo_pattern_destroy(fill_pattern); - fill_pattern = cairo_pattern_create_radial ((x0 + sMin * dx) * scale, - (y0 + sMin * dy) * scale, - (r0 + sMin * dr) * scale, - (x0 + sMax * dx) * scale, - (y0 + sMax * dy) * scale, - (r0 + sMax * dr) * scale); - cairo_pattern_set_matrix(fill_pattern, &matrix); - if (shading->getExtend0() && shading->getExtend1()) - cairo_pattern_set_extend (fill_pattern, CAIRO_EXTEND_PAD); - else - cairo_pattern_set_extend (fill_pattern, CAIRO_EXTEND_NONE); - - LOG (printf ("radial-sh\n")); - - return false; -} - -bool CairoOutputDev::radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) -{ - return (shading->getExtend0() == shading->getExtend1()); -} - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) -bool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) -{ - double x0, y0, x1, y1, x2, y2; - GfxColor color[3]; - int i, j; - GfxRGB rgb; - - cairo_pattern_destroy(fill_pattern); - fill_pattern = cairo_pattern_create_mesh (); - - for (i = 0; i < shading->getNTriangles(); i++) { - if (shading->isParameterized()) { - double color0, color1, color2; - shading->getTriangle(i, &x0, &y0, &color0, - &x1, &y1, &color1, - &x2, &y2, &color2); - shading->getParameterizedColor(color0, &color[0]); - shading->getParameterizedColor(color1, &color[1]); - shading->getParameterizedColor(color2, &color[2]); - } else { - shading->getTriangle(i, - &x0, &y0, &color[0], - &x1, &y1, &color[1], - &x2, &y2, &color[2]); - - } - - cairo_mesh_pattern_begin_patch (fill_pattern); - - cairo_mesh_pattern_move_to (fill_pattern, x0, y0); - cairo_mesh_pattern_line_to (fill_pattern, x1, y1); - cairo_mesh_pattern_line_to (fill_pattern, x2, y2); - - for (j = 0; j < 3; j++) { - shading->getColorSpace()->getRGB(&color[j], &rgb); - cairo_mesh_pattern_set_corner_color_rgb (fill_pattern, j, - colToDbl(rgb.r), - colToDbl(rgb.g), - colToDbl(rgb.b)); - } - - cairo_mesh_pattern_end_patch (fill_pattern); - } - - double xMin, yMin, xMax, yMax; - // get the clip region bbox - state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); - state->moveTo(xMin, yMin); - state->lineTo(xMin, yMax); - state->lineTo(xMax, yMax); - state->lineTo(xMax, yMin); - state->closePath(); - fill(state); - state->clearPath(); - - return true; -} - -bool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) -{ - int i, j, k; - - cairo_pattern_destroy(fill_pattern); - fill_pattern = cairo_pattern_create_mesh (); - - for (i = 0; i < shading->getNPatches(); i++) { - const GfxPatch *patch = shading->getPatch(i); - GfxColor color; - GfxRGB rgb; - - cairo_mesh_pattern_begin_patch (fill_pattern); - - cairo_mesh_pattern_move_to (fill_pattern, patch->x[0][0], patch->y[0][0]); - cairo_mesh_pattern_curve_to (fill_pattern, - patch->x[0][1], patch->y[0][1], - patch->x[0][2], patch->y[0][2], - patch->x[0][3], patch->y[0][3]); - - cairo_mesh_pattern_curve_to (fill_pattern, - patch->x[1][3], patch->y[1][3], - patch->x[2][3], patch->y[2][3], - patch->x[3][3], patch->y[3][3]); - - cairo_mesh_pattern_curve_to (fill_pattern, - patch->x[3][2], patch->y[3][2], - patch->x[3][1], patch->y[3][1], - patch->x[3][0], patch->y[3][0]); - - cairo_mesh_pattern_curve_to (fill_pattern, - patch->x[2][0], patch->y[2][0], - patch->x[1][0], patch->y[1][0], - patch->x[0][0], patch->y[0][0]); - - cairo_mesh_pattern_set_control_point (fill_pattern, 0, patch->x[1][1], patch->y[1][1]); - cairo_mesh_pattern_set_control_point (fill_pattern, 1, patch->x[1][2], patch->y[1][2]); - cairo_mesh_pattern_set_control_point (fill_pattern, 2, patch->x[2][2], patch->y[2][2]); - cairo_mesh_pattern_set_control_point (fill_pattern, 3, patch->x[2][1], patch->y[2][1]); - - for (j = 0; j < 4; j++) { - int u, v; - - switch (j) { - case 0: - u = 0; v = 0; - break; - case 1: - u = 0; v = 1; - break; - case 2: - u = 1; v = 1; - break; - case 3: - u = 1; v = 0; - break; - } - - if (shading->isParameterized()) { - shading->getParameterizedColor (patch->color[u][v].c[0], &color); - } else { - for (k = 0; k < shading->getColorSpace()->getNComps(); k++) { - // simply cast to the desired type; that's all what is needed. - color.c[k] = GfxColorComp (patch->color[u][v].c[k]); - } - } - - shading->getColorSpace()->getRGB(&color, &rgb); - cairo_mesh_pattern_set_corner_color_rgb (fill_pattern, j, - colToDbl(rgb.r), - colToDbl(rgb.g), - colToDbl(rgb.b)); - } - cairo_mesh_pattern_end_patch (fill_pattern); - } - - double xMin, yMin, xMax, yMax; - // get the clip region bbox - state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); - state->moveTo(xMin, yMin); - state->lineTo(xMin, yMax); - state->lineTo(xMax, yMax); - state->lineTo(xMax, yMin); - state->closePath(); - fill(state); - state->clearPath(); - - return true; -} -#endif /* CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) */ - -void CairoOutputDev::clip(GfxState *state) { - doPath (cairo, state, state->getPath()); - cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING); - cairo_clip (cairo); - LOG (printf ("clip\n")); - if (cairo_shape) { - doPath (cairo_shape, state, state->getPath()); - cairo_set_fill_rule (cairo_shape, CAIRO_FILL_RULE_WINDING); - cairo_clip (cairo_shape); - } -} - -void CairoOutputDev::eoClip(GfxState *state) { - doPath (cairo, state, state->getPath()); - cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_EVEN_ODD); - cairo_clip (cairo); - LOG (printf ("clip-eo\n")); - if (cairo_shape) { - doPath (cairo_shape, state, state->getPath()); - cairo_set_fill_rule (cairo_shape, CAIRO_FILL_RULE_EVEN_ODD); - cairo_clip (cairo_shape); - } - -} - -void CairoOutputDev::clipToStrokePath(GfxState *state) { - LOG(printf("clip-to-stroke-path\n")); - strokePathClip = (StrokePathClip*)gmalloc (sizeof(*strokePathClip)); - strokePathClip->path = state->getPath()->copy(); - cairo_get_matrix (cairo, &strokePathClip->ctm); - strokePathClip->line_width = cairo_get_line_width (cairo); - strokePathClip->dash_count = cairo_get_dash_count (cairo); - if (strokePathClip->dash_count) { - strokePathClip->dashes = (double*) gmallocn (sizeof(double), strokePathClip->dash_count); - cairo_get_dash (cairo, strokePathClip->dashes, &strokePathClip->dash_offset); - } else { - strokePathClip->dashes = nullptr; - } - strokePathClip->cap = cairo_get_line_cap (cairo); - strokePathClip->join = cairo_get_line_join (cairo); - strokePathClip->miter = cairo_get_miter_limit (cairo); - strokePathClip->ref_count = 1; -} - -void CairoOutputDev::fillToStrokePathClip(GfxState *state) { - cairo_save (cairo); - - cairo_set_matrix (cairo, &strokePathClip->ctm); - cairo_set_line_width (cairo, strokePathClip->line_width); - cairo_set_dash (cairo, strokePathClip->dashes, strokePathClip->dash_count, strokePathClip->dash_offset); - cairo_set_line_cap (cairo, strokePathClip->cap); - cairo_set_line_join (cairo, strokePathClip->join); - cairo_set_miter_limit (cairo, strokePathClip->miter); - doPath (cairo, state, strokePathClip->path); - cairo_stroke (cairo); - - cairo_restore (cairo); -} - -void CairoOutputDev::beginString(GfxState *state, const GooString *s) -{ - int len = s->getLength(); - - if (needFontUpdate) - updateFont(state); - - if (!currentFont) - return; - - glyphs = (cairo_glyph_t *) gmallocn (len, sizeof (cairo_glyph_t)); - glyphCount = 0; - if (use_show_text_glyphs) { - clusters = (cairo_text_cluster_t *) gmallocn (len, sizeof (cairo_text_cluster_t)); - clusterCount = 0; - utf8Max = len*2; // start with twice the number of glyphs. we will realloc if we need more. - utf8 = (char *) gmalloc (utf8Max); - utf8Count = 0; - } -} - -void CairoOutputDev::drawChar(GfxState *state, double x, double y, - double dx, double dy, - double originX, double originY, - CharCode code, int nBytes, const Unicode *u, int uLen) -{ - if (currentFont) { - glyphs[glyphCount].index = currentFont->getGlyph (code, u, uLen); - glyphs[glyphCount].x = x - originX; - glyphs[glyphCount].y = y - originY; - glyphCount++; - if (use_show_text_glyphs) { - GooString enc("UTF-8"); - UnicodeMap *utf8Map = globalParams->getUnicodeMap(&enc); - if (utf8Max - utf8Count < uLen*6) { - // utf8 encoded characters can be up to 6 bytes - if (utf8Max > uLen*6) - utf8Max *= 2; - else - utf8Max += 2*uLen*6; - utf8 = (char *) grealloc (utf8, utf8Max); - } - clusters[clusterCount].num_bytes = 0; - for (int i = 0; i < uLen; i++) { - int size = utf8Map->mapUnicode(u[i], utf8 + utf8Count, utf8Max - utf8Count); - utf8Count += size; - clusters[clusterCount].num_bytes += size; - } - clusters[clusterCount].num_glyphs = 1; - clusterCount++; - } - } - - if (!textPage) - return; - actualText->addChar (state, x, y, dx, dy, code, nBytes, u, uLen); -} - -void CairoOutputDev::endString(GfxState *state) -{ - int render; - - if (!currentFont) - return; - - // endString can be called without a corresponding beginString. If this - // happens glyphs will be null so don't draw anything, just return. - // XXX: OutputDevs should probably not have to deal with this... - if (!glyphs) - return; - - // ignore empty strings and invisible text -- this is used by - // Acrobat Capture - render = state->getRender(); - if (render == 3 || glyphCount == 0 || !text_matrix_valid) { - goto finish; - } - - if (!(render & 1)) { - LOG (printf ("fill string\n")); - cairo_set_source (cairo, fill_pattern); - if (use_show_text_glyphs) - cairo_show_text_glyphs (cairo, utf8, utf8Count, glyphs, glyphCount, clusters, clusterCount, (cairo_text_cluster_flags_t)0); - else - cairo_show_glyphs (cairo, glyphs, glyphCount); - if (cairo_shape) - cairo_show_glyphs (cairo_shape, glyphs, glyphCount); - } - - // stroke - if ((render & 3) == 1 || (render & 3) == 2) { - LOG (printf ("stroke string\n")); - cairo_set_source (cairo, stroke_pattern); - cairo_glyph_path (cairo, glyphs, glyphCount); - cairo_stroke (cairo); - if (cairo_shape) { - cairo_glyph_path (cairo_shape, glyphs, glyphCount); - cairo_stroke (cairo_shape); - } - } - - // clip - if ((render & 4)) { - LOG (printf ("clip string\n")); - // append the glyph path to textClipPath. - - // set textClipPath as the currentPath - if (textClipPath) { - cairo_append_path (cairo, textClipPath); - if (cairo_shape) { - cairo_append_path (cairo_shape, textClipPath); - } - cairo_path_destroy (textClipPath); - } - - // append the glyph path - cairo_glyph_path (cairo, glyphs, glyphCount); - - // move the path back into textClipPath - // and clear the current path - textClipPath = cairo_copy_path (cairo); - cairo_new_path (cairo); - if (cairo_shape) { - cairo_new_path (cairo_shape); - } - } - -finish: - gfree (glyphs); - glyphs = nullptr; - if (use_show_text_glyphs) { - gfree (clusters); - clusters = nullptr; - gfree (utf8); - utf8 = nullptr; - } -} - - -bool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, - double dx, double dy, - CharCode code, const Unicode *u, int uLen) { - - cairo_save (cairo); - cairo_matrix_t matrix; - - const double *ctm = state->getCTM(); - matrix.xx = ctm[0]; - matrix.yx = ctm[1]; - matrix.xy = ctm[2]; - matrix.yy = ctm[3]; - matrix.x0 = ctm[4]; - matrix.y0 = ctm[5]; - /* Restore the original matrix and then transform to matrix needed for the - * type3 font. This is ugly but seems to work. Perhaps there is a better way to do it?*/ - cairo_set_matrix(cairo, &orig_matrix); - cairo_transform(cairo, &matrix); - if (cairo_shape) { - cairo_save (cairo_shape); - cairo_set_matrix(cairo_shape, &orig_matrix); - cairo_transform(cairo_shape, &matrix); - } - cairo_pattern_destroy(stroke_pattern); - cairo_pattern_reference(fill_pattern); - stroke_pattern = fill_pattern; - return false; -} - -void CairoOutputDev::endType3Char(GfxState *state) { - cairo_restore (cairo); - if (cairo_shape) { - cairo_restore (cairo_shape); - } -} - -void CairoOutputDev::type3D0(GfxState *state, double wx, double wy) { - t3_glyph_wx = wx; - t3_glyph_wy = wy; -} - -void CairoOutputDev::type3D1(GfxState *state, double wx, double wy, - double llx, double lly, double urx, double ury) { - t3_glyph_wx = wx; - t3_glyph_wy = wy; - t3_glyph_bbox[0] = llx; - t3_glyph_bbox[1] = lly; - t3_glyph_bbox[2] = urx; - t3_glyph_bbox[3] = ury; - t3_glyph_has_bbox = true; -} - -void CairoOutputDev::beginTextObject(GfxState *state) { -} - -void CairoOutputDev::endTextObject(GfxState *state) { - if (textClipPath) { - // clip the accumulated text path - cairo_append_path (cairo, textClipPath); - cairo_clip (cairo); - if (cairo_shape) { - cairo_append_path (cairo_shape, textClipPath); - cairo_clip (cairo_shape); - } - cairo_path_destroy (textClipPath); - textClipPath = nullptr; - } -} - -void CairoOutputDev::beginActualText(GfxState *state, const GooString *text) -{ - if (textPage) - actualText->begin(state, text); -} - -void CairoOutputDev::endActualText(GfxState *state) -{ - if (textPage) - actualText->end(state); -} - -static inline int splashRound(SplashCoord x) { - return (int)floor(x + 0.5); -} - -static inline int splashCeil(SplashCoord x) { - return (int)ceil(x); -} - -static inline int splashFloor(SplashCoord x) { - return (int)floor(x); -} - -static -cairo_surface_t *cairo_surface_create_similar_clip (cairo_t *cairo, cairo_content_t content) -{ - cairo_pattern_t *pattern; - cairo_surface_t *surface = nullptr; - - cairo_push_group_with_content (cairo, content); - pattern = cairo_pop_group (cairo); - cairo_pattern_get_surface (pattern, &surface); - cairo_surface_reference (surface); - cairo_pattern_destroy (pattern); - return surface; -} - - - -void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, - GfxColorSpace * blendingColorSpace, - bool /*isolated*/, bool knockout, - bool forSoftMask) { - /* push color space */ - ColorSpaceStack* css = new ColorSpaceStack; - css->cs = blendingColorSpace; - css->knockout = knockout; - cairo_get_matrix(cairo, &css->group_matrix); - css->next = groupColorSpaceStack; - groupColorSpaceStack = css; - - LOG(printf ("begin transparency group. knockout: %s\n", knockout ? "yes":"no")); - - if (knockout) { - knockoutCount++; - if (!cairo_shape) { - /* create a surface for tracking the shape */ - cairo_surface_t *cairo_shape_surface = cairo_surface_create_similar_clip (cairo, CAIRO_CONTENT_ALPHA); - cairo_shape = cairo_create (cairo_shape_surface); - cairo_surface_destroy (cairo_shape_surface); - setContextAntialias(cairo_shape, antialias); - - /* the color doesn't matter as long as it is opaque */ - cairo_set_source_rgb (cairo_shape, 0, 0, 0); - cairo_matrix_t matrix; - cairo_get_matrix (cairo, &matrix); - cairo_set_matrix (cairo_shape, &matrix); - } - } - if (groupColorSpaceStack->next && groupColorSpaceStack->next->knockout) { - /* we need to track the shape */ - cairo_push_group (cairo_shape); - } - if (0 && forSoftMask) - cairo_push_group_with_content (cairo, CAIRO_CONTENT_ALPHA); - else - cairo_push_group (cairo); - - /* push_group has an implicit cairo_save() */ - if (knockout) { - /*XXX: let's hope this matches the semantics needed */ - cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE); - } else { - cairo_set_operator(cairo, CAIRO_OPERATOR_OVER); - } -} - -void CairoOutputDev::endTransparencyGroup(GfxState * /*state*/) { - if (group) - cairo_pattern_destroy(group); - group = cairo_pop_group (cairo); - - LOG(printf ("end transparency group\n")); - - if (groupColorSpaceStack->next && groupColorSpaceStack->next->knockout) { - if (shape) - cairo_pattern_destroy(shape); - shape = cairo_pop_group (cairo_shape); - } -} - -void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) { - LOG(printf ("paint transparency group\n")); - - cairo_save (cairo); - cairo_set_matrix (cairo, &groupColorSpaceStack->group_matrix); - - if (shape) { - /* OPERATOR_SOURCE w/ a mask is defined as (src IN mask) ADD (dest OUT mask) - * however our source has already been clipped to mask so we only need to - * do ADD and OUT */ - - /* clear the shape mask */ - cairo_set_source (cairo, shape); - cairo_set_operator (cairo, CAIRO_OPERATOR_DEST_OUT); - cairo_paint (cairo); - cairo_set_operator (cairo, CAIRO_OPERATOR_ADD); - } - cairo_set_source (cairo, group); - - if (!mask) { - cairo_paint_with_alpha (cairo, fill_opacity); - cairo_status_t status = cairo_status(cairo); - if (status) - printf("BAD status: %s\n", cairo_status_to_string(status)); - } else { - if (fill_opacity < 1.0) { - cairo_push_group(cairo); - } - cairo_save(cairo); - cairo_set_matrix(cairo, &mask_matrix); - cairo_mask(cairo, mask); - cairo_restore(cairo); - if (fill_opacity < 1.0) { - cairo_pop_group_to_source(cairo); - cairo_paint_with_alpha (cairo, fill_opacity); - } - cairo_pattern_destroy(mask); - mask = nullptr; - } - - if (shape) { - if (cairo_shape) { - cairo_set_source (cairo_shape, shape); - cairo_paint (cairo_shape); - cairo_set_source_rgb (cairo_shape, 0, 0, 0); - } - cairo_pattern_destroy (shape); - shape = nullptr; - } - - popTransparencyGroup(); - cairo_restore(cairo); -} - -static int luminocity(uint32_t x) -{ - int r = (x >> 16) & 0xff; - int g = (x >> 8) & 0xff; - int b = (x >> 0) & 0xff; - // an arbitrary integer approximation of .3*r + .59*g + .11*b - int y = (r*19661+g*38666+b*7209 + 32829)>>16; - return y; -} - - -/* XXX: do we need to deal with shape here? */ -void CairoOutputDev::setSoftMask(GfxState * state, const double * bbox, bool alpha, - Function * transferFunc, GfxColor * backdropColor) { - cairo_pattern_destroy(mask); - - LOG(printf ("set softMask\n")); - - if (!alpha || transferFunc) { - /* We need to mask according to the luminocity of the group. - * So we paint the group to an image surface convert it to a luminocity map - * and then use that as the mask. */ - - /* Get clip extents in device space */ - double x1, y1, x2, y2, x_min, y_min, x_max, y_max; - cairo_clip_extents(cairo, &x1, &y1, &x2, &y2); - cairo_user_to_device(cairo, &x1, &y1); - cairo_user_to_device(cairo, &x2, &y2); - x_min = MIN(x1, x2); - y_min = MIN(y1, y2); - x_max = MAX(x1, x2); - y_max = MAX(y1, y2); - cairo_clip_extents(cairo, &x1, &y1, &x2, &y2); - cairo_user_to_device(cairo, &x1, &y2); - cairo_user_to_device(cairo, &x2, &y1); - x_min = MIN(x_min,MIN(x1, x2)); - y_min = MIN(y_min,MIN(y1, y2)); - x_max = MAX(x_max,MAX(x1, x2)); - y_max = MAX(y_max,MAX(y1, y2)); - - int width = (int)(ceil(x_max) - floor(x_min)); - int height = (int)(ceil(y_max) - floor(y_min)); - - /* Get group device offset */ - double x_offset, y_offset; - if (cairo_get_group_target(cairo) == cairo_get_target(cairo)) { - cairo_surface_get_device_offset(cairo_get_group_target(cairo), &x_offset, &y_offset); - } else { - cairo_surface_t *pats; - cairo_pattern_get_surface(group, &pats); - cairo_surface_get_device_offset(pats, &x_offset, &y_offset); - } - - /* Adjust extents by group offset */ - x_min += x_offset; - y_min += y_offset; - - cairo_surface_t *source = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); - cairo_t *maskCtx = cairo_create(source); - setContextAntialias(maskCtx, antialias); - - //XXX: hopefully this uses the correct color space */ - if (!alpha && groupColorSpaceStack->cs) { - GfxRGB backdropColorRGB; - groupColorSpaceStack->cs->getRGB(backdropColor, &backdropColorRGB); - /* paint the backdrop */ - cairo_set_source_rgb(maskCtx, - colToDbl(backdropColorRGB.r), - colToDbl(backdropColorRGB.g), - colToDbl(backdropColorRGB.b)); - } - cairo_paint(maskCtx); - - /* Copy source ctm to mask ctm and translate origin so that the - * mask appears it the same location on the source surface. */ - cairo_matrix_t mat, tmat; - cairo_matrix_init_translate(&tmat, -x_min, -y_min); - cairo_get_matrix(cairo, &mat); - cairo_matrix_multiply(&mat, &mat, &tmat); - cairo_set_matrix(maskCtx, &mat); - - /* make the device offset of the new mask match that of the group */ - cairo_surface_set_device_offset(source, x_offset, y_offset); - - /* paint the group */ - cairo_set_source(maskCtx, group); - cairo_paint(maskCtx); - - /* XXX status = cairo_status(maskCtx); */ - cairo_destroy(maskCtx); - - /* convert to a luminocity map */ - uint32_t *source_data = reinterpret_cast(cairo_image_surface_get_data(source)); - /* get stride in units of 32 bits */ - ptrdiff_t stride = cairo_image_surface_get_stride(source)/4; - for (int y=0; ytransform(&lum_in, &lum_out); - lum = (int)(lum_out * 255.0 + 0.5); - } - source_data[y*stride + x] = lum << 24; - } - } - cairo_surface_mark_dirty (source); - - /* setup the new mask pattern */ - mask = cairo_pattern_create_for_surface(source); - cairo_get_matrix(cairo, &mask_matrix); - - if (cairo_get_group_target(cairo) == cairo_get_target(cairo)) { - cairo_pattern_set_matrix(mask, &mat); - } else { - cairo_matrix_t patMatrix; - cairo_pattern_get_matrix(group, &patMatrix); - /* Apply x_min, y_min offset to it appears in the same location as source. */ - cairo_matrix_multiply(&patMatrix, &patMatrix, &tmat); - cairo_pattern_set_matrix(mask, &patMatrix); - } - - cairo_surface_destroy(source); - } else if (alpha) { - mask = cairo_pattern_reference(group); - cairo_get_matrix(cairo, &mask_matrix); - } - - popTransparencyGroup(); -} - -void CairoOutputDev::popTransparencyGroup() { - /* pop color space */ - ColorSpaceStack *css = groupColorSpaceStack; - if (css->knockout) { - knockoutCount--; - if (!knockoutCount) { - /* we don't need to track the shape anymore because - * we are not above any knockout groups */ - cairo_destroy(cairo_shape); - cairo_shape = nullptr; - } - } - groupColorSpaceStack = css->next; - delete css; -} - - -void CairoOutputDev::clearSoftMask(GfxState * /*state*/) { - if (mask) - cairo_pattern_destroy(mask); - mask = nullptr; -} - -/* Taken from cairo/doc/tutorial/src/singular.c */ -static void -get_singular_values (const cairo_matrix_t *matrix, - double *major, - double *minor) -{ - double xx = matrix->xx, xy = matrix->xy; - double yx = matrix->yx, yy = matrix->yy; - - double a = xx*xx+yx*yx; - double b = xy*xy+yy*yy; - double k = xx*xy+yx*yy; - - double f = (a+b) * .5; - double g = (a-b) * .5; - double delta = sqrt (g*g + k*k); - - if (major) - *major = sqrt (f + delta); - if (minor) - *minor = sqrt (f - delta); -} - -void CairoOutputDev::getScaledSize(const cairo_matrix_t *matrix, - int orig_width, - int orig_height, - int *scaledWidth, - int *scaledHeight) -{ - double xScale; - double yScale; - if (orig_width > orig_height) - get_singular_values (matrix, &xScale, &yScale); - else - get_singular_values (matrix, &yScale, &xScale); - - int tx, tx2, ty, ty2; /* the integer co-ordinates of the resulting image */ - if (xScale >= 0) { - tx = splashRound(matrix->x0 - 0.01); - tx2 = splashRound(matrix->x0 + xScale + 0.01) - 1; - } else { - tx = splashRound(matrix->x0 + 0.01) - 1; - tx2 = splashRound(matrix->x0 + xScale - 0.01); - } - *scaledWidth = abs(tx2 - tx) + 1; - //scaledWidth = splashRound(fabs(xScale)); - if (*scaledWidth == 0) { - // technically, this should draw nothing, but it generally seems - // better to draw a one-pixel-wide stripe rather than throwing it - // away - *scaledWidth = 1; - } - if (yScale >= 0) { - ty = splashFloor(matrix->y0 + 0.01); - ty2 = splashCeil(matrix->y0 + yScale - 0.01); - } else { - ty = splashCeil(matrix->y0 - 0.01); - ty2 = splashFloor(matrix->y0 + yScale + 0.01); - } - *scaledHeight = abs(ty2 - ty); - if (*scaledHeight == 0) { - *scaledHeight = 1; - } -} - -cairo_filter_t -CairoOutputDev::getFilterForSurface(cairo_surface_t *image, - bool interpolate) -{ - if (interpolate) - return CAIRO_FILTER_GOOD; - - int orig_width = cairo_image_surface_get_width (image); - int orig_height = cairo_image_surface_get_height (image); - if (orig_width == 0 || orig_height == 0) - return CAIRO_FILTER_NEAREST; - - /* When printing, don't change the interpolation. */ - if (printing) - return CAIRO_FILTER_NEAREST; - - cairo_matrix_t matrix; - cairo_get_matrix(cairo, &matrix); - int scaled_width, scaled_height; - getScaledSize (&matrix, orig_width, orig_height, &scaled_width, &scaled_height); - - /* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */ - if (scaled_width / orig_width >= 4 || scaled_height / orig_height >= 4) - return CAIRO_FILTER_NEAREST; - - return CAIRO_FILTER_GOOD; -} - -void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool interpolate, bool inlineImg) { - - /* FIXME: Doesn't the image mask support any colorspace? */ - cairo_set_source (cairo, fill_pattern); - - /* work around a cairo bug when scaling 1x1 surfaces */ - if (width == 1 && height == 1) { - ImageStream *imgStr; - unsigned char pix; - int invert_bit; - - imgStr = new ImageStream(str, width, 1, 1); - imgStr->reset(); - imgStr->getPixel(&pix); - imgStr->close(); - delete imgStr; - - invert_bit = invert ? 1 : 0; - if (pix ^ invert_bit) - return; - - cairo_save (cairo); - cairo_rectangle (cairo, 0., 0., width, height); - cairo_fill (cairo); - cairo_restore (cairo); - if (cairo_shape) { - cairo_save (cairo_shape); - cairo_rectangle (cairo_shape, 0., 0., width, height); - cairo_fill (cairo_shape); - cairo_restore (cairo_shape); - } - return; - } - - /* shape is 1.0 for painted areas, 0.0 for unpainted ones */ - - cairo_matrix_t matrix; - cairo_get_matrix (cairo, &matrix); - //XXX: it is possible that we should only do sub pixel positioning if - // we are rendering fonts */ - if (!printing && prescaleImages - /* not rotated */ - && matrix.xy == 0 && matrix.yx == 0 - /* axes not flipped / not 180 deg rotated */ - && matrix.xx > 0 && (upsideDown() ? -1 : 1) * matrix.yy > 0) { - drawImageMaskPrescaled(state, ref, str, width, height, invert, interpolate, inlineImg); - } else { - drawImageMaskRegular(state, ref, str, width, height, invert, interpolate, inlineImg); - } - -} - -void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool inlineImg, double *baseMatrix) { - - /* FIXME: Doesn't the image mask support any colorspace? */ - cairo_set_source (cairo, fill_pattern); - - /* work around a cairo bug when scaling 1x1 surfaces */ - if (width == 1 && height == 1) { - ImageStream *imgStr; - unsigned char pix; - int invert_bit; - - imgStr = new ImageStream(str, width, 1, 1); - imgStr->reset(); - imgStr->getPixel(&pix); - imgStr->close(); - delete imgStr; - - invert_bit = invert ? 1 : 0; - if (!(pix ^ invert_bit)) { - cairo_save (cairo); - cairo_rectangle (cairo, 0., 0., width, height); - cairo_fill (cairo); - cairo_restore (cairo); - if (cairo_shape) { - cairo_save (cairo_shape); - cairo_rectangle (cairo_shape, 0., 0., width, height); - cairo_fill (cairo_shape); - cairo_restore (cairo_shape); - } - } - } else { - cairo_push_group_with_content (cairo, CAIRO_CONTENT_ALPHA); - - /* shape is 1.0 for painted areas, 0.0 for unpainted ones */ - - cairo_matrix_t matrix; - cairo_get_matrix (cairo, &matrix); - //XXX: it is possible that we should only do sub pixel positioning if - // we are rendering fonts */ - if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) { - drawImageMaskPrescaled(state, ref, str, width, height, invert, false, inlineImg); - } else { - drawImageMaskRegular(state, ref, str, width, height, invert, false, inlineImg); - } - - if (state->getFillColorSpace()->getMode() == csPattern) { - cairo_set_source_rgb (cairo, 1, 1, 1); - cairo_set_matrix (cairo, &mask_matrix); - cairo_mask (cairo, mask); - } - - if (mask) - cairo_pattern_destroy (mask); - mask = cairo_pop_group (cairo); - } - - saveState(state); - double bbox[4] = {0,0,1,1}; // dummy - beginTransparencyGroup(state, bbox, state->getFillColorSpace(), - true, false, false); -} - -void CairoOutputDev::unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) { - double bbox[4] = {0,0,1,1}; // dummy - - endTransparencyGroup(state); - restoreState(state); - paintTransparencyGroup(state, bbox); - clearSoftMask(state); -} - -void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool interpolate, bool inlineImg) { - unsigned char *buffer; - unsigned char *dest; - cairo_surface_t *image; - cairo_pattern_t *pattern; - int x, y, i, bit; - ImageStream *imgStr; - unsigned char *pix; - cairo_matrix_t matrix; - int invert_bit; - ptrdiff_t row_stride; - cairo_filter_t filter; - - /* TODO: Do we want to cache these? */ - imgStr = new ImageStream(str, width, 1, 1); - imgStr->reset(); - - image = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height); - if (cairo_surface_status (image)) - goto cleanup; - - buffer = cairo_image_surface_get_data (image); - row_stride = cairo_image_surface_get_stride (image); - - invert_bit = invert ? 1 : 0; - - for (y = 0; y < height; y++) { - pix = imgStr->getLine(); - dest = buffer + y * row_stride; - i = 0; - bit = 0; - for (x = 0; x < width; x++) { - if (bit == 0) - dest[i] = 0; - if (!(pix[x] ^ invert_bit)) { -#ifdef WORDS_BIGENDIAN - dest[i] |= (1 << (7 - bit)); -#else - dest[i] |= (1 << bit); -#endif - } - bit++; - if (bit > 7) { - bit = 0; - i++; - } - } - } - - filter = getFilterForSurface (image, interpolate); - - cairo_surface_mark_dirty (image); - pattern = cairo_pattern_create_for_surface (image); - cairo_surface_destroy (image); - if (cairo_pattern_status (pattern)) - goto cleanup; - - LOG (printf ("drawImageMask %dx%d\n", width, height)); - - cairo_pattern_set_filter (pattern, filter); - - cairo_matrix_init_translate (&matrix, 0, height); - cairo_matrix_scale (&matrix, width, -height); - cairo_pattern_set_matrix (pattern, &matrix); - if (cairo_pattern_status (pattern)) { - cairo_pattern_destroy (pattern); - goto cleanup; - } - - if (state->getFillColorSpace()->getMode() == csPattern) { - mask = cairo_pattern_reference (pattern); - cairo_get_matrix (cairo, &mask_matrix); - } else if (!printing) { - cairo_save (cairo); - cairo_rectangle (cairo, 0., 0., 1., 1.); - cairo_clip (cairo); - if (strokePathClip) { - cairo_push_group (cairo); - fillToStrokePathClip (state); - cairo_pop_group_to_source (cairo); - } - cairo_mask (cairo, pattern); - cairo_restore (cairo); - } else { - cairo_mask (cairo, pattern); - } - - if (cairo_shape) { - cairo_save (cairo_shape); - cairo_set_source (cairo_shape, pattern); - if (!printing) { - cairo_rectangle (cairo_shape, 0., 0., 1., 1.); - cairo_fill (cairo_shape); - } else { - cairo_mask (cairo_shape, pattern); - } - cairo_restore (cairo_shape); - } - - cairo_pattern_destroy (pattern); - -cleanup: - imgStr->close(); - delete imgStr; -} - - -void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool interpolate, bool inlineImg) { - unsigned char *buffer; - cairo_surface_t *image; - cairo_pattern_t *pattern; - ImageStream *imgStr; - unsigned char *pix; - cairo_matrix_t matrix; - int invert_bit; - ptrdiff_t row_stride; - - /* cairo does a very poor job of scaling down images so we scale them ourselves */ - - LOG (printf ("drawImageMaskPrescaled %dx%d\n", width, height)); - - /* this scaling code is adopted from the splash image scaling code */ - cairo_get_matrix(cairo, &matrix); -#if 0 - printf("[%f %f], [%f %f], %f %f\n", matrix.xx, matrix.xy, matrix.yx, matrix.yy, matrix.x0, matrix.y0); -#endif - /* this whole computation should be factored out */ - double xScale = matrix.xx; - double yScale = matrix.yy; - int tx, tx2, ty, ty2; /* the integer co-ordinates of the resulting image */ - int scaledHeight; - int scaledWidth; - if (xScale >= 0) { - tx = splashRound(matrix.x0 - 0.01); - tx2 = splashRound(matrix.x0 + xScale + 0.01) - 1; - } else { - tx = splashRound(matrix.x0 + 0.01) - 1; - tx2 = splashRound(matrix.x0 + xScale - 0.01); - } - scaledWidth = abs(tx2 - tx) + 1; - //scaledWidth = splashRound(fabs(xScale)); - if (scaledWidth == 0) { - // technically, this should draw nothing, but it generally seems - // better to draw a one-pixel-wide stripe rather than throwing it - // away - scaledWidth = 1; - } - if (yScale >= 0) { - ty = splashFloor(matrix.y0 + 0.01); - ty2 = splashCeil(matrix.y0 + yScale - 0.01); - } else { - ty = splashCeil(matrix.y0 - 0.01); - ty2 = splashFloor(matrix.y0 + yScale + 0.01); - } - scaledHeight = abs(ty2 - ty); - if (scaledHeight == 0) { - scaledHeight = 1; - } -#if 0 - printf("xscale: %g, yscale: %g\n", xScale, yScale); - printf("width: %d, height: %d\n", width, height); - printf("scaledWidth: %d, scaledHeight: %d\n", scaledWidth, scaledHeight); -#endif - - /* compute the required padding */ - /* Padding is used to preserve the aspect ratio. - We compute total_pad to make (height+total_pad)/scaledHeight as close to height/yScale as possible */ - int head_pad = 0; - int tail_pad = 0; - int total_pad = splashRound(height*(scaledHeight/fabs(yScale)) - height); - - /* compute the two pieces of padding */ - if (total_pad > 0) { - //XXX: i'm not positive fabs() is correct - float tail_error = fabs(matrix.y0 - ty); - float head_error = fabs(ty2 - (matrix.y0 + yScale)); - float tail_fraction = tail_error/(tail_error + head_error); - tail_pad = splashRound(total_pad*tail_fraction); - head_pad = total_pad - tail_pad; - } else { - tail_pad = 0; - head_pad = 0; - } - int origHeight = height; - height += tail_pad; - height += head_pad; -#if 0 - printf("head_pad: %d tail_pad: %d\n", head_pad, tail_pad); - printf("origHeight: %d height: %d\n", origHeight, height); - printf("ty: %d, ty2: %d\n", ty, ty2); -#endif - - /* TODO: Do we want to cache these? */ - imgStr = new ImageStream(str, width, 1, 1); - imgStr->reset(); - - invert_bit = invert ? 1 : 0; - - image = cairo_image_surface_create (CAIRO_FORMAT_A8, scaledWidth, scaledHeight); - if (cairo_surface_status (image)) { - imgStr->close(); - delete imgStr; - return; - } - - buffer = cairo_image_surface_get_data (image); - row_stride = cairo_image_surface_get_stride (image); - - int yp = height / scaledHeight; - int yq = height % scaledHeight; - int xp = width / scaledWidth; - int xq = width % scaledWidth; - int yt = 0; - int origHeight_c = origHeight; - /* use MIN() because yp might be > origHeight because of padding */ - unsigned char *pixBuf = (unsigned char *)malloc(MIN(yp+1, origHeight)*width); - int lastYStep = 1; - int total = 0; - for (int y = 0; y < scaledHeight; y++) { - // y scale Bresenham - int yStep = yp; - yt += yq; - - if (yt >= scaledHeight) { - yt -= scaledHeight; - ++yStep; - } - - // read row (s) from image ignoring the padding as appropriate - { - int n = (yp > 0) ? yStep : lastYStep; - total += n; - if (n > 0) { - unsigned char *p = pixBuf; - int head_pad_count = head_pad; - int origHeight_count = origHeight; - int tail_pad_count = tail_pad; - for (int i=0; igetLine(); - for (int j=0; j 0 ? yStep : 1; - int origN = n; - - /* compute the size of padding and pixels that will be used for this row */ - int head_pad_size = MIN(n, head_pad); - n -= head_pad_size; - head_pad -= MIN(head_pad_size, yStep); - - int pix_size = MIN(n, origHeight); - n -= pix_size; - origHeight -= MIN(pix_size, yStep); - - int tail_pad_size = MIN(n, tail_pad); - n -= tail_pad_size; - tail_pad -= MIN(tail_pad_size, yStep); - if (n != 0) { - printf("n = %d (%d %d %d)\n", n, head_pad_size, pix_size, tail_pad_size); - assert(n == 0); - } - - for (int x = 0; x < scaledWidth; ++x) { - int xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - int m = xStep > 0 ? xStep : 1; - float pixAcc0 = 0; - /* could m * head_pad_size * tail_pad_size overflow? */ - if (invert_bit) { - pixAcc0 += m * head_pad_size * tail_pad_size * 255; - } else { - pixAcc0 += m * head_pad_size * tail_pad_size * 0; - } - /* Accumulate all of the source pixels for the destination pixel */ - for (int i = 0; i < pix_size; ++i) { - for (int j = 0; j< m; ++j) { - if (xSrc + i*width + j > MIN(yp + 1, origHeight_c)*width) { - printf("%d > %d (%d %d %d %d) (%d %d %d)\n", xSrc + i*width + j, MIN(yp + 1, origHeight_c)*width, xSrc, i , width, j, yp, origHeight_c, width); - printf("%d %d %d\n", head_pad_size, pix_size, tail_pad_size); - assert(0 && "bad access\n"); - } - pixAcc0 += pixBuf[xSrc + i*width + j]; - } - } - buffer[y * row_stride + x] = splashFloor(pixAcc0 / (origN*m)); - xSrc += xStep; - x1 += 1; - } - - } - free(pixBuf); - - cairo_surface_mark_dirty (image); - pattern = cairo_pattern_create_for_surface (image); - cairo_surface_destroy (image); - if (cairo_pattern_status (pattern)) { - imgStr->close(); - delete imgStr; - return; - } - - /* we should actually be using CAIRO_FILTER_NEAREST here. However, - * cairo doesn't yet do minifaction filtering causing scaled down - * images with CAIRO_FILTER_NEAREST to look really bad */ - cairo_pattern_set_filter (pattern, - interpolate ? CAIRO_FILTER_GOOD : CAIRO_FILTER_FAST); - - if (state->getFillColorSpace()->getMode() == csPattern) { - cairo_matrix_init_translate (&matrix, 0, scaledHeight); - cairo_matrix_scale (&matrix, scaledWidth, -scaledHeight); - cairo_pattern_set_matrix (pattern, &matrix); - if (cairo_pattern_status (pattern)) { - cairo_pattern_destroy (pattern); - imgStr->close(); - delete imgStr; - return; - } - - mask = cairo_pattern_reference (pattern); - cairo_get_matrix (cairo, &mask_matrix); - } else { - cairo_save (cairo); - - /* modify our current transformation so that the prescaled image - * goes where it is supposed to */ - cairo_get_matrix(cairo, &matrix); - cairo_scale(cairo, 1.0/matrix.xx, 1.0/matrix.yy); - // get integer co-ords - cairo_translate (cairo, tx - matrix.x0, ty2 - matrix.y0); - if (yScale > 0) - cairo_scale(cairo, 1, -1); - - cairo_rectangle (cairo, 0., 0., scaledWidth, scaledHeight); - cairo_clip (cairo); - if (strokePathClip) { - cairo_push_group (cairo); - fillToStrokePathClip (state); - cairo_pop_group_to_source (cairo); - } - cairo_mask (cairo, pattern); - - //cairo_get_matrix(cairo, &matrix); - //printf("mask at: [%f %f], [%f %f], %f %f\n\n", matrix.xx, matrix.xy, matrix.yx, matrix.yy, matrix.x0, matrix.y0); - cairo_restore(cairo); - } - - if (cairo_shape) { - cairo_save (cairo_shape); - - /* modify our current transformation so that the prescaled image - * goes where it is supposed to */ - cairo_get_matrix(cairo_shape, &matrix); - cairo_scale(cairo_shape, 1.0/matrix.xx, 1.0/matrix.yy); - // get integer co-ords - cairo_translate (cairo_shape, tx - matrix.x0, ty2 - matrix.y0); - if (yScale > 0) - cairo_scale(cairo_shape, 1, -1); - - cairo_rectangle (cairo_shape, 0., 0., scaledWidth, scaledHeight); - cairo_fill (cairo_shape); - - cairo_restore(cairo_shape); - } - - cairo_pattern_destroy (pattern); - - imgStr->close(); - delete imgStr; -} - -void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, - Stream *str, int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, int maskWidth, - int maskHeight, bool maskInvert, - bool maskInterpolate) -{ - ImageStream *maskImgStr, *imgStr; - ptrdiff_t row_stride; - unsigned char *maskBuffer, *buffer; - unsigned char *maskDest; - unsigned int *dest; - cairo_surface_t *maskImage, *image; - cairo_pattern_t *maskPattern, *pattern; - cairo_matrix_t matrix; - cairo_matrix_t maskMatrix; - unsigned char *pix; - int x, y; - int invert_bit; - cairo_filter_t filter; - cairo_filter_t maskFilter; - - maskImgStr = new ImageStream(maskStr, maskWidth, 1, 1); - maskImgStr->reset(); - - maskImage = cairo_image_surface_create (CAIRO_FORMAT_A8, maskWidth, maskHeight); - if (cairo_surface_status (maskImage)) { - maskImgStr->close(); - delete maskImgStr; - return; - } - - maskBuffer = cairo_image_surface_get_data (maskImage); - row_stride = cairo_image_surface_get_stride (maskImage); - - invert_bit = maskInvert ? 1 : 0; - - for (y = 0; y < maskHeight; y++) { - pix = maskImgStr->getLine(); - maskDest = maskBuffer + y * row_stride; - for (x = 0; x < maskWidth; x++) { - if (pix[x] ^ invert_bit) - *maskDest++ = 0; - else - *maskDest++ = 255; - } - } - - maskImgStr->close(); - delete maskImgStr; - - maskFilter = getFilterForSurface (maskImage, maskInterpolate); - - cairo_surface_mark_dirty (maskImage); - maskPattern = cairo_pattern_create_for_surface (maskImage); - cairo_surface_destroy (maskImage); - if (cairo_pattern_status (maskPattern)) - return; - -#if 0 - /* ICCBased color space doesn't do any color correction - * so check its underlying color space as well */ - int is_identity_transform; - is_identity_transform = colorMap->getColorSpace()->getMode() == csDeviceRGB || - (colorMap->getColorSpace()->getMode() == csICCBased && - ((GfxICCBasedColorSpace*)colorMap->getColorSpace())->getAlt()->getMode() == csDeviceRGB); -#endif - - /* TODO: Do we want to cache these? */ - imgStr = new ImageStream(str, width, - colorMap->getNumPixelComps(), - colorMap->getBits()); - imgStr->reset(); - - image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); - if (cairo_surface_status (image)) - goto cleanup; - - buffer = cairo_image_surface_get_data (image); - row_stride = cairo_image_surface_get_stride (image); - for (y = 0; y < height; y++) { - dest = reinterpret_cast(buffer + y * row_stride); - pix = imgStr->getLine(); - colorMap->getRGBLine (pix, dest, width); - } - - filter = getFilterForSurface (image, interpolate); - - cairo_surface_mark_dirty (image); - pattern = cairo_pattern_create_for_surface (image); - cairo_surface_destroy (image); - if (cairo_pattern_status (pattern)) - goto cleanup; - - LOG (printf ("drawMaskedImage %dx%d\n", width, height)); - - cairo_pattern_set_filter (pattern, filter); - cairo_pattern_set_filter (maskPattern, maskFilter); - - if (!printing) { - cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD); - cairo_pattern_set_extend (maskPattern, CAIRO_EXTEND_PAD); - } - - cairo_matrix_init_translate (&matrix, 0, height); - cairo_matrix_scale (&matrix, width, -height); - cairo_pattern_set_matrix (pattern, &matrix); - if (cairo_pattern_status (pattern)) { - cairo_pattern_destroy (pattern); - cairo_pattern_destroy (maskPattern); - goto cleanup; - } - - cairo_matrix_init_translate (&maskMatrix, 0, maskHeight); - cairo_matrix_scale (&maskMatrix, maskWidth, -maskHeight); - cairo_pattern_set_matrix (maskPattern, &maskMatrix); - if (cairo_pattern_status (maskPattern)) { - cairo_pattern_destroy (maskPattern); - cairo_pattern_destroy (pattern); - goto cleanup; - } - - if (!printing) { - cairo_save (cairo); - cairo_set_source (cairo, pattern); - cairo_rectangle (cairo, 0., 0., 1., 1.); - cairo_clip (cairo); - cairo_mask (cairo, maskPattern); - cairo_restore (cairo); - } else { - cairo_set_source (cairo, pattern); - cairo_mask (cairo, maskPattern); - } - - if (cairo_shape) { - cairo_save (cairo_shape); - cairo_set_source (cairo_shape, pattern); - if (!printing) { - cairo_rectangle (cairo_shape, 0., 0., 1., 1.); - cairo_fill (cairo_shape); - } else { - cairo_mask (cairo_shape, pattern); - } - cairo_restore (cairo_shape); - } - - cairo_pattern_destroy (maskPattern); - cairo_pattern_destroy (pattern); - -cleanup: - imgStr->close(); - delete imgStr; -} - - -//XXX: is this affect by AIS(alpha is shape)? -void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap, - bool maskInterpolate) -{ - ImageStream *maskImgStr, *imgStr; - ptrdiff_t row_stride; - unsigned char *maskBuffer, *buffer; - unsigned char *maskDest; - unsigned int *dest; - cairo_surface_t *maskImage, *image; - cairo_pattern_t *maskPattern, *pattern; - cairo_matrix_t maskMatrix, matrix; - unsigned char *pix; - int y; - cairo_filter_t filter; - cairo_filter_t maskFilter; - - maskImgStr = new ImageStream(maskStr, maskWidth, - maskColorMap->getNumPixelComps(), - maskColorMap->getBits()); - maskImgStr->reset(); - - maskImage = cairo_image_surface_create (CAIRO_FORMAT_A8, maskWidth, maskHeight); - if (cairo_surface_status (maskImage)) { - maskImgStr->close(); - delete maskImgStr; - return; - } - - maskBuffer = cairo_image_surface_get_data (maskImage); - row_stride = cairo_image_surface_get_stride (maskImage); - for (y = 0; y < maskHeight; y++) { - maskDest = (unsigned char *) (maskBuffer + y * row_stride); - pix = maskImgStr->getLine(); - if (likely(pix != nullptr)) { - maskColorMap->getGrayLine (pix, maskDest, maskWidth); - } - } - - maskImgStr->close(); - delete maskImgStr; - - maskFilter = getFilterForSurface (maskImage, maskInterpolate); - - cairo_surface_mark_dirty (maskImage); - maskPattern = cairo_pattern_create_for_surface (maskImage); - cairo_surface_destroy (maskImage); - if (cairo_pattern_status (maskPattern)) - return; - -#if 0 - /* ICCBased color space doesn't do any color correction - * so check its underlying color space as well */ - int is_identity_transform; - is_identity_transform = colorMap->getColorSpace()->getMode() == csDeviceRGB || - (colorMap->getColorSpace()->getMode() == csICCBased && - ((GfxICCBasedColorSpace*)colorMap->getColorSpace())->getAlt()->getMode() == csDeviceRGB); -#endif - - /* TODO: Do we want to cache these? */ - imgStr = new ImageStream(str, width, - colorMap->getNumPixelComps(), - colorMap->getBits()); - imgStr->reset(); - - image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); - if (cairo_surface_status (image)) - goto cleanup; - - buffer = cairo_image_surface_get_data (image); - row_stride = cairo_image_surface_get_stride (image); - for (y = 0; y < height; y++) { - dest = reinterpret_cast(buffer + y * row_stride); - pix = imgStr->getLine(); - colorMap->getRGBLine (pix, dest, width); - } - - filter = getFilterForSurface (image, interpolate); - - cairo_surface_mark_dirty (image); - - setMimeData(state, str, ref, colorMap, image, height); - - pattern = cairo_pattern_create_for_surface (image); - cairo_surface_destroy (image); - if (cairo_pattern_status (pattern)) - goto cleanup; - - LOG (printf ("drawSoftMaskedImage %dx%d\n", width, height)); - - cairo_pattern_set_filter (pattern, filter); - cairo_pattern_set_filter (maskPattern, maskFilter); - - if (!printing) { - cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD); - cairo_pattern_set_extend (maskPattern, CAIRO_EXTEND_PAD); - } - - cairo_matrix_init_translate (&matrix, 0, height); - cairo_matrix_scale (&matrix, width, -height); - cairo_pattern_set_matrix (pattern, &matrix); - if (cairo_pattern_status (pattern)) { - cairo_pattern_destroy (pattern); - cairo_pattern_destroy (maskPattern); - goto cleanup; - } - - cairo_matrix_init_translate (&maskMatrix, 0, maskHeight); - cairo_matrix_scale (&maskMatrix, maskWidth, -maskHeight); - cairo_pattern_set_matrix (maskPattern, &maskMatrix); - if (cairo_pattern_status (maskPattern)) { - cairo_pattern_destroy (maskPattern); - cairo_pattern_destroy (pattern); - goto cleanup; - } - - if (fill_opacity != 1.0) - cairo_push_group (cairo); - else - cairo_save (cairo); - - cairo_set_source (cairo, pattern); - if (!printing) { - cairo_rectangle (cairo, 0., 0., 1., 1.); - cairo_clip (cairo); - } - cairo_mask (cairo, maskPattern); - - if (fill_opacity != 1.0) { - cairo_pop_group_to_source (cairo); - cairo_save (cairo); - if (!printing) { - cairo_rectangle (cairo, 0., 0., 1., 1.); - cairo_clip (cairo); - } - cairo_paint_with_alpha (cairo, fill_opacity); - } - cairo_restore (cairo); - - if (cairo_shape) { - cairo_save (cairo_shape); - cairo_set_source (cairo_shape, pattern); - if (!printing) { - cairo_rectangle (cairo_shape, 0., 0., 1., 1.); - cairo_fill (cairo_shape); - } else { - cairo_mask (cairo_shape, pattern); - } - cairo_restore (cairo_shape); - } - - cairo_pattern_destroy (maskPattern); - cairo_pattern_destroy (pattern); - -cleanup: - imgStr->close(); - delete imgStr; -} - -bool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) -{ - int len, i; - char *strBuffer; - - len = 0; - str->close(); - str->reset(); - while (str->getChar() != EOF) len++; - if (len == 0) - return false; - - strBuffer = (char *)gmalloc (len); - - str->close(); - str->reset(); - for (i = 0; i < len; ++i) - strBuffer[i] = str->getChar(); - - *buffer = strBuffer; - *length = len; - - return true; -} - -static bool colorMapHasIdentityDecodeMap(GfxImageColorMap *colorMap) -{ - for (int i = 0; i < colorMap->getNumPixelComps(); i++) { - if (colorMap->getDecodeLow(i) != 0.0 || colorMap->getDecodeHigh(i) != 1.0) - return false; - } - return true; -} - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) -static cairo_status_t setMimeIdFromRef(cairo_surface_t *surface, - const char *mime_type, - const char *mime_id_prefix, - Ref ref) -{ - GooString *mime_id; - char *idBuffer; - cairo_status_t status; - - mime_id = new GooString; - - if (mime_id_prefix) - mime_id->append(mime_id_prefix); - - mime_id->appendf("{0:d}-{1:d}", ref.gen, ref.num); - - idBuffer = copyString(mime_id->c_str()); - status = cairo_surface_set_mime_data (surface, mime_type, - (const unsigned char *)idBuffer, - mime_id->getLength(), - gfree, idBuffer); - delete mime_id; - if (status) - gfree (idBuffer); - return status; -} -#endif - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) -bool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, - cairo_surface_t *image) -{ - JBIG2Stream *jb2Str = static_cast(str); - Object* globalsStr = jb2Str->getGlobalsStream(); - char *globalsBuffer; - int globalsLength; - - // nothing to do for JBIG2 stream without Globals - if (!globalsStr->isStream()) - return true; - - if (setMimeIdFromRef(image, CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID, nullptr, - jb2Str->getGlobalsStreamRef())) - return false; - - if (!getStreamData(globalsStr->getStream(), &globalsBuffer, &globalsLength)) - return false; - - if (cairo_surface_set_mime_data (image, CAIRO_MIME_TYPE_JBIG2_GLOBAL, - (const unsigned char*)globalsBuffer, - globalsLength, - gfree, (void*)globalsBuffer)) - { - gfree (globalsBuffer); - return false; - } - - return true; -} -#endif - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) -bool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, - cairo_surface_t *image, int height) -{ - CCITTFaxStream *ccittStr = static_cast(str); - - GooString params; - params.appendf("Columns={0:d}", ccittStr->getColumns()); - params.appendf(" Rows={0:d}", height); - params.appendf(" K={0:d}", ccittStr->getEncoding()); - params.appendf(" EndOfLine={0:d}", ccittStr->getEndOfLine() ? 1 : 0); - params.appendf(" EncodedByteAlign={0:d}", ccittStr->getEncodedByteAlign() ? 1 : 0); - params.appendf(" EndOfBlock={0:d}", ccittStr->getEndOfBlock() ? 1 : 0); - params.appendf(" BlackIs1={0:d}", ccittStr->getBlackIs1() ? 1 : 0); - params.appendf(" DamagedRowsBeforeError={0:d}", ccittStr->getDamagedRowsBeforeError()); - - char *p = strdup(params.c_str()); - if (cairo_surface_set_mime_data (image, CAIRO_MIME_TYPE_CCITT_FAX_PARAMS, - (const unsigned char*)p, - params.getLength(), - gfree, (void*)p)) - { - gfree (p); - return false; - } - - return true; -} -#endif - -void CairoOutputDev::setMimeData(GfxState *state, Stream *str, Object *ref, - GfxImageColorMap *colorMap, cairo_surface_t *image, int height) -{ - char *strBuffer; - int len; - Object obj; - GfxColorSpace *colorSpace; - StreamKind strKind = str->getKind(); - const char *mime_type; - - if (!printing) - return; - - switch (strKind) { - case strDCT: - mime_type = CAIRO_MIME_TYPE_JPEG; - break; - case strJPX: - mime_type = CAIRO_MIME_TYPE_JP2; - break; -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - case strJBIG2: - mime_type = CAIRO_MIME_TYPE_JBIG2; - break; -#endif -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) - case strCCITTFax: - mime_type = CAIRO_MIME_TYPE_CCITT_FAX; - break; -#endif - default: - return; - } - - obj = str->getDict()->lookup("ColorSpace"); - colorSpace = GfxColorSpace::parse(nullptr, &obj, this, state); - - // colorspace in stream dict may be different from colorspace in jpx - // data - if (strKind == strJPX && colorSpace) - return; - - // only embed mime data for gray, rgb, and cmyk colorspaces. - if (colorSpace) { - GfxColorSpaceMode mode = colorSpace->getMode(); - delete colorSpace; - switch (mode) { - case csDeviceGray: - case csCalGray: - case csDeviceRGB: - case csCalRGB: - case csDeviceCMYK: - case csICCBased: - break; - - case csLab: - case csIndexed: - case csSeparation: - case csDeviceN: - case csPattern: - return; - } - } - - if (!colorMapHasIdentityDecodeMap(colorMap)) - return; - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - if (strKind == strJBIG2 && !setMimeDataForJBIG2Globals(str, image)) - return; -#endif - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) - if (strKind == strCCITTFax && !setMimeDataForCCITTParams(str, image, height)) - return; -#endif - - if (getStreamData (str->getNextStream(), &strBuffer, &len)) { - cairo_status_t status = CAIRO_STATUS_SUCCESS; - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) - // Since 1.5.10 the cairo PS backend stores images with UNIQUE_ID in PS memory so the - // image can be re-used multiple times. As we don't know how large the images are or - // how many times they are used, there is no benefit in enabling this. Issue #106 - if (cairo_surface_get_type (cairo_get_target (cairo)) != CAIRO_SURFACE_TYPE_PS) { - if (ref && ref->isRef()) { - status = setMimeIdFromRef(image, CAIRO_MIME_TYPE_UNIQUE_ID, - "poppler-surface-", ref->getRef()); - } - } -#endif - if (!status) { - status = cairo_surface_set_mime_data (image, mime_type, - (const unsigned char *)strBuffer, len, - gfree, strBuffer); - } - - if (status) - gfree (strBuffer); - } -} - -class RescaleDrawImage : public CairoRescaleBox { -private: - ImageStream *imgStr; - GfxRGB *lookup; - int width; - GfxImageColorMap *colorMap; - const int *maskColors; - int current_row; - bool imageError; - -public: - cairo_surface_t *getSourceImage(Stream *str, - int widthA, int height, - int scaledWidth, int scaledHeight, - bool printing, - GfxImageColorMap *colorMapA, - const int *maskColorsA) { - cairo_surface_t *image = nullptr; - int i; - - lookup = nullptr; - colorMap = colorMapA; - maskColors = maskColorsA; - width = widthA; - current_row = -1; - imageError = false; - - /* TODO: Do we want to cache these? */ - imgStr = new ImageStream(str, width, - colorMap->getNumPixelComps(), - colorMap->getBits()); - imgStr->reset(); - -#if 0 - /* ICCBased color space doesn't do any color correction - * so check its underlying color space as well */ - int is_identity_transform; - is_identity_transform = colorMap->getColorSpace()->getMode() == csDeviceRGB || - (colorMap->getColorSpace()->getMode() == csICCBased && - ((GfxICCBasedColorSpace*)colorMap->getColorSpace())->getAlt()->getMode() == csDeviceRGB); -#endif - - // special case for one-channel (monochrome/gray/separation) images: - // build a lookup table here - if (colorMap->getNumPixelComps() == 1) { - int n; - unsigned char pix; - - n = 1 << colorMap->getBits(); - lookup = (GfxRGB *)gmallocn(n, sizeof(GfxRGB)); - for (i = 0; i < n; ++i) { - pix = (unsigned char)i; - - colorMap->getRGB(&pix, &lookup[i]); - } - } - -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - bool needsCustomDownscaling = false; -#else - bool needsCustomDownscaling = true; -#endif - - if (printing) { - if (width > MAX_PRINT_IMAGE_SIZE || height > MAX_PRINT_IMAGE_SIZE) { - if (width > height) { - scaledWidth = MAX_PRINT_IMAGE_SIZE; - scaledHeight = MAX_PRINT_IMAGE_SIZE * (double)height/width; - } else { - scaledHeight = MAX_PRINT_IMAGE_SIZE; - scaledWidth = MAX_PRINT_IMAGE_SIZE * (double)width/height; - } - needsCustomDownscaling = true; - - if (scaledWidth == 0) { - scaledWidth = 1; - } - if (scaledHeight == 0) { - scaledHeight = 1; - } - } else { - needsCustomDownscaling = false; - } - } - - if (!needsCustomDownscaling || scaledWidth >= width || scaledHeight >= height) { - // No downscaling. Create cairo image containing the source image data. - unsigned char *buffer; - ptrdiff_t stride; - - image = cairo_image_surface_create (maskColors ? - CAIRO_FORMAT_ARGB32 : - CAIRO_FORMAT_RGB24, - width, height); - if (cairo_surface_status (image)) - goto cleanup; - - buffer = cairo_image_surface_get_data (image); - stride = cairo_image_surface_get_stride (image); - for (int y = 0; y < height; y++) { - uint32_t *dest = reinterpret_cast(buffer + y * stride); - getRow(y, dest); - } - } else { - // // Downscaling required. Create cairo image the size of the - // rescaled image and // downscale the source image data into - // the cairo image. downScaleImage() will call getRow() to read - // source image data from the image stream. This avoids having - // to create an image the size of the source image which may - // exceed cairo's 32676x32767 image size limit (and also saves a - // lot of memory). - image = cairo_image_surface_create (maskColors ? - CAIRO_FORMAT_ARGB32 : - CAIRO_FORMAT_RGB24, - scaledWidth, scaledHeight); - if (cairo_surface_status (image)) - goto cleanup; - - downScaleImage(width, height, - scaledWidth, scaledHeight, - 0, 0, scaledWidth, scaledHeight, - image); - } - cairo_surface_mark_dirty (image); - - cleanup: - gfree(lookup); - imgStr->close(); - delete imgStr; - return image; - } - - void getRow(int row_num, uint32_t *row_data) override { - unsigned char *pix; - - if (row_num <= current_row) - return; - - while (current_row < row_num) { - pix = imgStr->getLine(); - current_row++; - } - - if (unlikely(pix == nullptr)) { - memset(row_data, 0, width*4); - if (!imageError) { - error(errInternal, -1, "Bad image stream"); - imageError = true; - } - } else if (lookup) { - unsigned char *p = pix; - GfxRGB rgb; - - for (int i = 0; i < width; i++) { - rgb = lookup[*p]; - row_data[i] = - ((int) colToByte(rgb.r) << 16) | - ((int) colToByte(rgb.g) << 8) | - ((int) colToByte(rgb.b) << 0); - p++; - } - } else { - colorMap->getRGBLine (pix, row_data, width); - } - - if (maskColors) { - for (int x = 0; x < width; x++) { - bool is_opaque = false; - for (int i = 0; i < colorMap->getNumPixelComps(); ++i) { - if (pix[i] < maskColors[2*i] || - pix[i] > maskColors[2*i+1]) { - is_opaque = true; - break; - } - } - if (is_opaque) - *row_data |= 0xff000000; - else - *row_data = 0; - row_data++; - pix += colorMap->getNumPixelComps(); - } - } - } - -}; - -void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int widthA, int heightA, - GfxImageColorMap *colorMap, - bool interpolate, - const int *maskColors, bool inlineImg) -{ - cairo_surface_t *image; - cairo_pattern_t *pattern, *maskPattern; - cairo_matrix_t matrix; - int width, height; - int scaledWidth, scaledHeight; - cairo_filter_t filter = CAIRO_FILTER_GOOD; - RescaleDrawImage rescale; - - LOG (printf ("drawImage %dx%d\n", widthA, heightA)); - - cairo_get_matrix(cairo, &matrix); - getScaledSize (&matrix, widthA, heightA, &scaledWidth, &scaledHeight); - image = rescale.getSourceImage(str, widthA, heightA, scaledWidth, scaledHeight, printing, colorMap, maskColors); - if (!image) - return; - - width = cairo_image_surface_get_width (image); - height = cairo_image_surface_get_height (image); - if (width == widthA && height == heightA) - filter = getFilterForSurface (image, interpolate); - - if (!inlineImg) { /* don't read stream twice if it is an inline image */ - // cairo 1.15.10 allows mime image data to have different size to cairo image - // mime image size will be scaled to same size as cairo image -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) - bool requireSameSize = false; -#else - bool requireSameSize = true; -#endif - if (!requireSameSize || (width == widthA && height == heightA)) - setMimeData(state, str, ref, colorMap, image, heightA); - } - - pattern = cairo_pattern_create_for_surface (image); - cairo_surface_destroy (image); - if (cairo_pattern_status (pattern)) - return; - - cairo_pattern_set_filter (pattern, filter); - - if (!printing) - cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD); - - cairo_matrix_init_translate (&matrix, 0, height); - cairo_matrix_scale (&matrix, width, -height); - cairo_pattern_set_matrix (pattern, &matrix); - if (cairo_pattern_status (pattern)) { - cairo_pattern_destroy (pattern); - return; - } - - if (!mask && fill_opacity != 1.0) { - maskPattern = cairo_pattern_create_rgba (1., 1., 1., fill_opacity); - } else if (mask) { - maskPattern = cairo_pattern_reference (mask); - } else { - maskPattern = nullptr; - } - - cairo_save (cairo); - cairo_set_source (cairo, pattern); - if (!printing) - cairo_rectangle (cairo, 0., 0., 1., 1.); - if (maskPattern) { - if (!printing) - cairo_clip (cairo); - if (mask) - cairo_set_matrix (cairo, &mask_matrix); - cairo_mask (cairo, maskPattern); - } else { - if (printing) - cairo_paint (cairo); - else - cairo_fill (cairo); - } - cairo_restore (cairo); - - cairo_pattern_destroy (maskPattern); - - if (cairo_shape) { - cairo_save (cairo_shape); - cairo_set_source (cairo_shape, pattern); - if (printing) { - cairo_paint (cairo_shape); - } else { - cairo_rectangle (cairo_shape, 0., 0., 1., 1.); - cairo_fill (cairo_shape); - } - cairo_restore (cairo_shape); - } - - cairo_pattern_destroy (pattern); -} - - -//------------------------------------------------------------------------ -// ImageOutputDev -//------------------------------------------------------------------------ - -CairoImageOutputDev::CairoImageOutputDev() -{ - images = nullptr; - numImages = 0; - size = 0; - imgDrawCbk = nullptr; - imgDrawCbkData = nullptr; -} - -CairoImageOutputDev::~CairoImageOutputDev() -{ - int i; - - for (i = 0; i < numImages; i++) - delete images[i]; - gfree (images); -} - -void CairoImageOutputDev::saveImage(CairoImage *image) -{ - if (numImages >= size) { - size += 16; - images = (CairoImage **) greallocn (images, size, sizeof (CairoImage *)); - } - images[numImages++] = image; -} - -void CairoImageOutputDev::getBBox(GfxState *state, int width, int height, - double *x1, double *y1, double *x2, double *y2) -{ - const double *ctm = state->getCTM(); - cairo_matrix_t matrix; - cairo_matrix_init(&matrix, - ctm[0], ctm[1], - -ctm[2], -ctm[3], - ctm[2] + ctm[4], ctm[3] + ctm[5]); - - int scaledWidth, scaledHeight; - getScaledSize (&matrix, width, height, &scaledWidth, &scaledHeight); - - if (matrix.xx >= 0) { - *x1 = matrix.x0; - } else { - *x1 = matrix.x0 - scaledWidth; - } - *x2 = *x1 + scaledWidth; - - if (matrix.yy >= 0) { - *y1 = matrix.y0; - } else { - *y1 = matrix.y0 - scaledHeight; - } - *y2 = *y1 + scaledHeight; -} - -void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool interpolate, bool inlineImg) -{ - cairo_t *cr; - cairo_surface_t *surface; - double x1, y1, x2, y2; - CairoImage *image; - - getBBox(state, width, height, &x1, &y1, &x2, &y2); - - image = new CairoImage (x1, y1, x2, y2); - saveImage (image); - - if (imgDrawCbk && imgDrawCbk (numImages - 1, imgDrawCbkData)) { - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - cr = cairo_create (surface); - setCairo (cr); - cairo_translate (cr, 0, height); - cairo_scale (cr, width, -height); - - CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); - image->setImage (surface); - - setCairo (nullptr); - cairo_surface_destroy (surface); - cairo_destroy (cr); - } -} - -void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool inlineImg, double *baseMatrix) -{ - cairo_t *cr; - cairo_surface_t *surface; - double x1, y1, x2, y2; - CairoImage *image; - - getBBox(state, width, height, &x1, &y1, &x2, &y2); - - image = new CairoImage (x1, y1, x2, y2); - saveImage (image); - - if (imgDrawCbk && imgDrawCbk (numImages - 1, imgDrawCbkData)) { - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - cr = cairo_create (surface); - setCairo (cr); - cairo_translate (cr, 0, height); - cairo_scale (cr, width, -height); - - CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg, false); - if (state->getFillColorSpace()->getMode() == csPattern) { - cairo_mask (cairo, mask); - } - image->setImage (surface); - - setCairo (nullptr); - cairo_surface_destroy (surface); - cairo_destroy (cr); - } -} - -void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - bool interpolate, const int *maskColors, bool inlineImg) -{ - cairo_t *cr; - cairo_surface_t *surface; - double x1, y1, x2, y2; - CairoImage *image; - - getBBox(state, width, height, &x1, &y1, &x2, &y2); - - image = new CairoImage (x1, y1, x2, y2); - saveImage (image); - - if (imgDrawCbk && imgDrawCbk (numImages - 1, imgDrawCbkData)) { - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - cr = cairo_create (surface); - setCairo (cr); - cairo_translate (cr, 0, height); - cairo_scale (cr, width, -height); - - CairoOutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); - image->setImage (surface); - - setCairo (nullptr); - cairo_surface_destroy (surface); - cairo_destroy (cr); - } -} - -void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap, - bool maskInterpolate) -{ - cairo_t *cr; - cairo_surface_t *surface; - double x1, y1, x2, y2; - CairoImage *image; - - getBBox(state, width, height, &x1, &y1, &x2, &y2); - - image = new CairoImage (x1, y1, x2, y2); - saveImage (image); - - if (imgDrawCbk && imgDrawCbk (numImages - 1, imgDrawCbkData)) { - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - cr = cairo_create (surface); - setCairo (cr); - cairo_translate (cr, 0, height); - cairo_scale (cr, width, -height); - - CairoOutputDev::drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, - maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); - image->setImage (surface); - - setCairo (nullptr); - cairo_surface_destroy (surface); - cairo_destroy (cr); - } -} - -void CairoImageOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, - int maskWidth, int maskHeight, - bool maskInvert, bool maskInterpolate) -{ - cairo_t *cr; - cairo_surface_t *surface; - double x1, y1, x2, y2; - CairoImage *image; - - getBBox(state, width, height, &x1, &y1, &x2, &y2); - - image = new CairoImage (x1, y1, x2, y2); - saveImage (image); - - if (imgDrawCbk && imgDrawCbk (numImages - 1, imgDrawCbkData)) { - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - cr = cairo_create (surface); - setCairo (cr); - cairo_translate (cr, 0, height); - cairo_scale (cr, width, -height); - - CairoOutputDev::drawMaskedImage(state, ref, str, width, height, colorMap, interpolate, - maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); - image->setImage (surface); - - setCairo (nullptr); - cairo_surface_destroy (surface); - cairo_destroy (cr); - } -} diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h b/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h deleted file mode 100644 index 9e6f497..0000000 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoOutputDev.h +++ /dev/null @@ -1,525 +0,0 @@ -//======================================================================== -// -// CairoOutputDev.h -// -// Copyright 2003 Glyph & Cog, LLC -// Copyright 2004 Red Hat, INC -// -//======================================================================== - -//======================================================================== -// -// 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) 2005-2008 Jeff Muizelaar -// Copyright (C) 2005, 2006 Kristian Høgsberg -// Copyright (C) 2005 Nickolay V. Shmyrev -// Copyright (C) 2006-2011, 2013 Carlos Garcia Campos -// Copyright (C) 2008, 2009, 2011-2017 Adrian Johnson -// Copyright (C) 2008 Michael Vrable -// Copyright (C) 2010-2013 Thomas Freitag -// Copyright (C) 2015 Suzuki Toshiya -// Copyright (C) 2016 Jason Crain -// Copyright (C) 2018, 2019 Albert Astals Cid -// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich -// -// 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 CAIROOUTPUTDEV_H -#define CAIROOUTPUTDEV_H - -#include -#include "OutputDev.h" -#include "TextOutputDev.h" -#include "GfxState.h" - -class PDFDoc; -class GfxState; -class GfxPath; -class Gfx8BitFont; -struct GfxRGB; -class CairoFontEngine; -class CairoFont; - -//------------------------------------------------------------------------ - -//------------------------------------------------------------------------ -// CairoImage -//------------------------------------------------------------------------ -class CairoImage { -public: - // Constructor. - CairoImage (double x1, double y1, double x2, double y2); - - // Destructor. - ~CairoImage (); - - CairoImage(const CairoImage &) = delete; - CairoImage& operator=(const CairoImage &) = delete; - - // Set the image cairo surface - void setImage (cairo_surface_t *image); - - // Get the image cairo surface - cairo_surface_t *getImage () const { return image; } - - // Get the image rectangle - void getRect (double *xa1, double *ya1, double *xa2, double *ya2) - { *xa1 = x1; *ya1 = y1; *xa2 = x2; *ya2 = y2; } - -private: - cairo_surface_t *image; // image cairo surface - double x1, y1; // upper left corner - double x2, y2; // lower right corner -}; - - -//------------------------------------------------------------------------ -// CairoOutputDev -//------------------------------------------------------------------------ - -class CairoOutputDev: public OutputDev { -public: - - // Constructor. - CairoOutputDev(); - - // Destructor. - virtual ~CairoOutputDev(); - - //----- get info about output device - - // Does this device use upside-down coordinates? - // (Upside-down means (0,0) is the top left corner of the page.) - bool upsideDown() override { return true; } - - // Does this device use drawChar() or drawString()? - bool useDrawChar() override { return true; } - - // Does this device use tilingPatternFill()? If this returns false, - // tiling pattern fills will be reduced to a series of other drawing - // operations. - bool useTilingPatternFill() override { return true; } - - // Does this device use functionShadedFill(), axialShadedFill(), and - // radialShadedFill()? If this returns false, these shaded fills - // will be reduced to a series of other drawing operations. -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - bool useShadedFills(int type) override { return type <= 7; } -#else - bool useShadedFills(int type) override { return type > 1 && type < 4; } -#endif - - // Does this device use FillColorStop()? - bool useFillColorStop() override { return true; } - - // Does this device use beginType3Char/endType3Char? Otherwise, - // text in Type 3 fonts will be drawn with drawChar/drawString. - bool interpretType3Chars() override { return false; } - - // Does this device need to clip pages to the crop box even when the - // box is the crop box? - bool needClipToCropBox() override { return true; } - - //----- initialization and control - - // Start a page. - void startPage(int pageNum, GfxState *state, XRef *xref) override; - - // End a page. - void endPage() override; - - //----- save/restore graphics state - void saveState(GfxState *state) override; - void restoreState(GfxState *state) override; - - //----- update graphics state - void updateAll(GfxState *state) override; - void setDefaultCTM(const double *ctm) override; - void updateCTM(GfxState *state, double m11, double m12, - double m21, double m22, double m31, double m32) override; - void updateLineDash(GfxState *state) override; - void updateFlatness(GfxState *state) override; - void updateLineJoin(GfxState *state) override; - void updateLineCap(GfxState *state) override; - void updateMiterLimit(GfxState *state) override; - void updateLineWidth(GfxState *state) override; - void updateFillColor(GfxState *state) override; - void updateStrokeColor(GfxState *state) override; - void updateFillOpacity(GfxState *state) override; - void updateStrokeOpacity(GfxState *state) override; - void updateFillColorStop(GfxState *state, double offset) override; - void updateBlendMode(GfxState *state) override; - - //----- update text state - void updateFont(GfxState *state) override; - - //----- path painting - void stroke(GfxState *state) override; - void fill(GfxState *state) override; - void eoFill(GfxState *state) override; - void clipToStrokePath(GfxState *state) override; - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, - const double *pmat, int paintType, int tilingType, Dict *resDict, - const double *mat, const double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep) override; -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; -#endif - bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; - bool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) override; - bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override; - bool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) override; -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - bool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override; - bool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; -#endif - - //----- path clipping - void clip(GfxState *state) override; - void eoClip(GfxState *state) override; - - //----- text drawing - void beginString(GfxState *state, const GooString *s) override; - void endString(GfxState *state) override; - void drawChar(GfxState *state, double x, double y, - double dx, double dy, - double originX, double originY, - 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, const Unicode *u, int uLen) override; - void endType3Char(GfxState *state) override; - void beginTextObject(GfxState *state) override; - void endTextObject(GfxState *state) override; - - //----- image drawing - void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, bool interpolate, - bool inlineImg) override; - void setSoftMaskFromImageMask(GfxState *state, - Object *ref, Stream *str, - int width, int height, bool invert, - bool inlineImg, double *baseMatrix) override; - void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override; - void drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, bool interpolate, - bool inlineImg); - void drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, bool interpolate, - bool inlineImg); - - void drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - bool interpolate, const int *maskColors, bool inlineImg) override; - void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap, - bool maskInterpolate) override; - - void drawMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, - int maskWidth, int maskHeight, - bool maskInvert, bool maskInterpolate) override; - - //----- transparency groups and soft masks - void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, - GfxColorSpace * /*blendingColorSpace*/, - bool /*isolated*/, bool /*knockout*/, - bool /*forSoftMask*/) override; - void endTransparencyGroup(GfxState * /*state*/) override; - void popTransparencyGroup(); - void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override; - void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, - Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override; - void clearSoftMask(GfxState * /*state*/) override; - - //----- Type 3 font operators - void type3D0(GfxState *state, double wx, double wy) override; - void type3D1(GfxState *state, double wx, double wy, - double llx, double lly, double urx, double ury) override; - - //----- special access - - // Called to indicate that a new PDF document has been loaded. - void startDoc(PDFDoc *docA, CairoFontEngine *fontEngine = nullptr); - - bool isReverseVideo() { return false; } - - void setCairo (cairo_t *cr); - void setTextPage (TextPage *text); - void setPrinting (bool printingA) { printing = printingA; needFontUpdate = true; } - void setAntialias(cairo_antialias_t antialias); - - void setInType3Char(bool inType3CharA) { inType3Char = inType3CharA; } - void getType3GlyphWidth (double *wx, double *wy) { *wx = t3_glyph_wx; *wy = t3_glyph_wy; } - bool hasType3GlyphBBox () { return t3_glyph_has_bbox; } - double *getType3GlyphBBox () { return t3_glyph_bbox; } - -protected: - 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, - int *scaledWidth, int *scaledHeight); - cairo_filter_t getFilterForSurface(cairo_surface_t *image, - bool interpolate); - bool getStreamData (Stream *str, char **buffer, int *length); - void setMimeData(GfxState *state, Stream *str, Object *ref, - GfxImageColorMap *colorMap, cairo_surface_t *image, int height); - void fillToStrokePathClip(GfxState *state); - 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 -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) - bool setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height); -#endif - static void setContextAntialias(cairo_t *cr, cairo_antialias_t antialias); - - GfxRGB fill_color, stroke_color; - cairo_pattern_t *fill_pattern, *stroke_pattern; - double fill_opacity; - double stroke_opacity; - bool stroke_adjust; - bool adjusted_stroke_width; - bool align_stroke_coords; - CairoFont *currentFont; - XRef *xref; - - struct StrokePathClip { - GfxPath *path; - cairo_matrix_t ctm; - double line_width; - double *dashes; - int dash_count; - double dash_offset; - cairo_line_cap_t cap; - cairo_line_join_t join; - double miter; - int ref_count; - } *strokePathClip; - - PDFDoc *doc; // the current document - - static FT_Library ft_lib; - static bool ft_lib_initialized; - - CairoFontEngine *fontEngine; - bool fontEngine_owner; - - cairo_t *cairo; - cairo_matrix_t orig_matrix; - bool needFontUpdate; // set when the font needs to be updated - bool printing; - bool use_show_text_glyphs; - bool text_matrix_valid; - cairo_glyph_t *glyphs; - int glyphCount; - cairo_text_cluster_t *clusters; - int clusterCount; - char *utf8; - int utf8Count; - int utf8Max; - cairo_path_t *textClipPath; - bool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) - bool inType3Char; // inside a Type 3 CharProc - double t3_glyph_wx, t3_glyph_wy; - bool t3_glyph_has_bbox; - double t3_glyph_bbox[4]; - cairo_antialias_t antialias; - bool prescaleImages; - - TextPage *textPage; // text for the current page - ActualText *actualText; - - cairo_pattern_t *group; - cairo_pattern_t *shape; - cairo_pattern_t *mask; - cairo_matrix_t mask_matrix; - cairo_t *cairo_shape; - int knockoutCount; - struct ColorSpaceStack { - bool knockout; - GfxColorSpace *cs; - cairo_matrix_t group_matrix; - struct ColorSpaceStack *next; - } * groupColorSpaceStack; - - struct MaskStack { - cairo_pattern_t *mask; - cairo_matrix_t mask_matrix; - struct MaskStack *next; - } *maskStack; - -}; - -//------------------------------------------------------------------------ -// CairoImageOutputDev -//------------------------------------------------------------------------ - -//XXX: this should ideally not inherit from CairoOutputDev but use it instead perhaps -class CairoImageOutputDev: public CairoOutputDev { -public: - - // Constructor. - CairoImageOutputDev(); - - // Destructor. - virtual ~CairoImageOutputDev(); - - //----- get info about output device - - // Does this device use upside-down coordinates? - // (Upside-down means (0,0) is the top left corner of the page.) - bool upsideDown() override { return true; } - - // Does this device use drawChar() or drawString()? - bool useDrawChar() override { return false; } - - // Does this device use tilingPatternFill()? If this returns false, - // tiling pattern fills will be reduced to a series of other drawing - // operations. - bool useTilingPatternFill() override { return true; } - - // Does this device use functionShadedFill(), axialShadedFill(), and - // radialShadedFill()? If this returns false, these shaded fills - // will be reduced to a series of other drawing operations. -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) - bool useShadedFills(int type) override { return type <= 7; } -#else - bool useShadedFills(int type) override { return type < 4; } -#endif - - // Does this device use FillColorStop()? - bool useFillColorStop() override { return false; } - - // Does this device use beginType3Char/endType3Char? Otherwise, - // text in Type 3 fonts will be drawn with drawChar/drawString. - bool interpretType3Chars() override { return false; } - - // Does this device need non-text content? - bool needNonText() override { return true; } - - //----- save/restore graphics state - void saveState(GfxState *state) override { } - void restoreState(GfxState *state) override { } - - //----- update graphics state - void updateAll(GfxState *state) override { } - void setDefaultCTM(const double *ctm) override { } - void updateCTM(GfxState *state, double m11, double m12, - double m21, double m22, double m31, double m32) override { } - void updateLineDash(GfxState *state) override { } - void updateFlatness(GfxState *state) override { } - void updateLineJoin(GfxState *state) override { } - void updateLineCap(GfxState *state) override { } - void updateMiterLimit(GfxState *state) override { } - void updateLineWidth(GfxState *state) override { } - void updateFillColor(GfxState *state) override { } - void updateStrokeColor(GfxState *state) override { } - void updateFillOpacity(GfxState *state) override { } - void updateStrokeOpacity(GfxState *state) override { } - void updateBlendMode(GfxState *state) override { } - - //----- update text state - void updateFont(GfxState *state) override { } - - //----- path painting - void stroke(GfxState *state) override { } - void fill(GfxState *state) override { } - void eoFill(GfxState *state) override { } - void clipToStrokePath(GfxState *state) override { } - bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, - const double *pmat, int paintType, int tilingType, Dict *resDict, - const double *mat, const double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep) override { return true; } - bool axialShadedFill(GfxState *state, - GfxAxialShading *shading, - double tMin, double tMax) override { return true; } - bool radialShadedFill(GfxState *state, - GfxRadialShading *shading, - double sMin, double sMax) override { return true; } - - //----- path clipping - void clip(GfxState *state) override { } - void eoClip(GfxState *state) override { } - - //----- image drawing - void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool interpolate, bool inlineImg) override; - void drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - bool interpolate, const int *maskColors, bool inlineImg) override; - void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap, - bool maskInterpolate) override; - void drawMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - bool interpolate, - Stream *maskStr, - int maskWidth, int maskHeight, - bool maskInvert, bool maskInterpolate) override; - void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, bool invert, - bool inlineImg, double *baseMatrix) override; - void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override {} - - - //----- transparency groups and soft masks - void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, - GfxColorSpace * /*blendingColorSpace*/, - bool /*isolated*/, bool /*knockout*/, - bool /*forSoftMask*/) override {} - void endTransparencyGroup(GfxState * /*state*/) override {} - void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override {} - void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, - Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override {} - void clearSoftMask(GfxState * /*state*/) override {} - - //----- Image list - // By default images are not rendred - void setImageDrawDecideCbk(bool (*cbk)(int img_id, void *data), - void *data) { imgDrawCbk = cbk; imgDrawCbkData = data; } - // Iterate through list of images. - int getNumImages() const { return numImages; } - CairoImage *getImage(int i) const { return images[i]; } - -private: - void saveImage(CairoImage *image); - void getBBox(GfxState *state, int width, int height, - double *x1, double *y1, double *x2, double *y2); - - CairoImage **images; - int numImages; - int size; - bool (*imgDrawCbk)(int img_id, void *data); - void *imgDrawCbkData; -}; - -#endif diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc deleted file mode 100644 index 1c7ccd1..0000000 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.cc +++ /dev/null @@ -1,379 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */ -/* - * Copyright © 2009 Mozilla Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Mozilla Corporation not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Mozilla Corporation makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * MOZILLA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT - * SHALL MOZILLA CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - * Author: Jeff Muizelaar, Mozilla Corp. - */ - -//======================================================================== -// -// 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) 2012 Hib Eris -// Copyright (C) 2012, 2017 Adrian Johnson -// Copyright (C) 2018 Adam Reichold -// Copyright (C) 2019 Albert Astals Cid -// Copyright (C) 2019 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 -// -//======================================================================== - - -/* This implements a box filter that supports non-integer box sizes */ - -#include - -#include -#include -#include -#include -#include -#include -#include "goo/gmem.h" -#include "CairoRescaleBox.h" - - -/* we work in fixed point where 1. == 1 << 24 */ -#define FIXED_SHIFT 24 - - -static void downsample_row_box_filter ( - int start, int width, - 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 */ - /* - - value = a * contribution * 1/box_size - value += a * 1/box_size - value += a * 1/box_size - value += a * 1/box_size - value += a * (1 - contribution) * 1/box_size - a * (1/box_size - contribution * 1/box_size) - - box size is constant - - - value = a * contribution_a * 1/box_size + b * contribution_b * 1/box_size - contribution_b = (1 - contribution_a) - = (1 - contribution_a_next) - */ - - /* box size = ceil(src_width/dest_width) */ - int x = 0; - - /* skip to start */ - /* XXX: it might be possible to do this directly instead of iteratively, however - * the iterative solution is simple */ - while (x < start && src < src_limit) - { - int box = 1 << FIXED_SHIFT; - int start_coverage = coverage[x]; - box -= start_coverage; - src++; - while (box >= pixel_coverage && src < src_limit) - { - src++; - box -= pixel_coverage; - } - x++; - } - - while (x < start + width && src < src_limit) - { - uint32_t a = 0; - uint32_t r = 0; - uint32_t g = 0; - uint32_t b = 0; - int box = 1 << FIXED_SHIFT; - int start_coverage = coverage[x]; - - a = ((*src >> 24) & 0xff) * start_coverage; - r = ((*src >> 16) & 0xff) * start_coverage; - g = ((*src >> 8) & 0xff) * start_coverage; - b = ((*src >> 0) & 0xff) * start_coverage; - src++; - x++; - box -= start_coverage; - - while (box >= pixel_coverage && src < src_limit) - { - a += ((*src >> 24) & 0xff) * pixel_coverage; - r += ((*src >> 16) & 0xff) * pixel_coverage; - g += ((*src >> 8) & 0xff) * pixel_coverage; - b += ((*src >> 0) & 0xff) * pixel_coverage; - src++; - - box -= pixel_coverage; - } - - /* multiply by whatever is leftover - * this ensures that we don't bias down. - * i.e. start_coverage + n*pixel_coverage + box == 1 << 24 */ - if (box > 0 && src < src_limit) - { - a += ((*src >> 24) & 0xff) * box; - r += ((*src >> 16) & 0xff) * box; - g += ((*src >> 8) & 0xff) * box; - b += ((*src >> 0) & 0xff) * box; - } - - a >>= FIXED_SHIFT; - r >>= FIXED_SHIFT; - g >>= FIXED_SHIFT; - b >>= FIXED_SHIFT; - - *dest = (a << 24) | (r << 16) | (g << 8) | b; - dest++; - } -} - -static void downsample_columns_box_filter ( - int n, - int start_coverage, - int pixel_coverage, - uint32_t *src, uint32_t *dest) -{ - int stride = n; - while (n--) { - uint32_t a = 0; - uint32_t r = 0; - uint32_t g = 0; - uint32_t b = 0; - uint32_t *column_src = src; - int box = 1 << FIXED_SHIFT; - - a = ((*column_src >> 24) & 0xff) * start_coverage; - r = ((*column_src >> 16) & 0xff) * start_coverage; - g = ((*column_src >> 8) & 0xff) * start_coverage; - b = ((*column_src >> 0) & 0xff) * start_coverage; - column_src += stride; - box -= start_coverage; - - while (box >= pixel_coverage) - { - a += ((*column_src >> 24) & 0xff) * pixel_coverage; - r += ((*column_src >> 16) & 0xff) * pixel_coverage; - g += ((*column_src >> 8) & 0xff) * pixel_coverage; - b += ((*column_src >> 0) & 0xff) * pixel_coverage; - column_src += stride; - box -= pixel_coverage; - } - - if (box > 0) { - a += ((*column_src >> 24) & 0xff) * box; - r += ((*column_src >> 16) & 0xff) * box; - g += ((*column_src >> 8) & 0xff) * box; - b += ((*column_src >> 0) & 0xff) * box; - } - - a >>= FIXED_SHIFT; - r >>= FIXED_SHIFT; - g >>= FIXED_SHIFT; - b >>= FIXED_SHIFT; - - *dest = (a << 24) | (r << 16) | (g << 8) | b; - dest++; - src++; - } -} - -static int compute_coverage (int coverage[], int src_length, int dest_length) -{ - int i; - /* num = src_length/dest_length - total = sum(pixel) / num - - pixel * 1/num == pixel * dest_length / src_length - */ - /* the average contribution of each source pixel */ - int ratio = ((1 << 24)*(long long int)dest_length)/src_length; - /* because ((1 << 24)*(long long int)dest_length) won't always be divisible by src_length - * we'll need someplace to put the other bits. - * - * We want to ensure a + n*ratio < 1<<24 - * - * 1<<24 - * */ - - double scale = (double)src_length/dest_length; - - /* for each destination pixel compute the coverage of the left most pixel included in the box */ - /* I have a proof of this, which this margin is too narrow to contain */ - for (i=0; i= i*scale - - floor((i+1)*scale) - ceil(i*scale) <= scale - - further since: floor((i+1)*scale) - ceil(i*scale) is an integer - - therefore: - floor((i+1)*scale) - ceil(i*scale) <= floor(scale) - */ - - if (left_fract == 0.) - count--; - - /* compute how much the right-most pixel contributes */ - overage = ratio*(right_fract); - - /* the remainder is the amount that the left-most pixel - * contributes */ - coverage[i] = (1<<24) - (count * ratio + overage); - } - - return ratio; -} - - -bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, - signed scaled_width, signed scaled_height, - unsigned short int start_column, unsigned short int start_row, - unsigned short int width, unsigned short int height, - cairo_surface_t *dest_surface) { - int pixel_coverage_x, pixel_coverage_y; - int dest_y; - int src_y = 0; - uint32_t *scanline; - int *x_coverage = nullptr; - int *y_coverage = nullptr; - uint32_t *temp_buf = nullptr; - bool retval = false; - unsigned int *dest; - int dst_stride; - - dest = reinterpret_cast(cairo_image_surface_get_data (dest_surface)); - dst_stride = cairo_image_surface_get_stride (dest_surface); - - scanline = (uint32_t*)gmallocn (orig_width, sizeof(int)); - - x_coverage = (int *)gmallocn (orig_width, sizeof(int)); - y_coverage = (int *)gmallocn (orig_height, sizeof(int)); - - /* we need to allocate enough room for ceil(src_height/dest_height)+1 - Example: - src_height = 140 - dest_height = 50 - src_height/dest_height = 2.8 - - |-------------| 2.8 pixels - |----|----|----|----| 4 pixels - need to sample 3 pixels - - |-------------| 2.8 pixels - |----|----|----|----| 4 pixels - need to sample 4 pixels - */ - - temp_buf = (uint32_t *)gmallocn3 ((orig_height + scaled_height-1)/scaled_height+1, scaled_width, sizeof(uint32_t)); - - if (!x_coverage || !y_coverage || !scanline || !temp_buf) - goto cleanup; - - pixel_coverage_x = compute_coverage (x_coverage, orig_width, scaled_width); - pixel_coverage_y = compute_coverage (y_coverage, orig_height, scaled_height); - - assert (width + start_column <= scaled_width); - - - - /* skip the rows at the beginning */ - for (dest_y = 0; dest_y < start_row; dest_y++) - { - int box = 1 << FIXED_SHIFT; - int start_coverage_y = y_coverage[dest_y]; - box -= start_coverage_y; - src_y++; - while (box >= pixel_coverage_y) - { - box -= pixel_coverage_y; - src_y++; - } - } - - for (; dest_y < start_row + height; dest_y++) - { - int columns = 0; - int box = 1 << FIXED_SHIFT; - int start_coverage_y = y_coverage[dest_y]; - - getRow(src_y, scanline); - downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x); - columns++; - src_y++; - box -= start_coverage_y; - - while (box >= pixel_coverage_y) - { - getRow(src_y, scanline); - downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x); - columns++; - src_y++; - box -= pixel_coverage_y; - } - - /* downsample any leftovers */ - if (box > 0) - { - getRow(src_y, scanline); - downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x); - columns++; - } - - /* now scale the rows we just downsampled in the y direction */ - downsample_columns_box_filter (width, start_coverage_y, pixel_coverage_y, temp_buf, dest); - dest += dst_stride / 4; - -// assert(width*columns <= ((orig_height + scaled_height-1)/scaled_height+1) * width); - } -// assert (src_y<=orig_height); - - retval = true; - -cleanup: - free (x_coverage); - free (y_coverage); - free (temp_buf); - free (scanline); - - return retval; -} diff --git a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.h b/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.h deleted file mode 100644 index b00ad6a..0000000 --- a/pdf2htmlEX/3rdparty/poppler/git/CairoRescaleBox.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright © 2009 Mozilla Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Mozilla Corporation not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Mozilla Corporation makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * MOZILLA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT - * SHALL MOZILLA CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - * Author: Jeff Muizelaar, Mozilla Corp. - */ - -//======================================================================== -// -// 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) 2012 Adrian Johnson -// Copyright (C) 2018 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 CAIRO_RESCALE_BOX_H -#define CAIRO_RESCALE_BOX_H - -#include - -class CairoRescaleBox { -public: - - CairoRescaleBox() {}; - virtual ~CairoRescaleBox() {}; - - CairoRescaleBox(const CairoRescaleBox &) = delete; - CairoRescaleBox& operator=(const CairoRescaleBox &) = delete; - - virtual bool downScaleImage(unsigned orig_width, unsigned orig_height, - signed scaled_width, signed scaled_height, - unsigned short int start_column, unsigned short int start_row, - unsigned short int width, unsigned short int height, - cairo_surface_t *dest_surface); - - virtual void getRow(int row_num, uint32_t *row_data) = 0; - -}; - -#endif /* CAIRO_RESCALE_BOX_H */ diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 7cb7cd0..2bc76a0 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -23,41 +23,32 @@ find_package(PkgConfig) # SINCE we have a very intimate relationship with a particular version of # poppler... we explicitly describe the poppler include and library # paths. - +# include_directories( ../poppler/build/poppler ../poppler/build ../poppler/poppler ../poppler ) - -#link_directories( -# ../poppler/build -#) +# +# The following order is critical as the glib functions use functions +# located in the main poppler library +# set(POPPLER_LIBRARIES ${POPPLER_LIBRARIES} - ${CMAKE_SOURCE_DIR}/../poppler/build/libpoppler.a ${CMAKE_SOURCE_DIR}/../poppler/build/glib/libpoppler-glib.a + ${CMAKE_SOURCE_DIR}/../poppler/build/libpoppler.a ) if(ENABLE_SVG) pkg_check_modules(CAIRO REQUIRED cairo>=1.10.0) - message("Trying to locate cairo-svg...") + message("-- Trying to locate cairo-svg...") find_path(CAIRO_SVG_INCLUDE_PATH cairo-svg.h PATHS ${CAIRO_INCLUDE_DIRS} NO_DEFAULT_PATH) if(CAIRO_SVG_INCLUDE_PATH) + message("-- found cairo-svg...") include_directories(${CAIRO_INCLUDE_DIRS}) link_directories(${CAIRO_LIBRARY_DIRS}) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${CAIRO_LIBRARIES}) set(ENABLE_SVG 1) - set(CAIROOUTPUTDEV_PATH 3rdparty/poppler/git) - include_directories(${CAIROOUTPUTDEV_PATH}) - set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC} - ${CAIROOUTPUTDEV_PATH}/CairoFontEngine.h - ${CAIROOUTPUTDEV_PATH}/CairoFontEngine.cc - ${CAIROOUTPUTDEV_PATH}/CairoRescaleBox.h - ${CAIROOUTPUTDEV_PATH}/CairoRescaleBox.cc - ${CAIROOUTPUTDEV_PATH}/CairoOutputDev.h - ${CAIROOUTPUTDEV_PATH}/CairoOutputDev.cc - ) else() message(FATAL_ERROR "Error: no SVG support found in Cairo") endif() @@ -71,14 +62,14 @@ endif() # SINCE we have a very intimate relationship with a particular version of # fontforge... we explicitly describe the fontforge include and library # paths. - +# include_directories( ../fontforge/fontforge ../fontforge ../fontforge/build/inc ../fontforge/inc ) - +# include_directories(${FONTFORGE_INCLUDE_DIRS}) link_directories(${FONTFORGE_LIBRARY_DIRS}) set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES} From 7b5780ea83c13803811af040b639e1b3169569be Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 06:20:37 +0000 Subject: [PATCH 162/269] updated fontforge to 20200314 --- buildScripts/buildFontforge | 51 +++++++--------------------- buildScripts/buildInstallLocallyApt | 4 --- buildScripts/versionEnvs | 4 +-- pdf2htmlEX/CMakeLists.txt | 4 +-- pdf2htmlEX/src/pdf2htmlEX.cc | 3 +- pdf2htmlEX/src/util/SignalHandler.cc | 2 +- pdf2htmlEX/src/util/ffw.c | 43 +++++++++++++---------- pdf2htmlEX/src/util/ffw.h | 2 -- 8 files changed, 43 insertions(+), 70 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 0dad173..e9c2c76 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -6,50 +6,25 @@ source buildScripts/reSourceVersionEnvs echo "" echo "-------------------------------------------------------------------" -echo "BUILDING FontForge" +echo "BUILDING FontForge (using CMake)" echo "-------------------------------------------------------------------" echo "" -# This is a work-around to fix TravisCI's declaration of PYTHON_CFLAGS -# which is then honoured exactly as is by the fontforge bootstrap and -# configure steps. -# -# see: https://github.com/travis-ci/travis-ci/issues/5301 (unfixed) -# - -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 "" - -# Can use "configure --disable-silent-rules" to debug configuration/make -# problems -# cd fontforge -./bootstrap +mkdir build -./configure \ - --prefix=$PDF2HTMLEX_PREFIX \ - --enable-python-scripting=3 \ - --disable-dependency-tracking \ - --disable-silent-rules \ - --disable-python-scripting \ - --disable-python-extension \ - --disable-shared \ - --enable-static \ - --with-pic \ - --without-x +cd build + +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX \ + -DENABLE_GUI:BOOL=OFF \ + -DENABLE_X11:BOOL=OFF \ + -DENABLE_PYTHON_SCRIPTING:BOOL=OFF \ + -DENABLE_PYTHON_EXTENSION:AUTO=OFF \ + .. # Apply any patches required for fontforge raw sources before we make # diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 608a16d..7aa5e70 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -34,14 +34,10 @@ export PDF2HTMLEX_PREFIX=/usr/local ./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/versionEnvs b/buildScripts/versionEnvs index 3412c83..f38df05 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -20,8 +20,8 @@ export POPPLER_VERSION=poppler-0.83.0 # see: https://github.com/fontforge/fontforge/releases # current working: 20190801 -#export FONTFORGE_VERSION=20200314 -export FONTFORGE_VERSION=20190801 +export FONTFORGE_VERSION=20200314 +#export FONTFORGE_VERSION=20190801 #export FONTFORGE_VERSION=20190413 #export FONTFORGE_VERSION=20190413 #export FONTFORGE_VERSION=20190317 diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 2bc76a0..b617d20 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -73,9 +73,7 @@ include_directories( include_directories(${FONTFORGE_INCLUDE_DIRS}) link_directories(${FONTFORGE_LIBRARY_DIRS}) set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES} - ${CMAKE_SOURCE_DIR}/../fontforge/fontforge/.libs/libfontforge.a - ${CMAKE_SOURCE_DIR}/../fontforge/Unicode/.libs/libgunicode.a - ${CMAKE_SOURCE_DIR}/../fontforge/gutils/.libs/libgutils.a + ${CMAKE_SOURCE_DIR}/../fontforge/build/lib/libfontforge.a ) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index edf32ee..9da5b19 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -63,9 +63,8 @@ void show_version_and_exit(const char * dummy = nullptr) cerr << "Copyright 2012-2015 Lu Wang and other contributors" << endl; cerr << "Libraries: " << endl; cerr << " poppler " << POPPLER_VERSION << endl; - cerr << " libfontforge " << ffwVersionInfo->majorVersion << "." << - ffwVersionInfo->minorVersion << "." << ffwVersionInfo->gitVersion << endl; cerr << " libfontforge (date) " << ffwVersionInfo->versionDate << endl; + cerr << " libfontforge (git) " << ffwVersionInfo->gitVersion << endl; #if ENABLE_SVG cerr << " cairo " << cairo_version_string() << endl; #endif diff --git a/pdf2htmlEX/src/util/SignalHandler.cc b/pdf2htmlEX/src/util/SignalHandler.cc index c19eedc..58a1301 100644 --- a/pdf2htmlEX/src/util/SignalHandler.cc +++ b/pdf2htmlEX/src/util/SignalHandler.cc @@ -157,8 +157,8 @@ void setupSignalHandler( detailInfo = detailInfo + "\n"; detailInfo = detailInfo + "Libraries:\n" ; detailInfo = detailInfo + " poppler " + POPPLER_VERSION + "\n"; - detailInfo = detailInfo + " libfontforge " + ffwVersionInfo->majorVersion + "." + ffwVersionInfo->minorVersion + "." + ffwVersionInfo->gitVersion + "\n"; detailInfo = detailInfo + " libfontforge (date) " + ffwVersionInfo->versionDate + "\n"; + detailInfo = detailInfo + " libfontforge (git) " + ffwVersionInfo->gitVersion + "\n"; #if ENABLE_SVG detailInfo = detailInfo + " cairo " + cairo_version_string() + "\n"; #endif diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index 9dc1d0a..e9a8aa4 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -18,21 +18,21 @@ #include "SignalHandler.h" -#include "ffw.h" // needed for: -#include "gfile.h" // FindProgDir -#include "fontforge-version-extras.h" // FONTFORGE_GIT_VERSION -#include "fontforge/autowidth.h" // FVRemoveKerns -#include "fontforge/bitmapchar.h" // SFReplaceEncodingBDFProps -#include "fontforge/cvimages.h" // FVImportImages -#include "fontforge/encoding.h" // (helpful as we have a name conflict) -#include "fontforge/fvfonts.h" // SFFindSlot -#include "fontforge/namelist.h" // UniFromName -#include "fontforge/savefont.h" // GenerateScript -#include "fontforge/splineorder2.h" // SFConvertToOrder2 -#include "fontforge/splineutil.h" // AltUniFree -#include "fontforge/splineutil2.h" // SplineFontNew -#include "fontforge/start.h" // InitSimpleStuff -#include "fontforge/tottf.h" // SFDefaultOS2Info +#include "ffw.h" // needed for: +#include "gfile.h" // FindProgDir +#include "fontforge-version-extras.h" // FONTFORGE_GIT_VERSION +#include "fontforge/autowidth.h" // FVRemoveKerns +#include "fontforge/bitmapchar.h" // SFReplaceEncodingBDFProps +#include "fontforge/cvimages.h" // FVImportImages +#include "fontforge/encoding.h" // (helpful as we have a name conflict) +#include "fontforge/fvfonts.h" // SFFindSlot +#include "fontforge/namelist.h" // UniFromName +#include "fontforge/savefont.h" // GenerateScript +#include "fontforge/splineorder2.h" // SFConvertToOrder2 +#include "fontforge/splineutil.h" // AltUniFree +#include "fontforge/splineutil2.h" // SplineFontNew +#include "fontforge/start.h" // InitSimpleStuff +#include "fontforge/tottf.h" // SFDefaultOS2Info static real EPS=1e-6; @@ -128,8 +128,6 @@ static FFWVersionInfo ffwVersionInfo; const FFWVersionInfo* ffw_get_version_info(void) { ffwVersionInfo.gitVersion = FONTFORGE_GIT_VERSION; - ffwVersionInfo.majorVersion = xstr(FONTFORGE_VERSION_MAJOR); - ffwVersionInfo.minorVersion = xstr(FONTFORGE_VERSION_MINOR); ffwVersionInfo.versionDate = FONTFORGE_VERSION; return &ffwVersionInfo; @@ -528,7 +526,16 @@ void ffw_import_svg_glyph(int code, const char * filename, double ox, double oy, memset(cur_fv->selected, 0, cur_fv->map->enccount); cur_fv->selected[enc] = 1; - int ok = FVImportImages(cur_fv, (char*)filename, fv_svg, 0, -1); + ImportParams ip; + InitImportParams(&ip); + int ok = FVImportImages( + cur_fv, + (char*)filename, + fv_svg, + 0 /*toback*/, + true /*preclear*/, + &ip + ); if(!ok) err("Import SVG glyph failed"); diff --git a/pdf2htmlEX/src/util/ffw.h b/pdf2htmlEX/src/util/ffw.h index 1e5e35f..ed9dc04 100644 --- a/pdf2htmlEX/src/util/ffw.h +++ b/pdf2htmlEX/src/util/ffw.h @@ -26,8 +26,6 @@ void ffw_finalize(void); typedef struct ffw_version_info { const char* gitVersion; - const char* majorVersion; - const char* minorVersion; const char* versionDate; } FFWVersionInfo ; From 930915df348ea7e0084d98c2f280aa083b89af39 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 06:59:21 +0000 Subject: [PATCH 163/269] removed fontforge git version as it is not a stable representation of 20200314 version --- pdf2htmlEX/src/pdf2htmlEX.cc | 1 - pdf2htmlEX/src/util/SignalHandler.cc | 1 - pdf2htmlEX/src/util/ffw.c | 2 -- pdf2htmlEX/src/util/ffw.h | 1 - 4 files changed, 5 deletions(-) diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index 9da5b19..8d805b2 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -64,7 +64,6 @@ void show_version_and_exit(const char * dummy = nullptr) cerr << "Libraries: " << endl; cerr << " poppler " << POPPLER_VERSION << endl; cerr << " libfontforge (date) " << ffwVersionInfo->versionDate << endl; - cerr << " libfontforge (git) " << ffwVersionInfo->gitVersion << endl; #if ENABLE_SVG cerr << " cairo " << cairo_version_string() << endl; #endif diff --git a/pdf2htmlEX/src/util/SignalHandler.cc b/pdf2htmlEX/src/util/SignalHandler.cc index 58a1301..f98edc5 100644 --- a/pdf2htmlEX/src/util/SignalHandler.cc +++ b/pdf2htmlEX/src/util/SignalHandler.cc @@ -158,7 +158,6 @@ void setupSignalHandler( detailInfo = detailInfo + "Libraries:\n" ; detailInfo = detailInfo + " poppler " + POPPLER_VERSION + "\n"; detailInfo = detailInfo + " libfontforge (date) " + ffwVersionInfo->versionDate + "\n"; - detailInfo = detailInfo + " libfontforge (git) " + ffwVersionInfo->gitVersion + "\n"; #if ENABLE_SVG detailInfo = detailInfo + " cairo " + cairo_version_string() + "\n"; #endif diff --git a/pdf2htmlEX/src/util/ffw.c b/pdf2htmlEX/src/util/ffw.c index e9a8aa4..ff2473f 100644 --- a/pdf2htmlEX/src/util/ffw.c +++ b/pdf2htmlEX/src/util/ffw.c @@ -20,7 +20,6 @@ #include "ffw.h" // needed for: #include "gfile.h" // FindProgDir -#include "fontforge-version-extras.h" // FONTFORGE_GIT_VERSION #include "fontforge/autowidth.h" // FVRemoveKerns #include "fontforge/bitmapchar.h" // SFReplaceEncodingBDFProps #include "fontforge/cvimages.h" // FVImportImages @@ -127,7 +126,6 @@ static FFWVersionInfo ffwVersionInfo; const FFWVersionInfo* ffw_get_version_info(void) { - ffwVersionInfo.gitVersion = FONTFORGE_GIT_VERSION; ffwVersionInfo.versionDate = FONTFORGE_VERSION; return &ffwVersionInfo; diff --git a/pdf2htmlEX/src/util/ffw.h b/pdf2htmlEX/src/util/ffw.h index ed9dc04..50a7f50 100644 --- a/pdf2htmlEX/src/util/ffw.h +++ b/pdf2htmlEX/src/util/ffw.h @@ -25,7 +25,6 @@ void ffw_init(const char* progPath, int debug); void ffw_finalize(void); typedef struct ffw_version_info { - const char* gitVersion; const char* versionDate; } FFWVersionInfo ; From e4c666b4bf280c3d29c0d58cde78d4a973f12b91 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 07:46:22 +0000 Subject: [PATCH 164/269] corrected ill advised copy of libfontconfig into appImage --- buildScripts/createAppImage | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 1cb86d2..e9fd107 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -31,9 +31,11 @@ make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/appDir cd ../imageBuild -# force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig) +# force libfontconfig into AppImage (linuxdeploy blacklists libfontconfig) +# (turned off since libfontconfig needs to be matched to the underlying +# OS's collection of fonts and /etc/fonts configuration files) # -cp /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 appDir/usr/lib/ +#cp /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 appDir/usr/lib/ LINUX_DEPLOY_APP_IMAGE=linuxdeploy-$MACHINE_ARCH.AppImage From be1d2079ac789f6338f0e22b274af2704761e728 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 09:55:35 +0000 Subject: [PATCH 165/269] poppler 0.84.0 removed ModRegion tracking --- buildScripts/versionEnvs | 4 ++-- .../SplashBackgroundRenderer.cc | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index f38df05..5f552a6 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -12,8 +12,8 @@ #export POPPLER_VERSION=poppler-0.86.1 #export POPPLER_VERSION=poppler-0.86.0 #export POPPLER_VERSION=poppler-0.85.0 -#export POPPLER_VERSION=poppler-0.84.0 -export POPPLER_VERSION=poppler-0.83.0 +export POPPLER_VERSION=poppler-0.84.0 +#export POPPLER_VERSION=poppler-0.83.0 #export POPPLER_VERSION=poppler-0.82.0 #export POPPLER_VERSION=poppler-0.81.0 diff --git a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc index 757f0a1..7ce22d7 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -59,7 +59,7 @@ SplashBackgroundRenderer::SplashBackgroundRenderer(const string & imgFormat, HTM void SplashBackgroundRenderer::startPage(int pageNum, GfxState *state, XRef *xrefA) { SplashOutputDev::startPage(pageNum, state, xrefA); - clearModRegion(); +// clearModRegion(); } void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y, @@ -127,8 +127,17 @@ void SplashBackgroundRenderer::embed_image(int pageno) { // xmin->xmax is top->bottom int xmin, xmax, ymin, ymax; - getModRegion(&xmin, &ymin, &xmax, &ymax); - +// getModRegion(&xmin, &ymin, &xmax, &ymax); +// poppler-0.84.0 hack to recover from the removal of ModRegion tracking +// + auto * bitmap = getBitmap(); + xmin = 0; + xmax = bitmap->getWidth(); + ymin = 0; + ymax = bitmap->getHeight(); +// +// end of hack + // dump the background image only when it is not empty if((xmin <= xmax) && (ymin <= ymax)) { From e60bd3819efa42bd0e7c08a604c022627cf57fda Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 11:21:22 +0000 Subject: [PATCH 166/269] tidied up previous changes --- pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc index 7ce22d7..1f6c184 100644 --- a/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc +++ b/pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc @@ -59,7 +59,6 @@ SplashBackgroundRenderer::SplashBackgroundRenderer(const string & imgFormat, HTM void SplashBackgroundRenderer::startPage(int pageNum, GfxState *state, XRef *xrefA) { SplashOutputDev::startPage(pageNum, state, xrefA); -// clearModRegion(); } void SplashBackgroundRenderer::drawChar(GfxState *state, double x, double y, @@ -127,8 +126,7 @@ void SplashBackgroundRenderer::embed_image(int pageno) { // xmin->xmax is top->bottom int xmin, xmax, ymin, ymax; -// getModRegion(&xmin, &ymin, &xmax, &ymax); -// poppler-0.84.0 hack to recover from the removal of ModRegion tracking +// poppler-0.84.0 hack to recover from the removal of *ModRegion tracking // auto * bitmap = getBitmap(); xmin = 0; From 0544f79f52bbc1165cfc9550dd90ded64be0f871 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 12:44:57 +0000 Subject: [PATCH 167/269] updated to poppler-0.85.0 no obvious changes --- buildScripts/versionEnvs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 5f552a6..0f43414 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -11,8 +11,8 @@ #export POPPLER_VERSION=poppler-0.87.0 #export POPPLER_VERSION=poppler-0.86.1 #export POPPLER_VERSION=poppler-0.86.0 -#export POPPLER_VERSION=poppler-0.85.0 -export POPPLER_VERSION=poppler-0.84.0 +export POPPLER_VERSION=poppler-0.85.0 +#export POPPLER_VERSION=poppler-0.84.0 #export POPPLER_VERSION=poppler-0.83.0 #export POPPLER_VERSION=poppler-0.82.0 #export POPPLER_VERSION=poppler-0.81.0 From 0217c93418968a24b8f9ceab13b5d583ea65bf20 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 15:26:11 +0000 Subject: [PATCH 168/269] findDest now returns stg::unique_ptr and getURI no longer returns GOOString but simpley std::string --- buildScripts/versionEnvs | 4 ++-- pdf2htmlEX/src/HTMLRenderer/link.cc | 30 ++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 0f43414..fccfd8e 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -9,9 +9,9 @@ #export POPPLER_VERSION=poppler-0.89.0 #export POPPLER_VERSION=poppler-0.88.0 #export POPPLER_VERSION=poppler-0.87.0 -#export POPPLER_VERSION=poppler-0.86.1 +export POPPLER_VERSION=poppler-0.86.1 #export POPPLER_VERSION=poppler-0.86.0 -export POPPLER_VERSION=poppler-0.85.0 +#export POPPLER_VERSION=poppler-0.85.0 #export POPPLER_VERSION=poppler-0.84.0 #export POPPLER_VERSION=poppler-0.83.0 #export POPPLER_VERSION=poppler-0.82.0 diff --git a/pdf2htmlEX/src/HTMLRenderer/link.cc b/pdf2htmlEX/src/HTMLRenderer/link.cc index 842b6de..7cfb1bc 100644 --- a/pdf2htmlEX/src/HTMLRenderer/link.cc +++ b/pdf2htmlEX/src/HTMLRenderer/link.cc @@ -34,7 +34,11 @@ using std::endl; * The string will be put into a HTML attribute, surrounded by single quotes * So pay attention to the characters used here */ -static string get_linkdest_detail_str(LinkDest * dest, Catalog * catalog, int & pageno) +static string get_linkdest_detail_str( + LinkDest * dest, // borrow the caller's std::unique_ptr + Catalog * catalog, + int & pageno +) { pageno = 0; if(dest->isPageRef()) @@ -126,7 +130,10 @@ static string get_linkdest_detail_str(LinkDest * dest, Catalog * catalog, int & return sout.str(); } -string HTMLRenderer::get_linkaction_str(const LinkAction * action, string & detail) +string HTMLRenderer::get_linkaction_str( + const LinkAction * action, + string & detail +) { string dest_str; detail = ""; @@ -137,21 +144,26 @@ string HTMLRenderer::get_linkaction_str(const LinkAction * action, string & deta { case actionGoTo: { - auto * real_action = dynamic_cast(action); - LinkDest * dest = nullptr; + auto * real_action = + dynamic_cast(action); + std::unique_ptr dest = nullptr; if(auto _ = real_action->getDest()) - dest = _->copy(); + dest = std::unique_ptr( _->copy() ); else if (auto _ = real_action->getNamedDest()) dest = cur_catalog->findDest(_); if(dest) { int pageno = 0; - detail = get_linkdest_detail_str(dest, cur_catalog, pageno); + detail = get_linkdest_detail_str( + dest.get(), cur_catalog, pageno + ); if(pageno > 0) { - dest_str = (char*)str_fmt("#%s%x", CSS::PAGE_FRAME_CN, pageno); + dest_str = (char*)str_fmt( + "#%s%x", CSS::PAGE_FRAME_CN, pageno + ); } - delete dest; + dest.reset(); } } break; @@ -164,7 +176,7 @@ string HTMLRenderer::get_linkaction_str(const LinkAction * action, string & deta { auto * real_action = dynamic_cast(action); assert(real_action != nullptr); - dest_str = real_action->getURI()->toStr(); + dest_str = real_action->getURI(); } break; case actionLaunch: From 5cb2553bc6f7121c380a2d62146e1a8bcacda1e1 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 18:48:06 +0000 Subject: [PATCH 169/269] update to poppler 0.87.0 with no obvious changes --- buildScripts/versionEnvs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index fccfd8e..ec28b5c 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -8,8 +8,8 @@ #export POPPLER_VERSION=poppler-0.89.0 #export POPPLER_VERSION=poppler-0.88.0 -#export POPPLER_VERSION=poppler-0.87.0 -export POPPLER_VERSION=poppler-0.86.1 +export POPPLER_VERSION=poppler-0.87.0 +#export POPPLER_VERSION=poppler-0.86.1 #export POPPLER_VERSION=poppler-0.86.0 #export POPPLER_VERSION=poppler-0.85.0 #export POPPLER_VERSION=poppler-0.84.0 From 091f8b3828fe06628d0a964b21de2bb6c3b1fabc Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 19:07:04 +0000 Subject: [PATCH 170/269] updated to poppler-0.88.0 no obvious changes --- buildScripts/versionEnvs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index ec28b5c..528e2f1 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -7,8 +7,8 @@ # current working: 0.83.0 #export POPPLER_VERSION=poppler-0.89.0 -#export POPPLER_VERSION=poppler-0.88.0 -export POPPLER_VERSION=poppler-0.87.0 +export POPPLER_VERSION=poppler-0.88.0 +#export POPPLER_VERSION=poppler-0.87.0 #export POPPLER_VERSION=poppler-0.86.1 #export POPPLER_VERSION=poppler-0.86.0 #export POPPLER_VERSION=poppler-0.85.0 From 53005f5e5ce3e12c02ace335b103743279668af9 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sat, 30 May 2020 21:19:25 +0000 Subject: [PATCH 171/269] updated to poppler-0.89.0 with no obvious changes --- buildScripts/versionEnvs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs index 528e2f1..11a4f69 100755 --- a/buildScripts/versionEnvs +++ b/buildScripts/versionEnvs @@ -6,8 +6,8 @@ # see: https://poppler.freedesktop.org/releases.html # current working: 0.83.0 -#export POPPLER_VERSION=poppler-0.89.0 -export POPPLER_VERSION=poppler-0.88.0 +export POPPLER_VERSION=poppler-0.89.0 +#export POPPLER_VERSION=poppler-0.88.0 #export POPPLER_VERSION=poppler-0.87.0 #export POPPLER_VERSION=poppler-0.86.1 #export POPPLER_VERSION=poppler-0.86.0 From d27f7d3a8be7d3b08645ea018dd2f2618eeef0ae Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 31 May 2020 07:18:54 +0000 Subject: [PATCH 172/269] recorded cmake build options for fontforge and poppler turn off options not used by pdf2htmlEX --- buildScripts/buildFontforge | 53 ++++++++++++++++++++++++- buildScripts/buildPoppler | 79 +++++++++++++++++++++++++++++++++++-- 2 files changed, 128 insertions(+), 4 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index e9c2c76..e347dc5 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -18,12 +18,33 @@ cd build cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ -DENABLE_GUI:BOOL=OFF \ -DENABLE_X11:BOOL=OFF \ + -DENABLE_NATIVE_SCRIPTING:BOOL=ON \ -DENABLE_PYTHON_SCRIPTING:BOOL=OFF \ -DENABLE_PYTHON_EXTENSION:AUTO=OFF \ + -DENABLE_LIBSPIRO:BOOL=ON \ + -DENABLE_LIBUNINAMESLIST:BOOL=ON \ + -DENABLE_LIBGIF:AUTO=OFF \ + -DENABLE_LIBJPEG:AUTO=ON \ + -DENABLE_LIBPNG:AUTO=ON \ + -DENABLE_LIBREADLINE:AUTO=OFF \ + -DENABLE_LIBTIFF:AUTO=OFF \ + -DENABLE_WOFF2:AUTO=OFF \ + -DENABLE_DOCS:AUTO=OFF \ + -DENABLE_CODE_COVERAGE:BOOL=OFF \ + -DENABLE_DEBUG_RAW_POINTS:BOOL=OFF \ + -DENABLE_FONTFORGE_EXTRAS:BOOL=OFF \ + -DENABLE_MAINTAINER_TOOLS:BOOL=OFF \ + -DENABLE_TILE_PATH:BOOL=OFF \ + -DENABLE_WRITE_PFM:BOOL=OFF \ + -DENABLE_SANITIZER:ENUM="none" \ + -DENABLE_FREETYPE_DEBUGGER:PATH="" \ + -DSPHINX_USE_VENV:BOOL=OFF \ + -DREAL_TYPE:ENUM="double" \ + -DTHEME:ENUM="tango" \ .. # Apply any patches required for fontforge raw sources before we make @@ -36,3 +57,33 @@ cmake \ make $MAKE_PARALLEL +########################################################## +# FontForge CMakeLists.txt build options (2020/05/31): + +# BUILD_SHARED_LIBS:BOOL=OFF "Build libfontforge as a shared library") +# ENABLE_GUI:BOOL=OFF "Build FontForge with GUI support") +# ENABLE_X11:BOOL=OFF "Build the GUI using the X backend INSTEAD of the GDK backend" "ENABLE_GUI") +# ENABLE_NATIVE_SCRIPTING:BOOL=ON "Enables FontForge's native scripting support") +# ENABLE_PYTHON_SCRIPTING:BOOL=OFF "Enables FontForge's Python scripting support") +# ENABLE_PYTHON_EXTENSION:AUTO=OFF "Builds the Python models for use with system python") +# ENABLE_LIBSPIRO:BOOL=ON "Enables libspiro support") +# ENABLE_LIBUNINAMESLIST:BOOL=ON "Enables libuninameslist support") +# ENABLE_LIBGIF:AUTO=OFF "Enables GIF support") +# ENABLE_LIBJPEG:AUTO=ON "Enables JPEG support") +# ENABLE_LIBPNG:AUTO=ON "Enables PNG support") +# ENABLE_LIBREADLINE:AUTO=OFF "Enables Readline support") +# ENABLE_LIBTIFF:AUTO=OFF "Enables TIFF support") +# ENABLE_WOFF2:AUTO=OFF "Enables WOFF2 support") +# ENABLE_DOCS:AUTO=OFF "Enables building and installing documentation. Sphinx is required to build it.") +# ENABLE_CODE_COVERAGE:BOOL=OFF "Build with code coverage support") +# ENABLE_DEBUG_RAW_POINTS:BOOL=OFF "Add a raw mode to the points window of the debugger") +# ENABLE_FONTFORGE_EXTRAS:BOOL=OFF "Builds programs from the contrib directory") +# ENABLE_MAINTAINER_TOOLS:BOOL=OFF "Build programs normally only used by FontForge maintainers and developers") +# ENABLE_TILE_PATH:BOOL=OFF "Enable a 'tile path' command (a variant of 'expand stroke')") +# ENABLE_WRITE_PFM:BOOL=OFF "Add the ability to save a PFM file without creating the associated font file") +# ENABLE_SANITIZER:ENUM="none" "Enables a sanitizer. Requires support from the compiler." +# ENABLE_FREETYPE_DEBUGGER:PATH="" "Use FreeTypes internal debugger within FontForge." +# SPHINX_USE_VENV:BOOL=OFF "If building documentation and Sphinx is not installed, try to install and use it from a python3 venv." +# REAL_TYPE:ENUM="double" "Sets the floating point type used." "double" "float") +# THEME:ENUM="tango" "Sets the GUI theme." "tango" "2012") + diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 6375760..da4dba8 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -4,7 +4,7 @@ echo "" echo "-------------------------------------------------------------------" -echo "BUILDING Poppler" +echo "BUILDING Poppler (using CMake)" echo "-------------------------------------------------------------------" echo "" @@ -13,8 +13,81 @@ mkdir build cd build cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX \ - -DENABLE_LIBOPENJPEG=none \ + -DENABLE_UNSTABLE_API_ABI_HEADERS=OFF \ + -DBUILD_GTK_TESTS=OFF \ + -DBUILD_QT5_TESTS=OFF \ + -DBUILD_CPP_TESTS=OFF \ + -DENABLE_SPLASH=ON \ + -DENABLE_UTILS=OFF \ + -DENABLE_CPP=ON \ + -DENABLE_GLIB=ON \ + -DENABLE_GOBJECT_INTROSPECTION=ON \ + -DENABLE_GTK_DOC=OFF \ + -DENABLE_QT5=OFF \ + -DENABLE_LIBOPENJPEG="none" \ + -DENABLE_CMS="lcms2" \ + -DENABLE_DCTDECODER="libjpeg" \ + -DENABLE_LIBCURL=OFF \ + -DENABLE_ZLIB=ON \ + -DENABLE_ZLIB_UNCOMPRESS=OFF \ + -DUSE_FLOAT=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DRUN_GPERF_IF_PRESENT=OFF \ + -DEXTRA_WARN=OFF \ .. + make $MAKE_PARALLEL + + +############################################################### +# Poppler CMakeLists.text build options (2020/05/31): + +# ENABLE_UNSTABLE_API_ABI_HEADERS=OFF "Install API/ABI unstable xpdf headers." +# BUILD_GTK_TESTS=OFF "Whether to compile the GTK+ test programs." +# BUILD_QT5_TESTS=OFF "Whether to compile the Qt5 test programs." +# BUILD_CPP_TESTS=OFF "Whether to compile the CPP test programs." +# ENABLE_SPLASH=ON "Build the Splash graphics backend." +# ENABLE_UTILS=OFF "Compile poppler command line utils." +# ENABLE_CPP=ON "Compile poppler cpp wrapper." +# ENABLE_GLIB=ON "Compile poppler glib wrapper." +# ENABLE_GOBJECT_INTROSPECTION=ON "Whether to generate GObject introspection." +# ENABLE_GTK_DOC=OFF "Whether to generate glib API documentation." +# ENABLE_QT5=OFF "Compile poppler qt5 wrapper." +# +# ENABLE_LIBOPENJPEG="none" +# +# "Use libopenjpeg for JPX streams. Possible values: openjpeg2, +# unmaintained, none. 'unmaintained' gives you the internal unmaintained +# decoder. Use at your own risk. 'none' compiles no JPX decoder at all. +# Default: openjpeg2" +# +# ENABLE_CMS="lcms2" +# +# "Use color management system. Possible values: lcms2, none. 'none' +# disables color management system." +# +# ENABLE_DCTDECODER="libjpeg" +# +# "Use libjpeg for DCT streams. Possible values: libjpeg, unmaintained, +# none. will use libjpeg if available or fail if not. 'unmaintained' gives +# you the internal unmaintained decoder. Use at your own risk. 'none' +# compiles no DCT decoder at all. Default: libjpeg" +# +# ENABLE_LIBCURL=OFF "Build libcurl based HTTP support." +# ENABLE_ZLIB=ON "Build with zlib." +# ENABLE_ZLIB_UNCOMPRESS=OFF "Use zlib to uncompress flate streams (not totally safe)." +# USE_FLOAT=OFF "Use single precision arithmetic in the Splash backend" +# BUILD_SHARED_LIBS=OFF "Build poppler as a shared library" +# RUN_GPERF_IF_PRESENT=OFF "Run gperf if it is found" +# EXTRA_WARN=OFF "Enable extra compile warnings" + +# The following packages are optional and only used if found: +# JPEG is required by pdf2htmlEX +# PNG is required by pdf2htmlEX +# TIFF is not used by pdf2htmlEX +# NSS3 is not used by pdf2htmlEX? +# CAIRO is required by pdf2htmlEX +# GLIB is requrired by pdf2htmlEX +# GObjectIntrospection is not needed by pdf2htmlEX? +# Iconv is only used if ENABLE_CPP From 465d2f0f32603929e095e90f6ce543067a626684 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 31 May 2020 07:57:12 +0000 Subject: [PATCH 173/269] updated build options for fontforge and poppler to a minimum --- buildScripts/buildFontforge | 4 ++-- buildScripts/buildPoppler | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index e347dc5..8fd39c5 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -25,8 +25,8 @@ cmake \ -DENABLE_NATIVE_SCRIPTING:BOOL=ON \ -DENABLE_PYTHON_SCRIPTING:BOOL=OFF \ -DENABLE_PYTHON_EXTENSION:AUTO=OFF \ - -DENABLE_LIBSPIRO:BOOL=ON \ - -DENABLE_LIBUNINAMESLIST:BOOL=ON \ + -DENABLE_LIBSPIRO:BOOL=OFF \ + -DENABLE_LIBUNINAMESLIST:BOOL=OFF \ -DENABLE_LIBGIF:AUTO=OFF \ -DENABLE_LIBJPEG:AUTO=ON \ -DENABLE_LIBPNG:AUTO=ON \ diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index da4dba8..08103ff 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -20,13 +20,13 @@ cmake \ -DBUILD_CPP_TESTS=OFF \ -DENABLE_SPLASH=ON \ -DENABLE_UTILS=OFF \ - -DENABLE_CPP=ON \ + -DENABLE_CPP=OFF \ -DENABLE_GLIB=ON \ - -DENABLE_GOBJECT_INTROSPECTION=ON \ + -DENABLE_GOBJECT_INTROSPECTION=OFF \ -DENABLE_GTK_DOC=OFF \ -DENABLE_QT5=OFF \ -DENABLE_LIBOPENJPEG="none" \ - -DENABLE_CMS="lcms2" \ + -DENABLE_CMS="none" \ -DENABLE_DCTDECODER="libjpeg" \ -DENABLE_LIBCURL=OFF \ -DENABLE_ZLIB=ON \ From 576d2b71d9c8b902895d293be80642874afbaef9 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 31 May 2020 08:03:43 +0000 Subject: [PATCH 174/269] begun removing un-used libraries --- buildScripts/getBuildToolsApt | 28 ++++++++++++++-------------- buildScripts/getDevLibrariesApt | 23 +++++++++++++---------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/buildScripts/getBuildToolsApt b/buildScripts/getBuildToolsApt index 92e42fd..97acf12 100755 --- a/buildScripts/getBuildToolsApt +++ b/buildScripts/getBuildToolsApt @@ -13,19 +13,19 @@ echo "-------------------------------------------------------------------" echo "" sudo apt-get update -sudo apt-get $UNATTENDED install \ - aptitude \ - git \ - pkg-config \ - ruby \ - autoconf \ - libtool \ - cmake \ - make \ - gcc \ - g++ \ - gettext \ - openjdk-8-jre-headless \ - jq \ +sudo apt-get $UNATTENDED install \ + aptitude \ + git \ + pkg-config \ + ruby \ + autoconf \ + libtool \ + cmake \ + make \ + gcc \ + g++ \ + gettext \ + openjdk-8-jre-headless \ + jq \ tree diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibrariesApt index ce518a2..b0e9140 100755 --- a/buildScripts/getDevLibrariesApt +++ b/buildScripts/getDevLibrariesApt @@ -14,13 +14,16 @@ echo "-------------------------------------------------------------------" echo "" sudo apt-get update -sudo apt-get $UNATTENDED install \ - libcairo-dev \ - libspiro-dev \ - libpng-dev \ - libjpeg-dev \ - libpango1.0-dev \ - liblcms2-dev \ - libxml2-dev \ - libuninameslist-dev \ - python3-dev +sudo apt-get $UNATTENDED install \ + libcairo-dev \ + libpng-dev \ + libjpeg-dev \ + + +# libspiro-dev \ +# libpango1.0-dev \ +# liblcms2-dev \ +# libxml2-dev \ +# libuninameslist-dev \ +# python3-dev + From 2d293d2b6177f16046c7008454cc856167163e31 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 31 May 2020 08:28:39 +0000 Subject: [PATCH 175/269] corrected required packages and worked on pdf2htmlEX library list --- buildScripts/getDevLibrariesApt | 3 +-- pdf2htmlEX/CMakeLists.txt | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibrariesApt index b0e9140..3041050 100755 --- a/buildScripts/getDevLibrariesApt +++ b/buildScripts/getDevLibrariesApt @@ -18,12 +18,11 @@ sudo apt-get $UNATTENDED install \ libcairo-dev \ libpng-dev \ libjpeg-dev \ - + libxml2-dev \ # libspiro-dev \ # libpango1.0-dev \ # liblcms2-dev \ -# libxml2-dev \ # libuninameslist-dev \ # python3-dev diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index b617d20..6bc37b1 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -82,20 +82,21 @@ set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} -lfreetype -lfontconfig -ljpeg - -lz - -llcms2 -lpng -lz - -llcms2 -pthread - -lspiro - -luninameslist -lm -lxml2 -lglib-2.0 -lgio-2.0 ) +# -llcms2 +# -lz +# -llcms2 +# -lspiro +# -luninameslist + # debug build flags (overwrite default cmake debug flags) set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg") set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -pg") From 040037ad3ace38b95f486640753e8084501b232e Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 31 May 2020 13:58:56 +0100 Subject: [PATCH 176/269] begun work on reintroducing building debian packages --- buildScripts/createDebianPackage | 156 ++++++++++++++++ debian/changelog | 311 +++++++++++++++++++++++++++++++ debian/compat | 1 + debian/control | 14 ++ debian/copyright | 23 +++ debian/dirs | 1 + debian/pdf2htmlex.NEWS | 0 debian/pdf2htmlex.README | 1 + debian/pdf2htmlex.TODO | 0 debian/rules | 14 ++ debian/source/format | 2 + 11 files changed, 523 insertions(+) create mode 100755 buildScripts/createDebianPackage create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/pdf2htmlex.NEWS create mode 100644 debian/pdf2htmlex.README create mode 100644 debian/pdf2htmlex.TODO create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/buildScripts/createDebianPackage b/buildScripts/createDebianPackage new file mode 100755 index 0000000..a100f6b --- /dev/null +++ b/buildScripts/createDebianPackage @@ -0,0 +1,156 @@ +#!/usr/bin/env python + +""" +Dirty script for building package for PPA +by WangLu +2011.01.13 + +modified for pdf2htmlEX +2012.08.28 + +modified for general git repo +2013.05.30 +""" + +import os +import sys +import re +import time + +package='pdf2htmlex' +ppa_name='ppa:pdf2htmlex/pdf2htmlex' +supported_distributions=('disco',) +dist_pattern=re.compile('|'.join(['\\) '+i for i in supported_distributions])) +archive_cmd='(rm CMakeCache.txt || true) && cmake . && make dist' +archive_suffix='.tar.bz2' + +if os.path.exists('../build-area'): + sys.stdout.write('Build area already exists, delete to continue?(y/n)') + sys.stdout.flush() + ans = raw_input().lower() + while ans not in ['y', 'n']: + sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') + ans = raw_input().lower() + + if ans == 'n': + print 'Skipped.' + sys.exit(0) + + if os.system('rm -rf ../build-area') != 0: + print 'Failed to clean up old build directory' + sys.exit(-1) + +print 'Generating version...' +try: + version = re.findall(r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', open('CMakeLists.txt').read())[0] +except: + print 'Cannot get package name and version number' + sys.exit(-1) + +try: + rev = open('.git/refs/heads/master').read()[:5] +except: + print 'Cannot get revision number' + sys.exit(-1) + +projectdir=os.getcwd() +today_timestr = time.strftime('%Y%m%d') +deb_version = version+'-1~git'+today_timestr+'r'+rev +full_deb_version = deb_version+'-0ubuntu1' + +print 'Version: %s' % (version,) +print 'Full Version: %s' % (full_deb_version,) + +#check if we need to update debian/changelog +with open('debian/changelog') as f: + if re.findall(r'\(([^)]+)\)', f.readline())[0] == full_deb_version: + print + print 'No need to update debian/changelog, skipping' + else: + print + print 'Writing debian/changelog' + if os.system('dch -v "%s"' % (full_deb_version,)) != 0: + print 'Failed when updating debian/changelog' + sys.exit(-1) + +# changelog may have been updated, reopen it +with open('debian/changelog') as f: + #check dist mark of changelog + changelog = f.read() + m = dist_pattern.search(changelog) + if m is None or m.pos >= changelog.find('\n'): + print 'Cannot locate the dist name in the first line of changelog' + sys.exit(-1) + +print +print 'Preparing build ...' +# handling files +if os.system(archive_cmd) != 0: + print 'Failed in creating tarball' + sys.exit(-1) + +orig_tar_filename = package+'-'+version+archive_suffix +os.mkdir('../build-area') +if os.system('test -e %s && cp %s ../build-area/' % (orig_tar_filename, orig_tar_filename)) != 0: + print 'Cannot copy tarball file to build area' + sys.exit(-1) + +deb_orig_tar_filename = package+'_'+deb_version+'.orig'+archive_suffix +try: + os.chdir('../build-area') +except: + print 'Cannot find ../build-area' + sys.exit(-1) + +# remove old dir +os.system('rm -rf %s' % (package+'-'+version,)) + +if os.system('mv %s %s && tar -xvf %s' % (orig_tar_filename, deb_orig_tar_filename, deb_orig_tar_filename)) != 0: + print 'Cannot extract tarball' + sys.exit(-1) + +try: + os.chdir(package+'-'+version) +except: + print 'Cannot enter project dir' + sys.exit(-1) + +os.system('cp -r %s/debian .' % (projectdir,)) + +for cur_dist in supported_distributions: + print + print 'Building for ' + cur_dist + ' ...' + # substitute distribution name + with open('debian/changelog', 'w') as f: + f.write(dist_pattern.sub('~%s1) %s' % (cur_dist, cur_dist), changelog, 1)) + +# No PPA Orginization set up, only building dpkg +# # building for ppa +# if os.system('debuild -S -sa') != 0: +# print 'Failed in debuild' +# sys.exit(-1) +# +# print +# sys.stdout.write('Everything seems to be good so far, upload?(y/n)') +# sys.stdout.flush() +# ans = raw_input().lower() +# while ans not in ['y', 'n']: +# sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') +# ans = raw_input().lower() +# +# if ans == 'n': +# print 'Skipped.' +# sys.exit(0) +# +# print 'Uploading' +# if os.system('dput %s ../%s' % (ppa_name, package+'_'+full_deb_version+'~'+cur_dist+'1_source.changes')) != 0: +# print 'Failed in uploading by dput' +# sys.exit(-1) + + # building for dpkg + if os.system('dpkg-buildpackage -b --no-sign') != 0: + print 'Failed in dpkg-buildpackage' + sys.exit(-1) + +print 'Build area not cleaned.' +print 'All done. Cool!' diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..4601bfc --- /dev/null +++ b/debian/changelog @@ -0,0 +1,311 @@ +pdf2htmlex (0.18.7-1~git20190927rb69b8-0ubuntu1) disco; urgency=low + + * Package for poppler-0.81.0 + + -- Stephen Gaito Fri, 27 Sep 2019 12:55:39 +0000 + +pdf2htmlex (0.18.6-1~git20190927r583b1-0ubuntu1) disco; urgency=low + + * Package for poppler-0.80.0 + + -- Stephen Gaito Fri, 27 Sep 2019 11:58:57 +0000 + +pdf2htmlex (0.18.5-1~git20190927rdb4cc-0ubuntu1) disco; urgency=low + + * Package for poppler-0.79.0 + + -- Stephen Gaito Fri, 27 Sep 2019 09:12:53 +0000 + +pdf2htmlex (0.18.4-1~git20190927r34bac-0ubuntu1) disco; urgency=low + + * Package for poppler-0.78.0 + + -- Stephen Gaito Fri, 27 Sep 2019 07:46:26 +0000 + +pdf2htmlex (0.18.3-1~git20190926r7ed19-0ubuntu1) disco; urgency=low + + * Package for poppler-0.77.0 + + -- Stephen Gaito Thu, 26 Sep 2019 17:56:51 +0000 + +pdf2htmlex (0.18.2-1~git20190926ra37f7-0ubuntu1) disco; urgency=low + + * Package for poppler-0.76.0 + + -- Stephen Gaito Thu, 26 Sep 2019 15:29:27 +0000 + +pdf2htmlex (0.18.1-1~git20190926r11e2a-0ubuntu1) disco; urgency=low + + * Package for poppler-0.75.0 + + -- Stephen Gaito Thu, 26 Sep 2019 10:59:59 +0000 + +pdf2htmlex (0.18.0-1~git20190924r37921-0ubuntu1) disco; urgency=medium + + * Package for Ubuntu 19.04 (poppler-0.74.0) + + -- Stephen Gaito Tue, 24 Sep 2019 14:56:03 +0000 + +pdf2htmlex (0.17.0-1~git20190924r37921-0ubuntu1) cosmic; urgency=low + + * Package for 18.10 (poppler-0.68.0) + + -- Stephen Gaito Tue, 24 Sep 2019 10:32:08 +0000 + +pdf2htmlex (0.16.0-1~git20190920r21a9f-0ubuntu1) bionic; urgency=low + + * Package for 18.04 + + -- Trent Petersen Thu, 19 Sep 2019 10:33:35 -0500 + +pdf2htmlex (0.11-1~git201311150048r23755-0ubuntu1) saucy; urgency=low + + * Fix packaging + + -- WANG Lu Fri, 15 Nov 2013 00:48:06 +0800 + +pdf2htmlex (0.11-1~git201311042119refddc-0ubuntu1) saucy; urgency=low + + * Packaging for 13.10 + + -- WANG Lu Mon, 04 Nov 2013 21:19:41 +0800 + +pdf2htmlex (0.11-1~git201310172203re1b11-0ubuntu1) raring; urgency=low + + * Fix typo in dependencies + + -- WANG Lu Thu, 17 Oct 2013 22:03:42 +0800 + +pdf2htmlex (0.10-1~git201310171220rc344e-0ubuntu1) raring; urgency=low + + * Fix build + + -- WANG Lu Thu, 17 Oct 2013 12:20:59 +0800 + +pdf2htmlex (0.10-1~git201310171209rdc970-0ubuntu1) raring; urgency=low + + * v0.10 released, see Changelog + + -- WANG Lu Thu, 17 Oct 2013 12:09:01 +0800 + +pdf2htmlex (0.9-1~git201309161133rd60eb-0ubuntu1) raring; urgency=low + + * fix cmake test for packaging + + -- WANG Lu Mon, 16 Sep 2013 11:33:11 +0800 + +pdf2htmlex (0.9-1~git201309161021rf2993-0ubuntu1) raring; urgency=low + + * v0.9 released, see Changelog + + -- WANG Lu Mon, 16 Sep 2013 10:21:05 +0800 + +pdf2htmlex (0.9-1~git201305291247rf655a-0ubuntu1) raring; urgency=low + + * Regular upload + + -- WANG Lu Wed, 29 May 2013 12:47:16 +0800 + +pdf2htmlex (0.8-1~git201305051429r92eab-0ubuntu1) raring; urgency=low + + * v0.8 released, see Changelog + + -- WANG Lu Sun, 05 May 2013 14:29:07 +0800 + +pdf2htmlex (0.8-1~git201304281550rd5f9c-0ubuntu1) raring; urgency=low + + * Test packaging for multiple distributions + * Fix crashing with --split-pages + + -- WANG Lu Sun, 28 Apr 2013 15:39:34 +0800 + +pdf2htmlex (0.8-1~git201304151420r1da9b-0ubuntu1) quantal; urgency=low + + * HTML optimization + * New options: --optimize-text, --fallabck + * See more in Changelog + + -- WANG Lu Mon, 15 Apr 2013 14:20:22 +0800 + +pdf2htmlex (0.8-1~git201303011406r3bc73-0ubuntu1) quantal; urgency=low + + * Experimental printing support + * New version + + -- WANG Lu Fri, 01 Mar 2013 14:06:42 +0800 + +pdf2htmlex (0.7-1~git201302282259r3bc73-0ubuntu1) quantal; urgency=low + + * suggests ttfautohint + + -- WANG Lu Thu, 28 Feb 2013 22:59:45 +0800 + +pdf2htmlex (0.7-1~git201302271054r3bc73-0ubuntu1) precise; urgency=low + + * Packaging for 12.04 + + -- WANG Lu Wed, 27 Feb 2013 10:54:12 +0800 + +pdf2htmlex (0.7-1~git201302271053r3bc73-0ubuntu1) quantal; urgency=low + + * Fix packpage dependency + + -- WANG Lu Wed, 27 Feb 2013 10:52:17 +0800 + +pdf2htmlex (0.7-1~git201302270111r3bc73-0ubuntu1) quantal; urgency=low + + * Regular upload + + -- WANG Lu Wed, 27 Feb 2013 01:11:56 +0800 + +pdf2htmlex (0.7-1~git201302182049r3bc73-0ubuntu1) quantal; urgency=low + + * New parameter: process-outline + + -- WANG Lu Mon, 18 Feb 2013 20:49:57 +0800 + +pdf2htmlex (0.7-1~git201301292229r2595c-0ubuntu1) quantal; urgency=low + + * Fixed a CSS issue + + -- WANG Lu Tue, 29 Jan 2013 22:29:21 +0800 + +pdf2htmlex (0.7-1~git201301282229r2595c-0ubuntu1) quantal; urgency=low + + * Process PDF Outline + + -- WANG Lu Mon, 28 Jan 2013 22:29:35 +0800 + +pdf2htmlex (0.7-1~git201301261427r2595c-0ubuntu1) quantal; urgency=low + + * New version, see Changelog for changelog + + -- WANG Lu Sat, 26 Jan 2013 14:27:18 +0800 + +pdf2htmlex (0.6-1~git201212182148rd76af-0ubuntu1) quantal; urgency=low + + * fix dependency of poppler for quantal + + -- WANG Lu Tue, 18 Dec 2012 21:48:35 +0800 + +pdf2htmlex (0.6-1~git201212111844rd76af-0ubuntu1) quantal; urgency=low + + * Package for quantal + + -- WANG Lu Tue, 11 Dec 2012 18:44:44 +0800 + +pdf2htmlex (0.6-1~git201210070052rcb9a8-0ubuntu1) precise; urgency=low + + * New version + + -- WANG Lu Sun, 07 Oct 2012 00:52:42 +0800 + +pdf2htmlex (0.5-1~git201210051800rbaa37-0ubuntu1) precise; urgency=low + + * Regularly re-packing. + + -- WANG Lu Fri, 05 Oct 2012 18:00:48 +0800 + +pdf2htmlex (0.5-1~git201209270317r6fa14-0ubuntu1) precise; urgency=low + + * Regularly re-packing. + + -- WANG Lu Thu, 27 Sep 2012 03:17:02 +0800 + +pdf2htmlex (0.5-1~git201209261622r170a0-0ubuntu1) precise; urgency=low + + * new version + + -- WANG Lu Wed, 26 Sep 2012 16:22:50 +0800 + +pdf2htmlex (0.4-1~git201209241628r30aee-0ubuntu1) precise; urgency=low + + * Regularly re-packing. + + -- WANG Lu Mon, 24 Sep 2012 16:28:18 +0800 + +pdf2htmlex (0.4-1~git201209170124r8b4ec-0ubuntu1) precise; urgency=low + + * Regularly re-packing. + + -- WANG Lu Mon, 17 Sep 2012 01:24:29 +0800 + +pdf2htmlex (0.4-1~git201209162328r8b4ec-0ubuntu1) precise; urgency=low + + * Regularly re-packing. + + -- WANG Lu Sun, 16 Sep 2012 23:28:03 +0800 + +pdf2htmlex (0.3-1~git201209152353rf02e1-0ubuntu1) precise; urgency=low + + * Regularly re-packing. + + -- WANG Lu Sat, 15 Sep 2012 23:53:43 +0800 + +pdf2htmlex (0.3-1~git201209071504ra0de6-0ubuntu1) precise; urgency=low + + * fix build + * 0.3 comes with more bug fixed + + -- WANG Lu Fri, 07 Sep 2012 15:04:09 +0800 + +pdf2htmlex (0.2-3~git201209052329rbc256-0ubuntu1) precise; urgency=low + + * Change dependency of fontforge + + -- WANG Lu Wed, 05 Sep 2012 23:29:49 +0800 + +pdf2htmlex (0.2-3~git201209030158r926cf-0ubuntu1) precise; urgency=low + + * Fix dependency of libpoppler27 + + -- WANG Lu Mon, 03 Sep 2012 01:58:42 +0800 + +pdf2htmlex (0.2-3~git201209010002rfe7b3-0ubuntu1) precise; urgency=low + + * update license + + -- WANG Lu Sat, 01 Sep 2012 00:02:23 +0800 + +pdf2htmlex (0.2-3~git201208312351rd12b8-0ubuntu1) precise; urgency=low + + * 0.2dev, many bugs fixed + + -- WANG Lu Fri, 31 Aug 2012 23:51:57 +0800 + +pdf2htmlex (0.1-3~git201208281638r1addb-0ubuntu1) precise; urgency=low + + * Add debian files + + -- WANG Lu Tue, 28 Aug 2012 16:38:19 +0800 + +pdf2htmlex (0.1-3~git201208281523r80dc3-0ubuntu1) precise; urgency=low + + * Add dependency libpng + + -- WANG Lu Tue, 28 Aug 2012 15:22:22 +0800 + +pdf2htmlex (0.1-3~git201208281431r383b1-0ubuntu1) precise; urgency=low + + * Updated CMakeList.txt + + -- WANG Lu Tue, 28 Aug 2012 14:29:43 +0800 + +pdf2htmlex (0.1-3~git201208281420rc53d7-0ubuntu1) precise; urgency=low + + * Added config.h.in + + -- WANG Lu Tue, 28 Aug 2012 14:06:22 +0800 + +pdf2htmlex (0.1-3~git201208281356r5731e-0ubuntu1) precise; urgency=low + + * Fix version for package + + -- WANG Lu Tue, 28 Aug 2012 13:46:09 +0800 + +pdf2htmlex (0.1-1~git20120828rf083f-0ubuntu1) precise; urgency=low + + * Initial release. + + -- WANG Lu Tue, 28 Aug 2012 01:26:33 +0800 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..673bc9a --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: pdf2htmlex +Section: universe/web +Priority: extra +Maintainer: Trent Petersen +Build-Depends: cmake (>= 2.6.0), pkg-config, debhelper (>= 10), libpoppler-dev (>= 0.20.3), libpng-dev, libjpeg-dev, libfontforge-dev, libspiro-dev, python-dev, openjdk-8-jre-headless +Standards-Version: 3.9.3 +Homepage: http://github.com/pdf2htmlEX/pdf2htmlEX + +Package: pdf2htmlex +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Suggests: ttfautohint +Description: Converts PDF to HTML without losing format + pdf2htmlEX converts PDF to HTML while retaining text, format & style as much as possible diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..836b598 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,23 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: pdf2htmlEX +Upstream-Contact: WANG Lu . +Source: http://github.com/pdf2htmlEX/pdf2htmlEX + +Files: * +Copyright: 2012 WANG Lu +License: GPL-3+ + +License: GPL-3 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..e772481 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/debian/pdf2htmlex.NEWS b/debian/pdf2htmlex.NEWS new file mode 100644 index 0000000..e69de29 diff --git a/debian/pdf2htmlex.README b/debian/pdf2htmlex.README new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/pdf2htmlex.README @@ -0,0 +1 @@ +README.md diff --git a/debian/pdf2htmlex.TODO b/debian/pdf2htmlex.TODO new file mode 100644 index 0000000..e69de29 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..26ba418 --- /dev/null +++ b/debian/rules @@ -0,0 +1,14 @@ +#!/usr/bin/make -f +%: + dh $@ + +override_dh_auto_test: + dh_auto_test || true + +# The following override is required when creating a Debian package +# associated with a version of poppler which has NO debian package (ie when +# poppler has been compiled and installed from source). +# +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..c3d9f24 --- /dev/null +++ b/debian/source/format @@ -0,0 +1,2 @@ +3.0 (quilt) + From 30ffdeeea4297ba2703ebc5868c5f9d43714cbd6 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 31 May 2020 15:18:57 +0000 Subject: [PATCH 177/269] initial work on packaging debian old script too complex and does not work with new build system --- buildScripts/createDebianPackage | 64 +++++++++++++++++++++----------- buildScripts/getBuildToolsApt | 3 ++ debian/changelog | 6 +++ debian/control | 2 +- 4 files changed, 53 insertions(+), 22 deletions(-) diff --git a/buildScripts/createDebianPackage b/buildScripts/createDebianPackage index a100f6b..7f5054c 100755 --- a/buildScripts/createDebianPackage +++ b/buildScripts/createDebianPackage @@ -12,6 +12,25 @@ modified for general git repo 2013.05.30 """ +# CONSIDER PORTING to either BASH or PERL (as used by dpkg-buldpackage) +# CONSIDER BINARY ONLY PACKAGE based on appDir or docerDir +# +# See: https://blog.serverdensity.com/how-to-create-a-debian-deb-package/ +# See: http://www.sj-vs.net/creating-a-simple-debian-deb-package-based-on-a-directory-structure/ +# See: https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually +# See: https://askubuntu.com/questions/1130558/how-to-build-deb-package-for-ubuntu-18-04 +# See: https://blog.knoldus.com/create-a-debian-package-using-dpkg-deb-tool/ +# See: http://www.tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/ +# See: https://coderwall.com/p/urkybq/how-to-create-debian-package-from-source +# +# NOTES: +# 1. Should use something to force update of changelog +# 2. How best to compute dpkg version +# 3. Distribute only binary package (no source package -- link to main github repo) +# 4. Use ppa: https://launchpad.net/~pdf2htmlex/+archive/ubuntu/pdf2htmlex +# 5. Rename poppler-data destination to poppler-pdf2htmlEX +# 6. Ensure source code location of poppler-data has been updated + import os import sys import re @@ -21,28 +40,31 @@ package='pdf2htmlex' ppa_name='ppa:pdf2htmlex/pdf2htmlex' supported_distributions=('disco',) dist_pattern=re.compile('|'.join(['\\) '+i for i in supported_distributions])) -archive_cmd='(rm CMakeCache.txt || true) && cmake . && make dist' +archive_cmd='cd pdf2htmlEX/build && (rm CMakeCache.txt || true) && cmake .. && make dist' archive_suffix='.tar.bz2' -if os.path.exists('../build-area'): - sys.stdout.write('Build area already exists, delete to continue?(y/n)') - sys.stdout.flush() - ans = raw_input().lower() - while ans not in ['y', 'n']: - sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') - ans = raw_input().lower() - - if ans == 'n': - print 'Skipped.' - sys.exit(0) - - if os.system('rm -rf ../build-area') != 0: - print 'Failed to clean up old build directory' - sys.exit(-1) +#if os.path.exists('imageBuild/debianDir'): +# sys.stdout.write('Build area already exists, delete to continue?(y/n)') +# sys.stdout.flush() +# ans = raw_input().lower() +# while ans not in ['y', 'n']: +# sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') +# ans = raw_input().lower() +# +# if ans == 'n': +# print 'Skipped.' +# sys.exit(0) +# +if os.system('rm -rf imageBuild/debianDir') != 0: + print 'Failed to clean up old build directory' + sys.exit(-1) print 'Generating version...' try: - version = re.findall(r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', open('CMakeLists.txt').read())[0] + version = re.findall( + r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', + open('pdf2htmlEX/CMakeLists.txt').read() + )[0] except: print 'Cannot get package name and version number' sys.exit(-1) @@ -90,16 +112,16 @@ if os.system(archive_cmd) != 0: sys.exit(-1) orig_tar_filename = package+'-'+version+archive_suffix -os.mkdir('../build-area') -if os.system('test -e %s && cp %s ../build-area/' % (orig_tar_filename, orig_tar_filename)) != 0: +os.mkdir('imageBuild/debianDir') +if os.system('test -e pdf2htmlEX/build/%s && cp pdf2htmlEX/build/%s imageBuild/debianDir/' % (orig_tar_filename, orig_tar_filename)) != 0: print 'Cannot copy tarball file to build area' sys.exit(-1) deb_orig_tar_filename = package+'_'+deb_version+'.orig'+archive_suffix try: - os.chdir('../build-area') + os.chdir('imageBuild/debianDir') except: - print 'Cannot find ../build-area' + print 'Cannot find imageBuild/debianDir' sys.exit(-1) # remove old dir diff --git a/buildScripts/getBuildToolsApt b/buildScripts/getBuildToolsApt index 97acf12..9ed4d38 100755 --- a/buildScripts/getBuildToolsApt +++ b/buildScripts/getBuildToolsApt @@ -24,6 +24,9 @@ sudo apt-get $UNATTENDED install \ make \ gcc \ g++ \ + build-essential \ + dpkg-dev \ + devscripts \ gettext \ openjdk-8-jre-headless \ jq \ diff --git a/debian/changelog b/debian/changelog index 4601bfc..b77562a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +pdf2htmlex (0.18.7-1~git20200531r3fcd0-0ubuntu1) UNRELEASED; urgency=medium + + * test packaging + + -- Stephen Gaito Sun, 31 May 2020 13:38:59 +0000 + pdf2htmlex (0.18.7-1~git20190927rb69b8-0ubuntu1) disco; urgency=low * Package for poppler-0.81.0 diff --git a/debian/control b/debian/control index 673bc9a..7c0a227 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: pdf2htmlex Section: universe/web Priority: extra Maintainer: Trent Petersen -Build-Depends: cmake (>= 2.6.0), pkg-config, debhelper (>= 10), libpoppler-dev (>= 0.20.3), libpng-dev, libjpeg-dev, libfontforge-dev, libspiro-dev, python-dev, openjdk-8-jre-headless +Build-Depends: cmake (>= 2.6.0), pkg-config, debhelper (>= 10), libpng-dev, libjpeg-dev, openjdk-8-jre-headless Standards-Version: 3.9.3 Homepage: http://github.com/pdf2htmlEX/pdf2htmlEX From 1b7bab3e2d2f96437ab340ec1ccbf6882a5fc7ba Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Sun, 31 May 2020 18:34:48 +0000 Subject: [PATCH 178/269] begun rearranging poppler-data-dir --- buildScripts/createAppImage | 5 ++++- buildScripts/createDockerImage | 5 ++++- buildScripts/installPdf2htmlEX | 9 +++++++++ pdf2htmlEX/src/pdf2htmlEX.cc | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index e9fd107..90ff685 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -27,7 +27,10 @@ make install DESTDIR=../../imageBuild/appDir cd ../../poppler-data -make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/appDir +make install \ + prefix=$PDF2HTMLEX_PREFIX \ + datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \ + DESTDIR=../imageBuild/appDir cd ../imageBuild diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index c33f74d..5fddea5 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -25,7 +25,10 @@ make install DESTDIR=../../imageBuild/dockerDir cd ../../poppler-data -make install prefix=$PDF2HTMLEX_PREFIX DESTDIR=../imageBuild/dockerDir +make install \ + prefix=$PDF2HTMLEX_PREFIX \ + datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \ + DESTDIR=../imageBuild/appDir cd ../imageBuild/dockerDir diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index c3b861e..c2e6021 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -20,3 +20,12 @@ fi cd pdf2htmlEX/build sudo make install + +## NEED to install poppler-data!!! +# +cd ../../poppler-data + +make install \ + prefix=$PDF2HTMLEX_PREFIX \ + datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \ + DESTDIR=../imageBuild/appDir diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index 8d805b2..4ee1633 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -68,6 +68,7 @@ void show_version_and_exit(const char * dummy = nullptr) cerr << " cairo " << cairo_version_string() << endl; #endif cerr << "Default data-dir: " << param.data_dir << endl; + cerr << "Poppler data-dir: " << param.poppler_data_dir << endl; cerr << "Supported image format:"; #ifdef ENABLE_LIBPNG cerr << " png"; @@ -378,7 +379,7 @@ int main(int argc, char **argv) // param.data_dir = string(getenv("APPDIR")) + param.data_dir; } - + param.poppler_data_dir = param.data_dir + "/poppler" parse_options(argc, argv); check_param(); From a73211fb9b4a932950627195d2ace0fd8a63467c Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 1 Jun 2020 07:49:30 +0000 Subject: [PATCH 179/269] provisional commit of scripts to build debian package --- archive/createDebianPackage | 178 +++++++++++++++++++++++ buildScripts/createDebianPackage | 242 ++++++++++--------------------- buildScripts/createDockerImage | 2 +- buildScripts/getBuildToolsApt | 4 +- buildScripts/getDevLibrariesApt | 7 - buildScripts/installPdf2htmlEX | 3 +- pdf2htmlEX/src/pdf2htmlEX.cc | 2 +- 7 files changed, 260 insertions(+), 178 deletions(-) create mode 100755 archive/createDebianPackage diff --git a/archive/createDebianPackage b/archive/createDebianPackage new file mode 100755 index 0000000..7f5054c --- /dev/null +++ b/archive/createDebianPackage @@ -0,0 +1,178 @@ +#!/usr/bin/env python + +""" +Dirty script for building package for PPA +by WangLu +2011.01.13 + +modified for pdf2htmlEX +2012.08.28 + +modified for general git repo +2013.05.30 +""" + +# CONSIDER PORTING to either BASH or PERL (as used by dpkg-buldpackage) +# CONSIDER BINARY ONLY PACKAGE based on appDir or docerDir +# +# See: https://blog.serverdensity.com/how-to-create-a-debian-deb-package/ +# See: http://www.sj-vs.net/creating-a-simple-debian-deb-package-based-on-a-directory-structure/ +# See: https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually +# See: https://askubuntu.com/questions/1130558/how-to-build-deb-package-for-ubuntu-18-04 +# See: https://blog.knoldus.com/create-a-debian-package-using-dpkg-deb-tool/ +# See: http://www.tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/ +# See: https://coderwall.com/p/urkybq/how-to-create-debian-package-from-source +# +# NOTES: +# 1. Should use something to force update of changelog +# 2. How best to compute dpkg version +# 3. Distribute only binary package (no source package -- link to main github repo) +# 4. Use ppa: https://launchpad.net/~pdf2htmlex/+archive/ubuntu/pdf2htmlex +# 5. Rename poppler-data destination to poppler-pdf2htmlEX +# 6. Ensure source code location of poppler-data has been updated + +import os +import sys +import re +import time + +package='pdf2htmlex' +ppa_name='ppa:pdf2htmlex/pdf2htmlex' +supported_distributions=('disco',) +dist_pattern=re.compile('|'.join(['\\) '+i for i in supported_distributions])) +archive_cmd='cd pdf2htmlEX/build && (rm CMakeCache.txt || true) && cmake .. && make dist' +archive_suffix='.tar.bz2' + +#if os.path.exists('imageBuild/debianDir'): +# sys.stdout.write('Build area already exists, delete to continue?(y/n)') +# sys.stdout.flush() +# ans = raw_input().lower() +# while ans not in ['y', 'n']: +# sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') +# ans = raw_input().lower() +# +# if ans == 'n': +# print 'Skipped.' +# sys.exit(0) +# +if os.system('rm -rf imageBuild/debianDir') != 0: + print 'Failed to clean up old build directory' + sys.exit(-1) + +print 'Generating version...' +try: + version = re.findall( + r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', + open('pdf2htmlEX/CMakeLists.txt').read() + )[0] +except: + print 'Cannot get package name and version number' + sys.exit(-1) + +try: + rev = open('.git/refs/heads/master').read()[:5] +except: + print 'Cannot get revision number' + sys.exit(-1) + +projectdir=os.getcwd() +today_timestr = time.strftime('%Y%m%d') +deb_version = version+'-1~git'+today_timestr+'r'+rev +full_deb_version = deb_version+'-0ubuntu1' + +print 'Version: %s' % (version,) +print 'Full Version: %s' % (full_deb_version,) + +#check if we need to update debian/changelog +with open('debian/changelog') as f: + if re.findall(r'\(([^)]+)\)', f.readline())[0] == full_deb_version: + print + print 'No need to update debian/changelog, skipping' + else: + print + print 'Writing debian/changelog' + if os.system('dch -v "%s"' % (full_deb_version,)) != 0: + print 'Failed when updating debian/changelog' + sys.exit(-1) + +# changelog may have been updated, reopen it +with open('debian/changelog') as f: + #check dist mark of changelog + changelog = f.read() + m = dist_pattern.search(changelog) + if m is None or m.pos >= changelog.find('\n'): + print 'Cannot locate the dist name in the first line of changelog' + sys.exit(-1) + +print +print 'Preparing build ...' +# handling files +if os.system(archive_cmd) != 0: + print 'Failed in creating tarball' + sys.exit(-1) + +orig_tar_filename = package+'-'+version+archive_suffix +os.mkdir('imageBuild/debianDir') +if os.system('test -e pdf2htmlEX/build/%s && cp pdf2htmlEX/build/%s imageBuild/debianDir/' % (orig_tar_filename, orig_tar_filename)) != 0: + print 'Cannot copy tarball file to build area' + sys.exit(-1) + +deb_orig_tar_filename = package+'_'+deb_version+'.orig'+archive_suffix +try: + os.chdir('imageBuild/debianDir') +except: + print 'Cannot find imageBuild/debianDir' + sys.exit(-1) + +# remove old dir +os.system('rm -rf %s' % (package+'-'+version,)) + +if os.system('mv %s %s && tar -xvf %s' % (orig_tar_filename, deb_orig_tar_filename, deb_orig_tar_filename)) != 0: + print 'Cannot extract tarball' + sys.exit(-1) + +try: + os.chdir(package+'-'+version) +except: + print 'Cannot enter project dir' + sys.exit(-1) + +os.system('cp -r %s/debian .' % (projectdir,)) + +for cur_dist in supported_distributions: + print + print 'Building for ' + cur_dist + ' ...' + # substitute distribution name + with open('debian/changelog', 'w') as f: + f.write(dist_pattern.sub('~%s1) %s' % (cur_dist, cur_dist), changelog, 1)) + +# No PPA Orginization set up, only building dpkg +# # building for ppa +# if os.system('debuild -S -sa') != 0: +# print 'Failed in debuild' +# sys.exit(-1) +# +# print +# sys.stdout.write('Everything seems to be good so far, upload?(y/n)') +# sys.stdout.flush() +# ans = raw_input().lower() +# while ans not in ['y', 'n']: +# sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') +# ans = raw_input().lower() +# +# if ans == 'n': +# print 'Skipped.' +# sys.exit(0) +# +# print 'Uploading' +# if os.system('dput %s ../%s' % (ppa_name, package+'_'+full_deb_version+'~'+cur_dist+'1_source.changes')) != 0: +# print 'Failed in uploading by dput' +# sys.exit(-1) + + # building for dpkg + if os.system('dpkg-buildpackage -b --no-sign') != 0: + print 'Failed in dpkg-buildpackage' + sys.exit(-1) + +print 'Build area not cleaned.' +print 'All done. Cool!' diff --git a/buildScripts/createDebianPackage b/buildScripts/createDebianPackage index 7f5054c..18a30dd 100755 --- a/buildScripts/createDebianPackage +++ b/buildScripts/createDebianPackage @@ -1,178 +1,92 @@ -#!/usr/bin/env python +#!/bin/bash -""" -Dirty script for building package for PPA -by WangLu -2011.01.13 +# This bash script creates a (binary) Debian Package Archive for pdf2htmlEX -modified for pdf2htmlEX -2012.08.28 +source ./buildScripts/reSourceVersionEnvs -modified for general git repo -2013.05.30 -""" +echo "" +echo "-------------------------------------------------------------------" +echo "CREATING pdf2htmlEX (binary) Debian package" +echo "-------------------------------------------------------------------" +echo "" -# CONSIDER PORTING to either BASH or PERL (as used by dpkg-buldpackage) -# CONSIDER BINARY ONLY PACKAGE based on appDir or docerDir +export DPKG_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH-$(lsb_release -cs).deb" + +echo "export DPKG_NAME=\"$DPKG_NAME\"" >> buildScripts/reSourceVersionEnvs + +# Adapted from: https://blog.serverdensity.com/how-to-create-a-debian-deb-package/ +# and: http://www.sj-vs.net/creating-a-simple-debian-deb-package-based-on-a-directory-structure/ + +DEBDIR=imageBuild/debianDir +DOCDIR=$DEBDIR/usr/local/share/doc/pdf2htmlEX + +sudo rm -rf $DEBDIR +mkdir -p $DOCDIR + +# Install pdf2htmlEX # -# See: https://blog.serverdensity.com/how-to-create-a-debian-deb-package/ -# See: http://www.sj-vs.net/creating-a-simple-debian-deb-package-based-on-a-directory-structure/ -# See: https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually -# See: https://askubuntu.com/questions/1130558/how-to-build-deb-package-for-ubuntu-18-04 -# See: https://blog.knoldus.com/create-a-debian-package-using-dpkg-deb-tool/ -# See: http://www.tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/ -# See: https://coderwall.com/p/urkybq/how-to-create-debian-package-from-source +cd pdf2htmlEX/build # -# NOTES: -# 1. Should use something to force update of changelog -# 2. How best to compute dpkg version -# 3. Distribute only binary package (no source package -- link to main github repo) -# 4. Use ppa: https://launchpad.net/~pdf2htmlex/+archive/ubuntu/pdf2htmlex -# 5. Rename poppler-data destination to poppler-pdf2htmlEX -# 6. Ensure source code location of poppler-data has been updated +make install DESTDIR=../../$DEBDIR -import os -import sys -import re -import time - -package='pdf2htmlex' -ppa_name='ppa:pdf2htmlex/pdf2htmlex' -supported_distributions=('disco',) -dist_pattern=re.compile('|'.join(['\\) '+i for i in supported_distributions])) -archive_cmd='cd pdf2htmlEX/build && (rm CMakeCache.txt || true) && cmake .. && make dist' -archive_suffix='.tar.bz2' - -#if os.path.exists('imageBuild/debianDir'): -# sys.stdout.write('Build area already exists, delete to continue?(y/n)') -# sys.stdout.flush() -# ans = raw_input().lower() -# while ans not in ['y', 'n']: -# sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') -# ans = raw_input().lower() +# Install a copy of poppler-data for pdf2htmlEX's exclusive use # -# if ans == 'n': -# print 'Skipped.' -# sys.exit(0) +cd ../../poppler-data # -if os.system('rm -rf imageBuild/debianDir') != 0: - print 'Failed to clean up old build directory' - sys.exit(-1) +make install \ + prefix=$PDF2HTMLEX_PREFIX \ + datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \ + DESTDIR=../$DEBDIR -print 'Generating version...' -try: - version = re.findall( - r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', - open('pdf2htmlEX/CMakeLists.txt').read() - )[0] -except: - print 'Cannot get package name and version number' - sys.exit(-1) +cd .. -try: - rev = open('.git/refs/heads/master').read()[:5] -except: - print 'Cannot get revision number' - sys.exit(-1) - -projectdir=os.getcwd() -today_timestr = time.strftime('%Y%m%d') -deb_version = version+'-1~git'+today_timestr+'r'+rev -full_deb_version = deb_version+'-0ubuntu1' - -print 'Version: %s' % (version,) -print 'Full Version: %s' % (full_deb_version,) - -#check if we need to update debian/changelog -with open('debian/changelog') as f: - if re.findall(r'\(([^)]+)\)', f.readline())[0] == full_deb_version: - print - print 'No need to update debian/changelog, skipping' - else: - print - print 'Writing debian/changelog' - if os.system('dch -v "%s"' % (full_deb_version,)) != 0: - print 'Failed when updating debian/changelog' - sys.exit(-1) - -# changelog may have been updated, reopen it -with open('debian/changelog') as f: - #check dist mark of changelog - changelog = f.read() - m = dist_pattern.search(changelog) - if m is None or m.pos >= changelog.find('\n'): - print 'Cannot locate the dist name in the first line of changelog' - sys.exit(-1) - -print -print 'Preparing build ...' -# handling files -if os.system(archive_cmd) != 0: - print 'Failed in creating tarball' - sys.exit(-1) - -orig_tar_filename = package+'-'+version+archive_suffix -os.mkdir('imageBuild/debianDir') -if os.system('test -e pdf2htmlEX/build/%s && cp pdf2htmlEX/build/%s imageBuild/debianDir/' % (orig_tar_filename, orig_tar_filename)) != 0: - print 'Cannot copy tarball file to build area' - sys.exit(-1) - -deb_orig_tar_filename = package+'_'+deb_version+'.orig'+archive_suffix -try: - os.chdir('imageBuild/debianDir') -except: - print 'Cannot find imageBuild/debianDir' - sys.exit(-1) - -# remove old dir -os.system('rm -rf %s' % (package+'-'+version,)) - -if os.system('mv %s %s && tar -xvf %s' % (orig_tar_filename, deb_orig_tar_filename, deb_orig_tar_filename)) != 0: - print 'Cannot extract tarball' - sys.exit(-1) - -try: - os.chdir(package+'-'+version) -except: - print 'Cannot enter project dir' - sys.exit(-1) - -os.system('cp -r %s/debian .' % (projectdir,)) - -for cur_dist in supported_distributions: - print - print 'Building for ' + cur_dist + ' ...' - # substitute distribution name - with open('debian/changelog', 'w') as f: - f.write(dist_pattern.sub('~%s1) %s' % (cur_dist, cur_dist), changelog, 1)) - -# No PPA Orginization set up, only building dpkg -# # building for ppa -# if os.system('debuild -S -sa') != 0: -# print 'Failed in debuild' -# sys.exit(-1) +# Create a 'useful' changelog # -# print -# sys.stdout.write('Everything seems to be good so far, upload?(y/n)') -# sys.stdout.flush() -# ans = raw_input().lower() -# while ans not in ['y', 'n']: -# sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') -# ans = raw_input().lower() -# -# if ans == 'n': -# print 'Skipped.' -# sys.exit(0) -# -# print 'Uploading' -# if os.system('dput %s ../%s' % (ppa_name, package+'_'+full_deb_version+'~'+cur_dist+'1_source.changes')) != 0: -# print 'Failed in uploading by dput' -# sys.exit(-1) +git log --format="%cd %h %d %n %s%n" --date=short > $DOCDIR/gitLog - # building for dpkg - if os.system('dpkg-buildpackage -b --no-sign') != 0: - print 'Failed in dpkg-buildpackage' - sys.exit(-1) +######################################## +# setup the DEBIAN package files -print 'Build area not cleaned.' -print 'All done. Cool!' +controlFile=$DEBDIR/DEBIAN/control +conffilesFile=$DEBDIR/DEBIAN/conffiles +md5sumsFile=$DEBDIR/DEBIAN/md5sums + +mkdir -p $DEBDIR/DEBIAN + +# Create the md5sums file +# +find $DEBDIR -type f | xargs md5sum > $md5sumsFile + +# Accumulate the control file information +# +versionValue=$(git describe --abbrev=0) +releaseValue=$(lsb_release -cs) +architectureValue=$(dpkg-architecture -q DEB_BUILD_ARCH_CPU) +maintainerValue="$(git config --get user.name) <$(git config --get user.email)>" + +# Now create the control file +# +echo "Package: pdf2htmlEX" > $controlFile +echo "Version: 0:0.$versionValue-0" >> $controlFile +echo "Distribution: $releaseValue" >> $controlFile +echo "Architecture: $architectureValue" >> $controlFile +echo "Section: universe/web" >> $controlFile +echo "Priority: optional" >> $controlFile +echo "Essential: no" >> $controlFile +echo "Depends: libcairo2, libpng16-16, libjpeg-turbo8, libxml2" >> $controlFile +echo "Maintainer: $maintainerValue" >> $controlFile +echo "Homepage: http://github.com/pdf2htmlEX/pdf2htmlEX" >> $controlFile +echo "Description: Converts PDF to HTML without losing format" >> $controlFile +echo " pdf2htmlEX converts PDF to HTML while retaining text, format & style as much as possible" >> $controlFile + +# Create the (empty) conffiles +# +touch $conffilesFile + +# Finally create the debian archive +# +cd imageBuild +# +sudo chown -R root:root debianDir +# +dpkg --build debianDir $DPKG_NAME diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 5fddea5..06591da 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -28,7 +28,7 @@ cd ../../poppler-data make install \ prefix=$PDF2HTMLEX_PREFIX \ datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \ - DESTDIR=../imageBuild/appDir + DESTDIR=../imageBuild/dockerDir cd ../imageBuild/dockerDir diff --git a/buildScripts/getBuildToolsApt b/buildScripts/getBuildToolsApt index 9ed4d38..6d14b84 100755 --- a/buildScripts/getBuildToolsApt +++ b/buildScripts/getBuildToolsApt @@ -24,9 +24,7 @@ sudo apt-get $UNATTENDED install \ make \ gcc \ g++ \ - build-essential \ - dpkg-dev \ - devscripts \ + dpkg \ gettext \ openjdk-8-jre-headless \ jq \ diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibrariesApt index 3041050..91385cd 100755 --- a/buildScripts/getDevLibrariesApt +++ b/buildScripts/getDevLibrariesApt @@ -19,10 +19,3 @@ sudo apt-get $UNATTENDED install \ libpng-dev \ libjpeg-dev \ libxml2-dev \ - -# libspiro-dev \ -# libpango1.0-dev \ -# liblcms2-dev \ -# libuninameslist-dev \ -# python3-dev - diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index c2e6021..102f168 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -27,5 +27,4 @@ cd ../../poppler-data make install \ prefix=$PDF2HTMLEX_PREFIX \ - datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \ - DESTDIR=../imageBuild/appDir + datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX diff --git a/pdf2htmlEX/src/pdf2htmlEX.cc b/pdf2htmlEX/src/pdf2htmlEX.cc index 4ee1633..7197e51 100644 --- a/pdf2htmlEX/src/pdf2htmlEX.cc +++ b/pdf2htmlEX/src/pdf2htmlEX.cc @@ -379,7 +379,7 @@ int main(int argc, char **argv) // param.data_dir = string(getenv("APPDIR")) + param.data_dir; } - param.poppler_data_dir = param.data_dir + "/poppler" + param.poppler_data_dir = param.data_dir + "/poppler"; parse_options(argc, argv); check_param(); From 82aeeac8c76e268c5f54c8a464ab8ad3bbe7fbaf Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 1 Jun 2020 11:28:38 +0100 Subject: [PATCH 180/269] corrected debian dependencies for lack of libglib-2.0 --- buildScripts/createDebianPackage | 22 +++++++++++----------- pdf2htmlEX/CMakeLists.txt | 6 ------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/buildScripts/createDebianPackage b/buildScripts/createDebianPackage index 18a30dd..000554c 100755 --- a/buildScripts/createDebianPackage +++ b/buildScripts/createDebianPackage @@ -66,17 +66,17 @@ maintainerValue="$(git config --get user.name) <$(git config --get user.email)>" # Now create the control file # -echo "Package: pdf2htmlEX" > $controlFile -echo "Version: 0:0.$versionValue-0" >> $controlFile -echo "Distribution: $releaseValue" >> $controlFile -echo "Architecture: $architectureValue" >> $controlFile -echo "Section: universe/web" >> $controlFile -echo "Priority: optional" >> $controlFile -echo "Essential: no" >> $controlFile -echo "Depends: libcairo2, libpng16-16, libjpeg-turbo8, libxml2" >> $controlFile -echo "Maintainer: $maintainerValue" >> $controlFile -echo "Homepage: http://github.com/pdf2htmlEX/pdf2htmlEX" >> $controlFile -echo "Description: Converts PDF to HTML without losing format" >> $controlFile +echo "Package: pdf2htmlEX" > $controlFile +echo "Version: 0:0.$versionValue-0" >> $controlFile +echo "Distribution: $releaseValue" >> $controlFile +echo "Architecture: $architectureValue" >> $controlFile +echo "Section: universe/web" >> $controlFile +echo "Priority: optional" >> $controlFile +echo "Essential: no" >> $controlFile +echo "Depends: libglib2.0-0, libcairo2, libpng16-16, libjpeg-turbo8, libxml2" >> $controlFile +echo "Maintainer: $maintainerValue" >> $controlFile +echo "Homepage: http://github.com/pdf2htmlEX/pdf2htmlEX" >> $controlFile +echo "Description: Converts PDF to HTML without losing format" >> $controlFile echo " pdf2htmlEX converts PDF to HTML while retaining text, format & style as much as possible" >> $controlFile # Create the (empty) conffiles diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 6bc37b1..29b52fd 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -91,12 +91,6 @@ set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} -lgio-2.0 ) -# -llcms2 -# -lz -# -llcms2 -# -lspiro -# -luninameslist - # debug build flags (overwrite default cmake debug flags) set(CMAKE_C_FLAGS_DEBUG "-ggdb -pg") set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -pg") From ed2f9db9cb28b0bd47ee39ae2318dc2a61f3d710 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 1 Jun 2020 11:06:06 +0000 Subject: [PATCH 181/269] added createDebianPackage into createImages added Licenses corrected install of poppler-data --- buildScripts/createDebianPackage | 8 +++++++- buildScripts/createImages | 8 +++++--- buildScripts/installPdf2htmlEX | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/buildScripts/createDebianPackage b/buildScripts/createDebianPackage index 000554c..13546d3 100755 --- a/buildScripts/createDebianPackage +++ b/buildScripts/createDebianPackage @@ -44,6 +44,12 @@ cd .. # git log --format="%cd %h %d %n %s%n" --date=short > $DOCDIR/gitLog +# Ensure the license and readme details are embedded in the debian archive +# +cp LICENSE $DOCDIR +cp LICENSE_GPLv3 $DOCDIR +cp README.md $DOCDIR + ######################################## # setup the DEBIAN package files @@ -73,7 +79,7 @@ echo "Architecture: $architectureValue" >> $controlFile echo "Section: universe/web" >> $controlFile echo "Priority: optional" >> $controlFile echo "Essential: no" >> $controlFile -echo "Depends: libglib2.0-0, libcairo2, libpng16-16, libjpeg-turbo8, libxml2" >> $controlFile +echo "Depends: libglib2.0-0, libfreetype6, libfontconfig1, libcairo2, libpng16-16, libjpeg-turbo8, libxml2" >> $controlFile echo "Maintainer: $maintainerValue" >> $controlFile echo "Homepage: http://github.com/pdf2htmlEX/pdf2htmlEX" >> $controlFile echo "Description: Converts PDF to HTML without losing format" >> $controlFile diff --git a/buildScripts/createImages b/buildScripts/createImages index 7b3a205..f67dd3e 100755 --- a/buildScripts/createImages +++ b/buildScripts/createImages @@ -5,10 +5,12 @@ ################# # do the creation -./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } +./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } -./buildScripts/createAppImage || { echo 'createAppImage FAILED' ; exit 1 ; } +./buildScripts/createAppImage || { echo 'createAppImage FAILED' ; exit 1 ; } -./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; } +./buildScripts/createDockerImage || { echo 'createDockerImage FAILED' ; exit 1 ; } + +./buildScripts/createDebianPackage || { echo 'createDebianPackage FAILED' ; exit 1 ; } diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index 102f168..cbe1023 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -25,6 +25,6 @@ sudo make install # cd ../../poppler-data -make install \ +sudo make install \ prefix=$PDF2HTMLEX_PREFIX \ datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX From cf48cf54c1567ac18a76de60bce9b9accd6b960e Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Mon, 1 Jun 2020 16:12:22 +0000 Subject: [PATCH 182/269] removed dependence on lsb_release and ensured dpkg-architecture is installed --- buildScripts/buildInstallLocallyApt | 4 ++-- buildScripts/createDebianPackage | 7 ++++--- buildScripts/getBuildToolsApt | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 7aa5e70..6f023f7 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -10,8 +10,8 @@ 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_BRANCH=<> +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. diff --git a/buildScripts/createDebianPackage b/buildScripts/createDebianPackage index 13546d3..47f72a3 100755 --- a/buildScripts/createDebianPackage +++ b/buildScripts/createDebianPackage @@ -10,7 +10,9 @@ echo "CREATING pdf2htmlEX (binary) Debian package" echo "-------------------------------------------------------------------" echo "" -export DPKG_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH-$(lsb_release -cs).deb" +source /etc/lsb-release + +export DPKG_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH-$DISTRIB_CODENAME.deb" echo "export DPKG_NAME=\"$DPKG_NAME\"" >> buildScripts/reSourceVersionEnvs @@ -66,7 +68,6 @@ find $DEBDIR -type f | xargs md5sum > $md5sumsFile # Accumulate the control file information # versionValue=$(git describe --abbrev=0) -releaseValue=$(lsb_release -cs) architectureValue=$(dpkg-architecture -q DEB_BUILD_ARCH_CPU) maintainerValue="$(git config --get user.name) <$(git config --get user.email)>" @@ -74,7 +75,7 @@ maintainerValue="$(git config --get user.name) <$(git config --get user.email)>" # echo "Package: pdf2htmlEX" > $controlFile echo "Version: 0:0.$versionValue-0" >> $controlFile -echo "Distribution: $releaseValue" >> $controlFile +echo "Distribution: $DISTRIB_CODENAME" >> $controlFile echo "Architecture: $architectureValue" >> $controlFile echo "Section: universe/web" >> $controlFile echo "Priority: optional" >> $controlFile diff --git a/buildScripts/getBuildToolsApt b/buildScripts/getBuildToolsApt index 6d14b84..5295f60 100755 --- a/buildScripts/getBuildToolsApt +++ b/buildScripts/getBuildToolsApt @@ -25,6 +25,7 @@ sudo apt-get $UNATTENDED install \ gcc \ g++ \ dpkg \ + dpkg-dev \ gettext \ openjdk-8-jre-headless \ jq \ From 9a136768015c3a93bf0280e83607766984186a60 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 04:14:34 +0000 Subject: [PATCH 183/269] initial changes to suit linuxBrew --- buildScripts/buildInstallLocallyApt | 4 ++-- buildScripts/buildInstallLocallyBrew | 18 +++++++++++------- buildScripts/getBuildToolsBrew | 24 ++++++++++++------------ buildScripts/getDevLibrariesBrew | 19 ++++++++++--------- pdf2htmlEX/CMakeLists.txt | 20 ++++++++++++-------- 5 files changed, 47 insertions(+), 38 deletions(-) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocallyApt index 7aa5e70..63b7688 100755 --- a/buildScripts/buildInstallLocallyApt +++ b/buildScripts/buildInstallLocallyApt @@ -10,8 +10,8 @@ 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_BRANCH="<>" +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. diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew index 1cb4849..23caa20 100755 --- a/buildScripts/buildInstallLocallyBrew +++ b/buildScripts/buildInstallLocallyBrew @@ -10,14 +10,22 @@ 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_BRANCH="<>" +export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" -export PDF2HTMLEX_PREFIX=toBeDetermined +# 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=/home/linuxbrew/.linuxbrew ################ # do the build +# The following is used by the pdf2htmlEX CMakeLists.txt file +# +export USING_BREW=1 + ./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } ./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } @@ -30,14 +38,10 @@ export PDF2HTMLEX_PREFIX=toBeDetermined ./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/getBuildToolsBrew b/buildScripts/getBuildToolsBrew index 1ee11e1..b32069a 100755 --- a/buildScripts/getBuildToolsBrew +++ b/buildScripts/getBuildToolsBrew @@ -9,16 +9,16 @@ echo "-------------------------------------------------------------------" echo "" brew update -brew install \ - git \ - pkg-config \ - ruby \ - autoconf \ - libtool \ - cmake \ - make \ - gcc \ - gettext \ - openjdk \ - jq \ +brew install \ + git \ + pkg-config \ + ruby \ + autoconf \ + libtool \ + cmake \ + make \ + gcc \ + gettext \ + openjdk \ + jq \ tree diff --git a/buildScripts/getDevLibrariesBrew b/buildScripts/getDevLibrariesBrew index 0938300..6119573 100755 --- a/buildScripts/getDevLibrariesBrew +++ b/buildScripts/getDevLibrariesBrew @@ -10,12 +10,13 @@ echo "-------------------------------------------------------------------" echo "" brew update -brew install \ - cairo \ - libspiro \ - libpng \ - jpeg \ - pango \ - little-cms2 \ - libxml2 \ - libuninameslist \ +brew install \ + cairo \ + libpng \ + jpeg \ + libxml2 \ + +# libspiro \ +# pango \ +# little-cms2 \ +# libuninameslist \ diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt index 6bc37b1..067ec71 100644 --- a/pdf2htmlEX/CMakeLists.txt +++ b/pdf2htmlEX/CMakeLists.txt @@ -39,6 +39,7 @@ set(POPPLER_LIBRARIES ${POPPLER_LIBRARIES} ${CMAKE_SOURCE_DIR}/../poppler/build/libpoppler.a ) + if(ENABLE_SVG) pkg_check_modules(CAIRO REQUIRED cairo>=1.10.0) message("-- Trying to locate cairo-svg...") @@ -46,8 +47,10 @@ if(ENABLE_SVG) if(CAIRO_SVG_INCLUDE_PATH) message("-- found cairo-svg...") include_directories(${CAIRO_INCLUDE_DIRS}) - link_directories(${CAIRO_LIBRARY_DIRS}) - set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${CAIRO_LIBRARIES}) + if(NOT DEFINED ENV{USING_BREW}) + link_directories(${CAIRO_LIBRARY_DIRS}) + set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${CAIRO_LIBRARIES}) + endif() set(ENABLE_SVG 1) else() message(FATAL_ERROR "Error: no SVG support found in Cairo") @@ -56,7 +59,7 @@ if(ENABLE_SVG) find_package(Freetype REQUIRED) include_directories(${FREETYPE_INCLUDE_DIRS}) link_directories(${FREETYPE_LIBRARY_DIRS}) - set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FREETYPE_LIBRARIES}) +# set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FREETYPE_LIBRARIES}) endif() # SINCE we have a very intimate relationship with a particular version of @@ -79,16 +82,17 @@ set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES} set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES} ${FONTFORGE_LIBRARIES} - -lfreetype - -lfontconfig + ${CAIRO_LIBRARIES} -ljpeg -lpng - -lz - -pthread - -lm + -lfontconfig + -lfreetype -lxml2 -lglib-2.0 -lgio-2.0 + -pthread + -lz + -lm ) # -llcms2 From f922bf7b8856dc088dcf3e5716a08b6438efb5ff Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 10:47:40 +0000 Subject: [PATCH 184/269] test travis 1 --- .travis.yml | 95 ++++++------------------ .travis.yml.macos.20200602 | 111 +++++++++++++++++++++++++++++ buildScripts/travisLinuxAptDoItAll | 14 ++-- 3 files changed, 137 insertions(+), 83 deletions(-) create mode 100644 .travis.yml.macos.20200602 diff --git a/.travis.yml b/.travis.yml index fee06ac..8f44dd7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: cpp -sudo: true - # for windows *test* of AppImage # see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job # and https://discourse.appimage.org/t/run-appimage-on-windows/177 @@ -14,85 +12,32 @@ branches: except: # do not build tags that we create using the upload.sh script - /^(?i:continuous.*)$/ -# apt: -# update: true -# packages: -# # build tools -# - git -# - pkg-config -# - ruby -# - autoconf -# - libtool -# - cmake -# - make -# - gcc -# - g++ -# - gettext -# - openjdk-8-jre-headless -# - tree -# # dev libraries -# - libcairo-dev -# - libspiro-dev -# - libpng-dev -# - libjpeg-dev -# - poppler-data -# - libpango1.0-dev -# - liblcms2-dev -# - libxml2-dev -# - libuninameslist-dev -# homebrew: -# packages: -# - pdf2html-new -# - autoconf -# - pkg-config -# - git -# - cmake -# - freetype -# # Poppler-specific packages -# - fontconfig -# - jpeg -# - nss -# # libuninameslist-specific packages -# - automake -# - libtool -# # fontforge-specific packages -# - python -# - glib -# - xml2 -# - libspiro -# - gettext -# # pdf2htmlEX-specific packages -# - cairo -# - pango -# sauce_connect: true - -matrix: - fast_finish: true +#matrix: +# fast_finish: true # allow_failures: # - os: osx # Until the build passes, then re-enable. jobs: + fast_finish: true include: -# - stage: build-linux + - stage: build-linux + os: linux + env: + global: DOCKER_FROM="ubuntu:18.04" + services: + - docker + dist: bionic + script: ./buildScripts/travisLinuxAptDoItAll +# - stage: build-osx # os: -# - linux -# env: -# global: -# - DOCKER_FROM="ubuntu:18.04" -# services: -# - docker -# dist: bionic -# script: ./buildScripts/travisLinuxAptDoItAll - - stage: build-osx - os: - - osx - osx_image: xcode10.1 - addons: - homebrew: - update: true - script: - - ./buildScripts/travisHomeBrewDoItAll - - pdf2htmlEX --version +# - osx +# osx_image: xcode10.1 +# addons: +# homebrew: +# update: true +# script: +# - ./buildScripts/travisHomeBrewDoItAll +# - pdf2htmlEX --version # - stage: test # os: # - linux diff --git a/.travis.yml.macos.20200602 b/.travis.yml.macos.20200602 new file mode 100644 index 0000000..fee06ac --- /dev/null +++ b/.travis.yml.macos.20200602 @@ -0,0 +1,111 @@ +language: cpp + +sudo: true + +# for windows *test* of AppImage +# see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job +# and https://discourse.appimage.org/t/run-appimage-on-windows/177 +# and https://docs.travis-ci.com/user/reference/windows/ +# why fuse is not possible on windows: https://superuser.com/questions/179436/is-it-possible-to-use-fuse-with-windows + +compiler: gcc + +branches: + except: # do not build tags that we create using the upload.sh script + - /^(?i:continuous.*)$/ + +# apt: +# update: true +# packages: +# # build tools +# - git +# - pkg-config +# - ruby +# - autoconf +# - libtool +# - cmake +# - make +# - gcc +# - g++ +# - gettext +# - openjdk-8-jre-headless +# - tree +# # dev libraries +# - libcairo-dev +# - libspiro-dev +# - libpng-dev +# - libjpeg-dev +# - poppler-data +# - libpango1.0-dev +# - liblcms2-dev +# - libxml2-dev +# - libuninameslist-dev +# homebrew: +# packages: +# - pdf2html-new +# - autoconf +# - pkg-config +# - git +# - cmake +# - freetype +# # Poppler-specific packages +# - fontconfig +# - jpeg +# - nss +# # libuninameslist-specific packages +# - automake +# - libtool +# # fontforge-specific packages +# - python +# - glib +# - xml2 +# - libspiro +# - gettext +# # pdf2htmlEX-specific packages +# - cairo +# - pango +# sauce_connect: true + +matrix: + fast_finish: true +# allow_failures: +# - os: osx # Until the build passes, then re-enable. + +jobs: + include: +# - stage: build-linux +# os: +# - linux +# env: +# global: +# - DOCKER_FROM="ubuntu:18.04" +# services: +# - docker +# dist: bionic +# script: ./buildScripts/travisLinuxAptDoItAll + - stage: build-osx + os: + - osx + osx_image: xcode10.1 + addons: + homebrew: + update: true + script: + - ./buildScripts/travisHomeBrewDoItAll + - pdf2htmlEX --version +# - stage: test +# os: +# - linux + #- osx + #- windows +# script: ./testScripts/doItAllTravis +#deploy: +# provider: releases +# api_key: +# secure: ALWKAkgeLSPS4ULyTtxU50ZmSICEafCirCQ1YmuVTqe9nrc8E9Jm+4QaBlab5k6v90EpzNvZBnMOiT8cT1Wp2lqJzcGdGMcG49mhRvirdYhXgWuHYnygVgkxEhgejXcQaEiaGPDV3Y1k9MuiAVr8ApjUvIMlY4Hg1y0r7/rqR2fYmen+f+6a87bp5PptwakC9bfoYb92651d0TbugFfKT6TGKlE2jGlQ6On1alzLQ2DXA8coUjwpp4NcDD8OhnYGN/VZWkqckaBrMrHwjJ5FTfy5MGBOqCLzNix8sCGLEeCKkKC8J0nniNJ7+KOu9LJ2uIezKYfaUOJV0kik7F9ErvxjbfSRieako2yaSOR8X39aicTtpbyoXPRSKDU4WYX56vt4Dx7aNrYtP5b/UwWGXZa9MK7rNGJ+hiMDO1AzuyXirzR4RaJXCyC8n5W9ahBZBHCMqd5gMg5sMGPNj3Rgt34+R+nGYssum5wvr+6IKNl57sIoZFCgqviBrw2gJOCqlgOcEk/4ZSehWnXPCk6Gzxvkqkt/dmp8pJLNyvMaWcEZ6CXNHDU8MZS7bASo8Z7eAYvmX0MMjVty8J47expVaJ8M3OFHu6lE6tU8wwfd+Igr2TlWcixqaa3hDMgS+ghwdiZbYuMdR1AyZnEqK3xwvXXPPXrqRsB9xHtczLibkjY= +# file: pdf2htmlEX-newBuildSystem-x86_64.AppImage +# skip_cleanup: true +# on: +# tags: true +# repo: stephengaito/pdf2htmlEX + diff --git a/buildScripts/travisLinuxAptDoItAll b/buildScripts/travisLinuxAptDoItAll index 1abfed3..fb9db48 100755 --- a/buildScripts/travisLinuxAptDoItAll +++ b/buildScripts/travisLinuxAptDoItAll @@ -9,17 +9,15 @@ export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" ./buildScripts/versionEnvs || travis_terminate 1; ./buildScripts/reportEnvs || travis_terminate 1; -./buildScripts/getBuildTools || travis_terminate 1; -./buildScripts/getDevLibraries || travis_terminate 1; +./buildScripts/getBuildToolsApt || travis_terminate 1; +./buildScripts/getDevLibrariesApt || travis_terminate 1; ./buildScripts/getPoppler || travis_terminate 1; ./buildScripts/buildPoppler || travis_terminate 1; -./buildScripts/installPoppler || travis_terminate 1; ./buildScripts/getFontforge || travis_terminate 1; ./buildScripts/buildFontforge || travis_terminate 1; -./buildScripts/installFontforge || travis_terminate 1; ./buildScripts/buildPdf2htmlEX || travis_terminate 1; ./buildScripts/installPdf2htmlEX || travis_terminate 1; -./buildScripts/createAppImage || travis_terminate 1; -./buildScripts/createDockerImage || travis_terminate 1; -./buildScripts/uploadGitHubRelease || travis_terminate 1; -./buildScripts/uploadDockerImage || travis_terminate 1; +#./buildScripts/createAppImage || travis_terminate 1; +#./buildScripts/createDockerImage || travis_terminate 1; +#./buildScripts/uploadGitHubRelease || travis_terminate 1; +#./buildScripts/uploadDockerImage || travis_terminate 1; From aaf512d418e0ce1329b88a7ba27b73afef5fbd0a Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 11:19:52 +0000 Subject: [PATCH 185/269] updated buildPopper to explicitly enable or disable graphics packages used by pdf2htmlEX --- buildScripts/buildPoppler | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 08103ff..a80d1db 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -35,6 +35,11 @@ cmake \ -DBUILD_SHARED_LIBS=OFF \ -DRUN_GPERF_IF_PRESENT=OFF \ -DEXTRA_WARN=OFF \ + -DENABLE_JPEG=ON \ + -DENABLE_PNG=ON \ + -DENABLE_TIFF=OFF \ + -DENABLE_NSS=OFF \ + -DENABLE_Cairo=ON \ .. make $MAKE_PARALLEL @@ -91,3 +96,6 @@ make $MAKE_PARALLEL # GLIB is requrired by pdf2htmlEX # GObjectIntrospection is not needed by pdf2htmlEX? # Iconv is only used if ENABLE_CPP +# +# They can be explicitly DISABLED using ENABLE_XXXX:BOOL=OFF where XXXX is +# the package name From f1828789f6d806848d9ed74d532c4db203ab4218 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 11:34:11 +0000 Subject: [PATCH 186/269] ensure important buildScripts have set ev --- buildScripts/buildFontforge | 2 ++ buildScripts/buildPdf2htmlEX | 2 ++ buildScripts/buildPoppler | 2 ++ buildScripts/getBuildToolsApt | 2 ++ buildScripts/getBuildToolsBrew | 2 ++ buildScripts/getDevLibrariesApt | 2 ++ buildScripts/getDevLibrariesBrew | 2 ++ buildScripts/getFontforge | 2 ++ buildScripts/getPoppler | 2 ++ buildScripts/installFontforge | 2 ++ buildScripts/installPdf2htmlEX | 2 ++ buildScripts/installPoppler | 2 ++ 12 files changed, 24 insertions(+) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 8fd39c5..638607d 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script build FontForge source buildScripts/reSourceVersionEnvs diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index cf6dd00..0c855a5 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script builds pdf2htmlEX echo "" diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index a80d1db..65015c3 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script builds the latest poppler echo "" diff --git a/buildScripts/getBuildToolsApt b/buildScripts/getBuildToolsApt index 5295f60..8d59586 100755 --- a/buildScripts/getBuildToolsApt +++ b/buildScripts/getBuildToolsApt @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script automates getting the required build tools (apt install) # set the bash environment variable 'UNATTENDED' to '--assume-yes' for diff --git a/buildScripts/getBuildToolsBrew b/buildScripts/getBuildToolsBrew index b32069a..1b0aa8c 100755 --- a/buildScripts/getBuildToolsBrew +++ b/buildScripts/getBuildToolsBrew @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script automates getting the required build tools (brew install) echo "" diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibrariesApt index 91385cd..4e75ef2 100755 --- a/buildScripts/getDevLibrariesApt +++ b/buildScripts/getDevLibrariesApt @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script automates getting the development libraries required to # build poppler and fontforge diff --git a/buildScripts/getDevLibrariesBrew b/buildScripts/getDevLibrariesBrew index 6119573..d07256d 100755 --- a/buildScripts/getDevLibrariesBrew +++ b/buildScripts/getDevLibrariesBrew @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script automates getting the development libraries required to # build poppler and fontforge (using Home/Linux Brew) diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 7059eea..443ff07 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script gets and unpacks the latest fontforge AppImage source buildScripts/reSourceVersionEnvs diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index 6314ef8..93a7722 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script gets and unpacks the latest Poppler source code source buildScripts/reSourceVersionEnvs diff --git a/buildScripts/installFontforge b/buildScripts/installFontforge index 1ea43f9..e7e1b20 100755 --- a/buildScripts/installFontforge +++ b/buildScripts/installFontforge @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + echo "" echo "-------------------------------------------------------------------" echo "INSTALLING FontForge locally" diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index cbe1023..3fb6b92 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + echo "" echo "-------------------------------------------------------------------" echo "INSTALLING pdf2htmlEX locally" diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler index 42ce6ce..da2fc43 100755 --- a/buildScripts/installPoppler +++ b/buildScripts/installPoppler @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script installs Poppler into the local system echo "" From 3e835a38e293fb034128dd3dae4373565d1ae3c9 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 11:58:27 +0000 Subject: [PATCH 187/269] refactored use of set ev --- buildScripts/buildFontforge | 4 ++-- buildScripts/buildPdf2htmlEX | 5 +++-- buildScripts/buildPdf2htmlEXClang | 2 ++ buildScripts/buildPoppler | 14 +++++++------- buildScripts/cleanPdf2htmlEX | 1 - buildScripts/createAppImage | 2 ++ buildScripts/createDebianPackage | 2 ++ buildScripts/createDockerImage | 1 + buildScripts/createImages | 2 ++ buildScripts/getBuildToolsApt | 4 ++-- buildScripts/getBuildToolsBrew | 4 ++-- buildScripts/getDevLibrariesApt | 4 ++-- buildScripts/getDevLibrariesBrew | 4 ++-- buildScripts/getFontforge | 4 ++-- buildScripts/getPdf2htmlEXApt | 1 + buildScripts/getPdf2htmlEXBrew | 1 + buildScripts/getPoppler | 4 ++-- buildScripts/installFontforge | 4 ++-- buildScripts/installPdf2htmlEX | 4 ++-- buildScripts/installPoppler | 4 ++-- buildScripts/travisLinuxAptDoItAll | 30 ++++++++++++++++-------------- buildScripts/uploadImages | 2 ++ 22 files changed, 59 insertions(+), 44 deletions(-) diff --git a/buildScripts/buildFontforge b/buildScripts/buildFontforge index 638607d..26cf38a 100755 --- a/buildScripts/buildFontforge +++ b/buildScripts/buildFontforge @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script build FontForge source buildScripts/reSourceVersionEnvs @@ -12,6 +10,8 @@ echo "BUILDING FontForge (using CMake)" echo "-------------------------------------------------------------------" echo "" +set -ev + cd fontforge mkdir build diff --git a/buildScripts/buildPdf2htmlEX b/buildScripts/buildPdf2htmlEX index 0c855a5..5a048bb 100755 --- a/buildScripts/buildPdf2htmlEX +++ b/buildScripts/buildPdf2htmlEX @@ -1,15 +1,16 @@ #!/bin/bash -set -ev - # This bash script builds pdf2htmlEX echo "" echo "-------------------------------------------------------------------" echo "BUILDING pdf2htmlEX (using gcc)" echo "-------------------------------------------------------------------" + echo "" +set -ev + cd pdf2htmlEX mkdir build cd build diff --git a/buildScripts/buildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang index eb65509..ab3fd6c 100755 --- a/buildScripts/buildPdf2htmlEXClang +++ b/buildScripts/buildPdf2htmlEXClang @@ -8,6 +8,8 @@ echo "BUILDING pdf2htmlEX (using CLang)" echo "-------------------------------------------------------------------" echo "" +set -ev + cd pdf2htmlEX mkdir build cd build diff --git a/buildScripts/buildPoppler b/buildScripts/buildPoppler index 65015c3..3253c75 100755 --- a/buildScripts/buildPoppler +++ b/buildScripts/buildPoppler @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script builds the latest poppler echo "" @@ -10,6 +8,8 @@ echo "BUILDING Poppler (using CMake)" echo "-------------------------------------------------------------------" echo "" +set -ev + cd poppler mkdir build cd build @@ -37,11 +37,11 @@ cmake \ -DBUILD_SHARED_LIBS=OFF \ -DRUN_GPERF_IF_PRESENT=OFF \ -DEXTRA_WARN=OFF \ - -DENABLE_JPEG=ON \ - -DENABLE_PNG=ON \ - -DENABLE_TIFF=OFF \ - -DENABLE_NSS=OFF \ - -DENABLE_Cairo=ON \ + -DWITH_JPEG=ON \ + -DWITH_PNG=ON \ + -DWITH_TIFF=OFF \ + -DWITH_NSS=OFF \ + -DWITH_Cairo=ON \ .. make $MAKE_PARALLEL diff --git a/buildScripts/cleanPdf2htmlEX b/buildScripts/cleanPdf2htmlEX index 0b44a63..a01e378 100755 --- a/buildScripts/cleanPdf2htmlEX +++ b/buildScripts/cleanPdf2htmlEX @@ -2,6 +2,5 @@ # This bash script clean all pdf2htmlEX build products - cd pdf2htmlEX rm -rf build pdf2htmlEX.1 share/*.css share/*.js share/*.min.* src/pdf2htmlEX-config.h src/util/css_const.h diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 90ff685..87f99f3 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -10,6 +10,8 @@ echo "CREATING pdf2htmlEX AppImage" echo "-------------------------------------------------------------------" echo "" +set -ev + # For appimage output plugin # export VERSION="$PDF2HTMLEX_BRANCH-$BUILD_TIME" diff --git a/buildScripts/createDebianPackage b/buildScripts/createDebianPackage index 47f72a3..47c9d8d 100755 --- a/buildScripts/createDebianPackage +++ b/buildScripts/createDebianPackage @@ -12,6 +12,8 @@ echo "" source /etc/lsb-release +set -ev + export DPKG_NAME="pdf2htmlEX-$PDF2HTMLEX_BRANCH-$BUILD_TIME-$MACHINE_ARCH-$DISTRIB_CODENAME.deb" echo "export DPKG_NAME=\"$DPKG_NAME\"" >> buildScripts/reSourceVersionEnvs diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index 06591da..8e4e5cf 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -14,6 +14,7 @@ source buildScripts/reSourceVersionEnvs source buildScripts/dockerFunctions +set -ev mkdir -p imageBuild/dockerDir diff --git a/buildScripts/createImages b/buildScripts/createImages index f67dd3e..e07911f 100755 --- a/buildScripts/createImages +++ b/buildScripts/createImages @@ -1,5 +1,7 @@ #!/bin/bash +set -ev + # This bash script creates the pdf2htmlEX AppImage and Docker Images ################# diff --git a/buildScripts/getBuildToolsApt b/buildScripts/getBuildToolsApt index 8d59586..41a9b7e 100755 --- a/buildScripts/getBuildToolsApt +++ b/buildScripts/getBuildToolsApt @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script automates getting the required build tools (apt install) # set the bash environment variable 'UNATTENDED' to '--assume-yes' for @@ -14,6 +12,8 @@ echo " (UNATTENDED: [$UNATTENDED])" echo "-------------------------------------------------------------------" echo "" +set -ev + sudo apt-get update sudo apt-get $UNATTENDED install \ aptitude \ diff --git a/buildScripts/getBuildToolsBrew b/buildScripts/getBuildToolsBrew index 1b0aa8c..1191b46 100755 --- a/buildScripts/getBuildToolsBrew +++ b/buildScripts/getBuildToolsBrew @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script automates getting the required build tools (brew install) echo "" @@ -10,6 +8,8 @@ echo "INSTALLING Build Tools (using Home/Linux Brew)" echo "-------------------------------------------------------------------" echo "" +set -ev + brew update brew install \ git \ diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibrariesApt index 4e75ef2..b19f8a7 100755 --- a/buildScripts/getDevLibrariesApt +++ b/buildScripts/getDevLibrariesApt @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script automates getting the development libraries required to # build poppler and fontforge @@ -15,6 +13,8 @@ echo " (UNATTENDED: [$UNATTENDED])" echo "-------------------------------------------------------------------" echo "" +set -ev + sudo apt-get update sudo apt-get $UNATTENDED install \ libcairo-dev \ diff --git a/buildScripts/getDevLibrariesBrew b/buildScripts/getDevLibrariesBrew index d07256d..252b2f0 100755 --- a/buildScripts/getDevLibrariesBrew +++ b/buildScripts/getDevLibrariesBrew @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script automates getting the development libraries required to # build poppler and fontforge (using Home/Linux Brew) @@ -11,6 +9,8 @@ echo "INSTALLING development libraries (using Home/Linux Brew)" echo "-------------------------------------------------------------------" echo "" +set -ev + brew update brew install \ cairo \ diff --git a/buildScripts/getFontforge b/buildScripts/getFontforge index 443ff07..c947a20 100755 --- a/buildScripts/getFontforge +++ b/buildScripts/getFontforge @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script gets and unpacks the latest fontforge AppImage source buildScripts/reSourceVersionEnvs @@ -13,6 +11,8 @@ echo " (FONTFORGE_VERSION: [$FONTFORGE_VERSION])" echo "-------------------------------------------------------------------" echo "" +set -ev + FONTFORGE_SRC=$FONTFORGE_VERSION.tar.gz rm -rf $FONTFORGE_SRC diff --git a/buildScripts/getPdf2htmlEXApt b/buildScripts/getPdf2htmlEXApt index abc7e18..3084d1a 100755 --- a/buildScripts/getPdf2htmlEXApt +++ b/buildScripts/getPdf2htmlEXApt @@ -12,6 +12,7 @@ echo " (PDF2HTMLEX_BRANCH: [$PDF2HTMLEX_BRANCH])" echo "-------------------------------------------------------------------" echo "" +set -ev wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_BRANCH diff --git a/buildScripts/getPdf2htmlEXBrew b/buildScripts/getPdf2htmlEXBrew index 4754fe0..52a567f 100755 --- a/buildScripts/getPdf2htmlEXBrew +++ b/buildScripts/getPdf2htmlEXBrew @@ -12,6 +12,7 @@ echo " (PDF2HTMLEX_BRANCH: [$PDF2HTMLEX_BRANCH])" echo "-------------------------------------------------------------------" echo "" +set -ev wget https://codeload.github.com/stephengaito/pdf2htmlEX/zip/$PDF2HTMLEX_BRANCH diff --git a/buildScripts/getPoppler b/buildScripts/getPoppler index 93a7722..b5d9403 100755 --- a/buildScripts/getPoppler +++ b/buildScripts/getPoppler @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script gets and unpacks the latest Poppler source code source buildScripts/reSourceVersionEnvs @@ -21,6 +19,8 @@ rm -rf poppler rm -rf poppler-data-0.4.9.tar.gz rm -rf poppler-data +set -ev + wget https://poppler.freedesktop.org/$POPPLER_VERSION.tar.xz tar xvf $POPPLER_VERSION.tar.xz diff --git a/buildScripts/installFontforge b/buildScripts/installFontforge index e7e1b20..6ce6a50 100755 --- a/buildScripts/installFontforge +++ b/buildScripts/installFontforge @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - echo "" echo "-------------------------------------------------------------------" echo "INSTALLING FontForge locally" @@ -21,6 +19,8 @@ if [ -z "$UNATTENDED" ] ; then read -p "Type anything else to continue: " fi +set -ev + cd fontforge sudo make install sudo ldconfig; diff --git a/buildScripts/installPdf2htmlEX b/buildScripts/installPdf2htmlEX index 3fb6b92..5ed22aa 100755 --- a/buildScripts/installPdf2htmlEX +++ b/buildScripts/installPdf2htmlEX @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - echo "" echo "-------------------------------------------------------------------" echo "INSTALLING pdf2htmlEX locally" @@ -19,6 +17,8 @@ if [ -z "$UNATTENDED" ] ; then fi +set -ev + cd pdf2htmlEX/build sudo make install diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler index da2fc43..9461094 100755 --- a/buildScripts/installPoppler +++ b/buildScripts/installPoppler @@ -1,7 +1,5 @@ #!/bin/bash -set -ev - # This bash script installs Poppler into the local system echo "" @@ -23,6 +21,8 @@ if [ -z "$UNATTENDED" ] ; then read -p "Type anything else to continue: " fi +set -ev + cd poppler/build sudo make install diff --git a/buildScripts/travisLinuxAptDoItAll b/buildScripts/travisLinuxAptDoItAll index fb9db48..060ed49 100755 --- a/buildScripts/travisLinuxAptDoItAll +++ b/buildScripts/travisLinuxAptDoItAll @@ -2,22 +2,24 @@ # This bash script builds everyting on an TravisCI Linux (Ubunutu) worker +set -ev + export UNATTENDED="--assume-yes" export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" -./buildScripts/versionEnvs || travis_terminate 1; -./buildScripts/reportEnvs || travis_terminate 1; -./buildScripts/getBuildToolsApt || travis_terminate 1; -./buildScripts/getDevLibrariesApt || travis_terminate 1; -./buildScripts/getPoppler || travis_terminate 1; -./buildScripts/buildPoppler || travis_terminate 1; -./buildScripts/getFontforge || travis_terminate 1; -./buildScripts/buildFontforge || travis_terminate 1; -./buildScripts/buildPdf2htmlEX || travis_terminate 1; -./buildScripts/installPdf2htmlEX || travis_terminate 1; -#./buildScripts/createAppImage || travis_terminate 1; -#./buildScripts/createDockerImage || travis_terminate 1; -#./buildScripts/uploadGitHubRelease || travis_terminate 1; -#./buildScripts/uploadDockerImage || travis_terminate 1; +./buildScripts/versionEnvs +./buildScripts/reportEnvs +./buildScripts/getBuildToolsApt +./buildScripts/getDevLibrariesApt +./buildScripts/getPoppler +./buildScripts/buildPoppler +./buildScripts/getFontforge +./buildScripts/buildFontforge +./buildScripts/buildPdf2htmlEX +./buildScripts/installPdf2htmlEX +#./buildScripts/createAppImage +#./buildScripts/createDockerImage +#./buildScripts/uploadGitHubRelease +#./buildScripts/uploadDockerImage diff --git a/buildScripts/uploadImages b/buildScripts/uploadImages index 63b3b30..7adbe9c 100755 --- a/buildScripts/uploadImages +++ b/buildScripts/uploadImages @@ -6,6 +6,8 @@ ################ # do the uploads +set -ev + ./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } ./buildScripts/uploadGitHubRelease || { echo 'uploadGitHubRelease FAILED' ; exit 1 ; } From 2904663ad2b12c6a9219a1a1dee4b4e118f8e88b Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 13:28:36 +0000 Subject: [PATCH 188/269] started work on macos travis builds --- .travis.yml | 34 ++++++------- buildScripts/travisHomeBrewDoItAll | 82 ++++++++---------------------- 2 files changed, 38 insertions(+), 78 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f44dd7..ebf58c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,23 +20,23 @@ branches: jobs: fast_finish: true include: - - stage: build-linux - os: linux - env: - global: DOCKER_FROM="ubuntu:18.04" - services: - - docker - dist: bionic - script: ./buildScripts/travisLinuxAptDoItAll -# - stage: build-osx -# os: -# - osx -# osx_image: xcode10.1 -# addons: -# homebrew: -# update: true -# script: -# - ./buildScripts/travisHomeBrewDoItAll +# - stage: build-linux +# os: linux +# env: +# global: DOCKER_FROM="ubuntu:18.04" +# services: +# - docker +# dist: bionic +# script: ./buildScripts/travisLinuxAptDoItAll + - stage: build-osx + os: + - osx + osx_image: xcode10.1 + addons: + homebrew: + update: true + script: + - ./buildScripts/travisHomeBrewDoItAll # - pdf2htmlEX --version # - stage: test # os: diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index d04f76d..ef9ef3e 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -6,64 +6,24 @@ # https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images # For details on obtaining/using the correct ruby version for homebrew. -echo "-------------------------------------------------" -echo $PATH -echo $LDFLAGS -echo $CPPFLAGS -which clang -echo "-------------------------------------------------" -brew tap pdf2htmlEX/homebrew-brewTap -echo "-------------------------------------------------" -echo $PATH -echo $LDFLAGS -echo $CPPFLAGS -which clang -echo "-------------------------------------------------" -brew update -echo "-------------------------------------------------" -echo $PATH -echo $LDFLAGS -echo $CPPFLAGS -which clang -echo "-------------------------------------------------" -#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 '"') -echo $llvmVersion -#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 -echo "-------------------------------------------------" -echo $PATH -echo $LDFLAGS -echo $CPPFLAGS -which clang -ls -la $(which clang) -which python -ls -la $(which python) -python --version -echo "-------------------------------------------------" -brew install -v pdf2htmlex-new -echo "-------------------------------------------------" -echo $PATH -echo $LDFLAGS -echo $CPPFLAGS -which clang -ls -la $(which clang) -which python -ls -la $(which python) -python --version -which pdf2htmlEX -ls -la $(which pdf2htmlEX) -pdf2htmlEX --version -echo "-------------------------------------------------" +set -ev + +export UNATTENDED="--assume-yes" +export MAKE_PARALLEL="-j $(nproc)" + +export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +./buildScripts/versionEnvs +./buildScripts/reportEnvs +./buildScripts/getBuildToolsBrew +./buildScripts/getDevLibrariesBrew +./buildScripts/getPoppler +./buildScripts/buildPoppler +./buildScripts/getFontforge +./buildScripts/buildFontforge +./buildScripts/buildPdf2htmlEX +./buildScripts/installPdf2htmlEX +#./buildScripts/createAppImage +#./buildScripts/createDockerImage +#./buildScripts/uploadGitHubRelease +#./buildScripts/uploadDockerImage From 5941fb40c47bd6bcfa7fc6ab0cb37a39e0424a1d Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 13:45:26 +0000 Subject: [PATCH 189/269] corrected brew installs for travis homebrew --- buildScripts/getBuildToolsHomeBrew | 28 +++++++++++++++++++ ...tBuildToolsBrew => getBuildToolsLinuxBrew} | 0 buildScripts/travisHomeBrewDoItAll | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 buildScripts/getBuildToolsHomeBrew rename buildScripts/{getBuildToolsBrew => getBuildToolsLinuxBrew} (100%) diff --git a/buildScripts/getBuildToolsHomeBrew b/buildScripts/getBuildToolsHomeBrew new file mode 100755 index 0000000..b46ed47 --- /dev/null +++ b/buildScripts/getBuildToolsHomeBrew @@ -0,0 +1,28 @@ +#!/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 "" + +set -ev + +brew update +brew install \ + autoconf \ + libtool \ + make \ + gettext \ + openjdk \ + jq \ + tree + +# Removed the following for homeBrew (macos on travis) +# git \ +# pkg-config \ +# cmake \ +# ruby \ +# gcc \ diff --git a/buildScripts/getBuildToolsBrew b/buildScripts/getBuildToolsLinuxBrew similarity index 100% rename from buildScripts/getBuildToolsBrew rename to buildScripts/getBuildToolsLinuxBrew diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index ef9ef3e..3469cfe 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -15,7 +15,7 @@ export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" ./buildScripts/versionEnvs ./buildScripts/reportEnvs -./buildScripts/getBuildToolsBrew +./buildScripts/getBuildToolsHomeBrew ./buildScripts/getDevLibrariesBrew ./buildScripts/getPoppler ./buildScripts/buildPoppler From 3f6d39e71f43cc003314eccf97a8a12b2a3ef1c1 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 14:02:30 +0000 Subject: [PATCH 190/269] move brew install into .travis.yml --- .travis.yml | 19 +++++++++++++++++++ buildScripts/travisHomeBrewDoItAll | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ebf58c0..60e314a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,25 @@ jobs: addons: homebrew: update: true + packages: + # taken from getBuildToolsLinuxBrew + - git + - pkg-config + - ruby + - autoconf + - libtool + - cmake + - make + - gcc + - gettext + - openjdk + - jq + - tree + # taken from getDevLibrariesBrew + - cairo + - libpng + - jpeg + - libxml2 script: - ./buildScripts/travisHomeBrewDoItAll # - pdf2htmlEX --version diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll index 3469cfe..8c05c97 100755 --- a/buildScripts/travisHomeBrewDoItAll +++ b/buildScripts/travisHomeBrewDoItAll @@ -15,8 +15,8 @@ export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" ./buildScripts/versionEnvs ./buildScripts/reportEnvs -./buildScripts/getBuildToolsHomeBrew -./buildScripts/getDevLibrariesBrew +#./buildScripts/getBuildToolsHomeBrew +#./buildScripts/getDevLibrariesBrew ./buildScripts/getPoppler ./buildScripts/buildPoppler ./buildScripts/getFontforge From 91c11637212ef2f66be6b0529c23fcd4dc8bf6d9 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 15:54:32 +0000 Subject: [PATCH 191/269] begun cleaning up buildScripts to remove brew --- .travis.yml | 56 +++---------- .travis.yml.macos.20200602 | 111 ------------------------ .travis.yml.orig20190930 | 130 ----------------------------- .travisScripts/buildPoppler.sh | 25 ------ .travisScripts/copyScriptsToBin | 11 --- .travisScripts/installPoppler.sh | 28 ------- .travisScripts/setupTests.sh | 13 --- buildScripts/travisHomeBrewDoItAll | 29 ------- buildScripts/travisLinuxAptDoItAll | 5 ++ 9 files changed, 16 insertions(+), 392 deletions(-) delete mode 100644 .travis.yml.macos.20200602 delete mode 100644 .travis.yml.orig20190930 delete mode 100755 .travisScripts/buildPoppler.sh delete mode 100755 .travisScripts/copyScriptsToBin delete mode 100755 .travisScripts/installPoppler.sh delete mode 100755 .travisScripts/setupTests.sh delete mode 100755 buildScripts/travisHomeBrewDoItAll diff --git a/.travis.yml b/.travis.yml index 60e314a..ebedf85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,12 @@ language: cpp -# for windows *test* of AppImage -# see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job -# and https://discourse.appimage.org/t/run-appimage-on-windows/177 -# and https://docs.travis-ci.com/user/reference/windows/ -# why fuse is not possible on windows: https://superuser.com/questions/179436/is-it-possible-to-use-fuse-with-windows +# NOTE: Since we do not have direct access to either MacOS or Windows +# machines on which to develop WE DO NOT support building on MacOS or +# Windows. + +# For Windows, it is known that the more recent Windows 10 versions are +# able to use either the debian archive OR AppImage (as Windows 10 now +# allows FUSE). compiler: gcc @@ -12,56 +14,20 @@ branches: except: # do not build tags that we create using the upload.sh script - /^(?i:continuous.*)$/ -#matrix: -# fast_finish: true -# allow_failures: -# - os: osx # Until the build passes, then re-enable. - jobs: fast_finish: true include: -# - stage: build-linux -# os: linux + - stage: build-linux + os: linux # env: # global: DOCKER_FROM="ubuntu:18.04" # services: # - docker -# dist: bionic -# script: ./buildScripts/travisLinuxAptDoItAll - - stage: build-osx - os: - - osx - osx_image: xcode10.1 - addons: - homebrew: - update: true - packages: - # taken from getBuildToolsLinuxBrew - - git - - pkg-config - - ruby - - autoconf - - libtool - - cmake - - make - - gcc - - gettext - - openjdk - - jq - - tree - # taken from getDevLibrariesBrew - - cairo - - libpng - - jpeg - - libxml2 - script: - - ./buildScripts/travisHomeBrewDoItAll -# - pdf2htmlEX --version + dist: bionic + script: ./buildScripts/travisLinuxAptDoItAll # - stage: test # os: # - linux - #- osx - #- windows # script: ./testScripts/doItAllTravis #deploy: # provider: releases diff --git a/.travis.yml.macos.20200602 b/.travis.yml.macos.20200602 deleted file mode 100644 index fee06ac..0000000 --- a/.travis.yml.macos.20200602 +++ /dev/null @@ -1,111 +0,0 @@ -language: cpp - -sudo: true - -# for windows *test* of AppImage -# see https://docs.travis-ci.com/user/build-matrix/#using-different-programming-languages-per-job -# and https://discourse.appimage.org/t/run-appimage-on-windows/177 -# and https://docs.travis-ci.com/user/reference/windows/ -# why fuse is not possible on windows: https://superuser.com/questions/179436/is-it-possible-to-use-fuse-with-windows - -compiler: gcc - -branches: - except: # do not build tags that we create using the upload.sh script - - /^(?i:continuous.*)$/ - -# apt: -# update: true -# packages: -# # build tools -# - git -# - pkg-config -# - ruby -# - autoconf -# - libtool -# - cmake -# - make -# - gcc -# - g++ -# - gettext -# - openjdk-8-jre-headless -# - tree -# # dev libraries -# - libcairo-dev -# - libspiro-dev -# - libpng-dev -# - libjpeg-dev -# - poppler-data -# - libpango1.0-dev -# - liblcms2-dev -# - libxml2-dev -# - libuninameslist-dev -# homebrew: -# packages: -# - pdf2html-new -# - autoconf -# - pkg-config -# - git -# - cmake -# - freetype -# # Poppler-specific packages -# - fontconfig -# - jpeg -# - nss -# # libuninameslist-specific packages -# - automake -# - libtool -# # fontforge-specific packages -# - python -# - glib -# - xml2 -# - libspiro -# - gettext -# # pdf2htmlEX-specific packages -# - cairo -# - pango -# sauce_connect: true - -matrix: - fast_finish: true -# allow_failures: -# - os: osx # Until the build passes, then re-enable. - -jobs: - include: -# - stage: build-linux -# os: -# - linux -# env: -# global: -# - DOCKER_FROM="ubuntu:18.04" -# services: -# - docker -# dist: bionic -# script: ./buildScripts/travisLinuxAptDoItAll - - stage: build-osx - os: - - osx - osx_image: xcode10.1 - addons: - homebrew: - update: true - script: - - ./buildScripts/travisHomeBrewDoItAll - - pdf2htmlEX --version -# - stage: test -# os: -# - linux - #- osx - #- windows -# script: ./testScripts/doItAllTravis -#deploy: -# provider: releases -# api_key: -# secure: ALWKAkgeLSPS4ULyTtxU50ZmSICEafCirCQ1YmuVTqe9nrc8E9Jm+4QaBlab5k6v90EpzNvZBnMOiT8cT1Wp2lqJzcGdGMcG49mhRvirdYhXgWuHYnygVgkxEhgejXcQaEiaGPDV3Y1k9MuiAVr8ApjUvIMlY4Hg1y0r7/rqR2fYmen+f+6a87bp5PptwakC9bfoYb92651d0TbugFfKT6TGKlE2jGlQ6On1alzLQ2DXA8coUjwpp4NcDD8OhnYGN/VZWkqckaBrMrHwjJ5FTfy5MGBOqCLzNix8sCGLEeCKkKC8J0nniNJ7+KOu9LJ2uIezKYfaUOJV0kik7F9ErvxjbfSRieako2yaSOR8X39aicTtpbyoXPRSKDU4WYX56vt4Dx7aNrYtP5b/UwWGXZa9MK7rNGJ+hiMDO1AzuyXirzR4RaJXCyC8n5W9ahBZBHCMqd5gMg5sMGPNj3Rgt34+R+nGYssum5wvr+6IKNl57sIoZFCgqviBrw2gJOCqlgOcEk/4ZSehWnXPCk6Gzxvkqkt/dmp8pJLNyvMaWcEZ6CXNHDU8MZS7bASo8Z7eAYvmX0MMjVty8J47expVaJ8M3OFHu6lE6tU8wwfd+Igr2TlWcixqaa3hDMgS+ghwdiZbYuMdR1AyZnEqK3xwvXXPPXrqRsB9xHtczLibkjY= -# file: pdf2htmlEX-newBuildSystem-x86_64.AppImage -# skip_cleanup: true -# on: -# tags: true -# repo: stephengaito/pdf2htmlEX - diff --git a/.travis.yml.orig20190930 b/.travis.yml.orig20190930 deleted file mode 100644 index c48cdd9..0000000 --- a/.travis.yml.orig20190930 +++ /dev/null @@ -1,130 +0,0 @@ -language: cpp - -sudo: true - -os: - - linux - - osx - -env: - global: - - POPPLER_NAME="poppler-0.63.0" - - POPPLER_SOURCE="https://gitlab.freedesktop.org/poppler/poppler.git" - - FONTFORGE_SOURCE="https://github.com/fontforge/fontforge.git" - - LIBUNINAMESLIST_SOURCE="https://github.com/fontforge/libuninameslist.git" - - -compiler: gcc - -addons: - apt: - update: true - packages: - - build-essential - - autoconf - - gcc - - pkg-config - - git - - cmake - - ca-certificates - - libfreetype6-dev - # Poppler-specific packages - - libfontconfig1-dev - - libjpeg-dev - - libnss3-dev - # libuninameslist-specific packages - - automake - - libtool - # fontforge-specific packages - - libltdl-dev - - python-dev - - libglib2.0-dev - - libxml2-dev - - libspiro-dev - - gettext - # pdf2htmlEX-specific packages - - default-jre - - libcairo2-dev - - libpango1.0-dev - homebrew: - packages: - - autoconf - - pkg-config - - git - - cmake - - freetype - # Poppler-specific packages - - fontconfig - - jpeg - - nss - # libuninameslist-specific packages - - automake - - libtool - # fontforge-specific packages - - python - - glib - - xml2 - - libspiro - - gettext - # pdf2htmlEX-specific packages - - cairo - - pango - sauce_connect: true - -matrix: - fast_finish: true - allow_failures: - - os: osx # Until the build passes, then re-enable. - -before_install: -# Clone and build poppler - - git clone ${POPPLER_SOURCE} - - cd poppler; - git checkout tags/${POPPLER_NAME} -b poppler-local; - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/usr -DENABLE_XPDF_HEADERS=ON -DENABLE_LIBOPENJPEG=none .; - make; - make install - - cd ${TRAVIS_BUILD_DIR} - -# Install libuninameslist - - git clone ${LIBUNINAMESLIST_SOURCE} - - cd libuninameslist; - git checkout tags/20180701 -b libuninameslist-local; - autoreconf -i; - automake; - ./configure --prefix=${TRAVIS_BUILD_DIR}/usr; - make; - make install - - cd ${TRAVIS_BUILD_DIR} - -# Install fontforge - - git clone ${FONTFORGE_SOURCE} - - cd fontforge; - git checkout tags/20170731 -b fontforge-local; - ./bootstrap; - ./configure --disable-programs --disable-python-extension --disable-python-scripting --prefix=${TRAVIS_BUILD_DIR}/usr; - make; - make install; - sudo ldconfig - - cd ${TRAVIS_BUILD_DIR} - -# Test setup - - pip install --user Pillow selenium sauceclient - - export DISPLAY=:99.0 - - test/start_xvfb.sh - - pushd / - - python -m SimpleHTTPServer 8000 >/dev/null 2>&1 & - - popd - - sleep 5 - -before_script: - - export LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/usr/lib:$LD_LIBRARY_PATH - - export PKG_CONFIG_PATH=${TRAVIS_BUILD_DIR}/usr/lib/pkgconfig:$PKG_CONFIG_PATH - - patch < CMakeLists.txt.patch - - mkdir build && cd build && cmake -DENABLE_SVG=ON -DCMAKE_INSTALL_PREFIX=${TRAVIS_BUILD_DIR}/usr .. - -script: - - make - - P2H_TEST_REMOTE=1 ctest --output-on-failure --verbose - - make install - - ${TRAVIS_BUILD_DIR}/usr/bin/pdf2htmlEX -v diff --git a/.travisScripts/buildPoppler.sh b/.travisScripts/buildPoppler.sh deleted file mode 100755 index f0a0924..0000000 --- a/.travisScripts/buildPoppler.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# This bash script clones and builds the specified poppler release - -# See: https://github.com/pdf2htmlEX/buildAndPackagingTools/blob/master/building/awsEC2/scripts/dobuildPoppler - -# Clone and build poppler -git clone ${POPPLER_SOURCE} - -cd poppler - -git checkout tags/${POPPLER_RELEASE} - -git branch - -mkdir build - -cd build - -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \ - -DENABLE_XPDF_HEADERS=ON -DENABLE_LIBOPENJPEG=none .. - -make - - diff --git a/.travisScripts/copyScriptsToBin b/.travisScripts/copyScriptsToBin deleted file mode 100755 index ec882bd..0000000 --- a/.travisScripts/copyScriptsToBin +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# This bash script copies the various scripts in the .travisScripts to the -# /home/travis/bin directory to ensure the current scripts are not lost -# when we checkout different versions of pdf2htmlEX - -cp .travisScripts/* $HOME/bin - -cp dobuild $HOME/bin -cp doinstall $HOME/bin - diff --git a/.travisScripts/installPoppler.sh b/.travisScripts/installPoppler.sh deleted file mode 100755 index 4d97481..0000000 --- a/.travisScripts/installPoppler.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# This bash scripts **installs** poppler - -# See: https://github.com/pdf2htmlEX/buildAndPackagingTools/blob/master/building/awsEC2/scripts/doinstallPoppler - -pushd poppler/build - -sudo make install - -popd - -sudo mkdir -p /usr/include/poppler -sudo cp poppler/poppler/*.h /usr/include/poppler - -sudo mkdir -p /usr/include/poppler/goo -sudo cp poppler/goo/*.h /usr/include/poppler/goo - -sudo mkdir -p /usr/include/poppler/fofi -sudo cp poppler/fofi/*.h /usr/include/poppler/fofi - -sudo mkdir -p /usr/include/poppler/splash -sudo cp poppler/splash/*.h /usr/include/poppler/splash - -sudo cp poppler/build/poppler/poppler-config.h \ - /usr/include/poppler - - diff --git a/.travisScripts/setupTests.sh b/.travisScripts/setupTests.sh deleted file mode 100755 index 8c0eac1..0000000 --- a/.travisScripts/setupTests.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# This bash script sets up the test environment - -# Test setup -pip install --user Pillow selenium sauceclient -export DISPLAY=:99.0 -test/start_xvfb.sh -pushd / -python -m SimpleHTTPServer 8000 >/dev/null 2>&1 & -popd -sleep 5 - diff --git a/buildScripts/travisHomeBrewDoItAll b/buildScripts/travisHomeBrewDoItAll deleted file mode 100755 index 8c05c97..0000000 --- a/buildScripts/travisHomeBrewDoItAll +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# This bash script builds everyting on an TravisCI Mac OSx worker - -# See: -# https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images -# For details on obtaining/using the correct ruby version for homebrew. - -set -ev - -export UNATTENDED="--assume-yes" -export MAKE_PARALLEL="-j $(nproc)" - -export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" - -./buildScripts/versionEnvs -./buildScripts/reportEnvs -#./buildScripts/getBuildToolsHomeBrew -#./buildScripts/getDevLibrariesBrew -./buildScripts/getPoppler -./buildScripts/buildPoppler -./buildScripts/getFontforge -./buildScripts/buildFontforge -./buildScripts/buildPdf2htmlEX -./buildScripts/installPdf2htmlEX -#./buildScripts/createAppImage -#./buildScripts/createDockerImage -#./buildScripts/uploadGitHubRelease -#./buildScripts/uploadDockerImage diff --git a/buildScripts/travisLinuxAptDoItAll b/buildScripts/travisLinuxAptDoItAll index 060ed49..5b1c5f2 100755 --- a/buildScripts/travisLinuxAptDoItAll +++ b/buildScripts/travisLinuxAptDoItAll @@ -9,6 +9,11 @@ export MAKE_PARALLEL="-j $(nproc)" export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +export PDF2HTMLEX_PREFIX=/usr/local + +################ +# do the build + ./buildScripts/versionEnvs ./buildScripts/reportEnvs ./buildScripts/getBuildToolsApt From f33ec28d898b0898706f4d6ac3ddbe7d094d9f66 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 18:41:10 +0000 Subject: [PATCH 192/269] removed all brew related build scripts as well as install poppler and fontforge --- ...dInstallLocallyApt => buildInstallLocally} | 0 buildScripts/buildInstallLocallyBrew | 47 ------------------ buildScripts/buildPdf2htmlEXClang | 17 ------- .../{getBuildToolsApt => getBuildTools} | 0 buildScripts/getBuildToolsHomeBrew | 28 ----------- buildScripts/getBuildToolsLinuxBrew | 26 ---------- .../{getDevLibrariesApt => getDevLibraries} | 0 buildScripts/getDevLibrariesBrew | 24 --------- .../{getPdf2htmlEXApt => getPdf2htmlEX} | 0 buildScripts/getPdf2htmlEXBrew | 25 ---------- buildScripts/installFontforge | 26 ---------- buildScripts/installPoppler | 49 ------------------- buildScripts/travisLinuxBrewDoItAll | 11 ----- ...avisLinuxAptDoItAll => travisLinuxDoItAll} | 0 14 files changed, 253 deletions(-) rename buildScripts/{buildInstallLocallyApt => buildInstallLocally} (100%) delete mode 100755 buildScripts/buildInstallLocallyBrew delete mode 100755 buildScripts/buildPdf2htmlEXClang rename buildScripts/{getBuildToolsApt => getBuildTools} (100%) delete mode 100755 buildScripts/getBuildToolsHomeBrew delete mode 100755 buildScripts/getBuildToolsLinuxBrew rename buildScripts/{getDevLibrariesApt => getDevLibraries} (100%) delete mode 100755 buildScripts/getDevLibrariesBrew rename buildScripts/{getPdf2htmlEXApt => getPdf2htmlEX} (100%) delete mode 100755 buildScripts/getPdf2htmlEXBrew delete mode 100755 buildScripts/installFontforge delete mode 100755 buildScripts/installPoppler delete mode 100755 buildScripts/travisLinuxBrewDoItAll rename buildScripts/{travisLinuxAptDoItAll => travisLinuxDoItAll} (100%) diff --git a/buildScripts/buildInstallLocallyApt b/buildScripts/buildInstallLocally similarity index 100% rename from buildScripts/buildInstallLocallyApt rename to buildScripts/buildInstallLocally diff --git a/buildScripts/buildInstallLocallyBrew b/buildScripts/buildInstallLocallyBrew deleted file mode 100755 index 23caa20..0000000 --- a/buildScripts/buildInstallLocallyBrew +++ /dev/null @@ -1,47 +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="<>" -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=/home/linuxbrew/.linuxbrew - -################ -# do the build - -# The following is used by the pdf2htmlEX CMakeLists.txt file -# -export USING_BREW=1 - -./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/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } - -./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } - -./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } - -./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } diff --git a/buildScripts/buildPdf2htmlEXClang b/buildScripts/buildPdf2htmlEXClang deleted file mode 100755 index ab3fd6c..0000000 --- a/buildScripts/buildPdf2htmlEXClang +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# This bash script builds pdf2htmlEX using Clang (if it is installed) - -echo "" -echo "-------------------------------------------------------------------" -echo "BUILDING pdf2htmlEX (using CLang)" -echo "-------------------------------------------------------------------" -echo "" - -set -ev - -cd pdf2htmlEX -mkdir build -cd build -CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=$PDF2HTMLEX_PREFIX .. -make $MAKE_PARALLEL diff --git a/buildScripts/getBuildToolsApt b/buildScripts/getBuildTools similarity index 100% rename from buildScripts/getBuildToolsApt rename to buildScripts/getBuildTools diff --git a/buildScripts/getBuildToolsHomeBrew b/buildScripts/getBuildToolsHomeBrew deleted file mode 100755 index b46ed47..0000000 --- a/buildScripts/getBuildToolsHomeBrew +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 "" - -set -ev - -brew update -brew install \ - autoconf \ - libtool \ - make \ - gettext \ - openjdk \ - jq \ - tree - -# Removed the following for homeBrew (macos on travis) -# git \ -# pkg-config \ -# cmake \ -# ruby \ -# gcc \ diff --git a/buildScripts/getBuildToolsLinuxBrew b/buildScripts/getBuildToolsLinuxBrew deleted file mode 100755 index 1191b46..0000000 --- a/buildScripts/getBuildToolsLinuxBrew +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 "" - -set -ev - -brew update -brew install \ - git \ - pkg-config \ - ruby \ - autoconf \ - libtool \ - cmake \ - make \ - gcc \ - gettext \ - openjdk \ - jq \ - tree diff --git a/buildScripts/getDevLibrariesApt b/buildScripts/getDevLibraries similarity index 100% rename from buildScripts/getDevLibrariesApt rename to buildScripts/getDevLibraries diff --git a/buildScripts/getDevLibrariesBrew b/buildScripts/getDevLibrariesBrew deleted file mode 100755 index 252b2f0..0000000 --- a/buildScripts/getDevLibrariesBrew +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 "" - -set -ev - -brew update -brew install \ - cairo \ - libpng \ - jpeg \ - libxml2 \ - -# libspiro \ -# pango \ -# little-cms2 \ -# libuninameslist \ diff --git a/buildScripts/getPdf2htmlEXApt b/buildScripts/getPdf2htmlEX similarity index 100% rename from buildScripts/getPdf2htmlEXApt rename to buildScripts/getPdf2htmlEX diff --git a/buildScripts/getPdf2htmlEXBrew b/buildScripts/getPdf2htmlEXBrew deleted file mode 100755 index 52a567f..0000000 --- a/buildScripts/getPdf2htmlEXBrew +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 "" - -set -ev - -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/installFontforge b/buildScripts/installFontforge deleted file mode 100755 index 6ce6a50..0000000 --- a/buildScripts/installFontforge +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -echo "" -echo "-------------------------------------------------------------------" -echo "INSTALLING FontForge locally" -echo " (UNATTENDED: [$UNATTENDED])" -echo "-------------------------------------------------------------------" -echo "" - - -if [ -z "$UNATTENDED" ] ; then - echo "WARNING: this may over-write any existing" - echo "FontForge version you have installed on your system." - echo "This may break other packages/applications." - echo "" - echo "This installation assumes you have 'sudo' privileges." - echo "" - echo "Type ctrl-c now if DO NOT want to continue" - read -p "Type anything else to continue: " -fi - -set -ev - -cd fontforge -sudo make install -sudo ldconfig; diff --git a/buildScripts/installPoppler b/buildScripts/installPoppler deleted file mode 100755 index 9461094..0000000 --- a/buildScripts/installPoppler +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# This bash script installs Poppler into the local system - -echo "" -echo "-------------------------------------------------------------------" -echo "INSTALLING Poppler locally" -echo " (UNATTENDED: [$UNATTENDED])" -echo "-------------------------------------------------------------------" -echo "" - - -if [ -z "$UNATTENDED" ] ; then - echo "WARNING: this may over-write any existing" - echo "Poppler version you have installed on your system." - echo "This may break other packages/applications." - echo "" - echo "This installation assumes you have 'sudo' privileges." - echo "" - echo "Type ctrl-c now if DO NOT want to continue" - read -p "Type anything else to continue: " -fi - -set -ev - -cd poppler/build -sudo make install - -cd .. - -sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler -sudo cp poppler/*.h $PDF2HTMLEX_PREFIX/include/poppler - -sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/goo -sudo cp goo/*.h $PDF2HTMLEX_PREFIX/include/poppler/goo - -sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/fofi -sudo cp fofi/*.h $PDF2HTMLEX_PREFIX/include/poppler/fofi - -sudo mkdir -p $PDF2HTMLEX_PREFIX/include/poppler/splash -sudo cp splash/*.h $PDF2HTMLEX_PREFIX/include/poppler/splash - -sudo cp build/poppler/poppler-config.h \ - $PDF2HTMLEX_PREFIX/include/poppler - -cd ../poppler-data - -sudo make install prefix=$PDF2HTMLEX_PREFIX - diff --git a/buildScripts/travisLinuxBrewDoItAll b/buildScripts/travisLinuxBrewDoItAll deleted file mode 100755 index f8fa8e1..0000000 --- a/buildScripts/travisLinuxBrewDoItAll +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# This bash script builds everyting on an TravisCI Mac OSx worker - -# See: -# https://docs.travis-ci.com/user/installing-dependencies/#using-homebrew-without-addon-on-older-macos-images -# For details on obtaining/using the correct ruby version for homebrew. - -brew update -brew tap pdf2htmlEX/homebrew-brewTap -brew install pdf2htmlex-new diff --git a/buildScripts/travisLinuxAptDoItAll b/buildScripts/travisLinuxDoItAll similarity index 100% rename from buildScripts/travisLinuxAptDoItAll rename to buildScripts/travisLinuxDoItAll From d7da59ba128eef2b502ba136fa7dedfd60388467 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Tue, 2 Jun 2020 18:45:29 +0000 Subject: [PATCH 193/269] cleaned up references to apt build scripts --- .travis.yml | 2 +- buildScripts/buildInstallLocally | 30 ++++++++++++++++++++---------- buildScripts/travisLinuxDoItAll | 4 ++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index ebedf85..48580d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ jobs: # services: # - docker dist: bionic - script: ./buildScripts/travisLinuxAptDoItAll + script: ./buildScripts/travisLinuxDoItAll # - stage: test # os: # - linux diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally index 63b7688..7091d2c 100755 --- a/buildScripts/buildInstallLocally +++ b/buildScripts/buildInstallLocally @@ -19,25 +19,35 @@ export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" # export PDF2HTMLEX_PREFIX=/usr/local +set -ev + ################ # do the build -./buildScripts/versionEnvs || { echo 'versionEnvs FAILED' ; exit 1 ; } +./buildScripts/versionEnvs -./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; } +./buildScripts/reportEnvs -./buildScripts/getBuildToolsApt || { echo 'getBuildToolsApt FAILED' ; exit 1 ; } +./buildScripts/getBuildTools -./buildScripts/getDevLibrariesApt || { echo 'getDevLibrariesApt FAILED' ; exit 1 ; } +./buildScripts/getDevLibraries -./buildScripts/getPoppler || { echo 'getPoppler FAILED' ; exit 1 ; } +./buildScripts/getPoppler -./buildScripts/buildPoppler || { echo 'buildPoppler FAILED' ; exit 1 ; } +./buildScripts/buildPoppler -./buildScripts/getFontforge || { echo 'getFontforge FAILED' ; exit 1 ; } +./buildScripts/getFontforge -./buildScripts/buildFontforge || { echo 'buildFontforge FAILED' ; exit 1 ; } +./buildScripts/buildFontforge -./buildScripts/buildPdf2htmlEX || { echo 'buildPdf2htmlEX FAILED' ; exit 1 ; } +./buildScripts/buildPdf2htmlEX -./buildScripts/installPdf2htmlEX || { echo 'installPdf2htmlEX FAILED' ; exit 1 ; } +./buildScripts/installPdf2htmlEX + +#./buildScripts/createAppImage + +#./buildScripts/createDockerImage + +#./buildScripts/uploadGitHubRelease + +#./buildScripts/uploadDockerImage diff --git a/buildScripts/travisLinuxDoItAll b/buildScripts/travisLinuxDoItAll index 5b1c5f2..3953b28 100755 --- a/buildScripts/travisLinuxDoItAll +++ b/buildScripts/travisLinuxDoItAll @@ -16,8 +16,8 @@ export PDF2HTMLEX_PREFIX=/usr/local ./buildScripts/versionEnvs ./buildScripts/reportEnvs -./buildScripts/getBuildToolsApt -./buildScripts/getDevLibrariesApt +./buildScripts/getBuildTools +./buildScripts/getDevLibraries ./buildScripts/getPoppler ./buildScripts/buildPoppler ./buildScripts/getFontforge From d2e869f05c12711849c6f7ed86e9444ff205c6e2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Wed, 3 Jun 2020 12:17:44 +0000 Subject: [PATCH 194/269] updated local tests and added bash scripts to help automate testing. --- .gitattributes | 1 + .gitignore | 24 ++--- buildScripts/buildInstallLocally | 4 + buildScripts/travisLinuxDoItAll | 4 + pdf2htmlEX/test/README.md | 90 +++++++++++++++++++ pdf2htmlEX/test/browser_tests.py | 22 +++-- .../fontfile3_opentype.html | 48 +++++----- .../geneve_1564/geneve_1564.html | 22 ++--- ...ackground_with_page_rotation_issue402.html | 11 +-- .../browser_tests/with_form/with_form.html | 30 +++---- pdf2htmlEX/test/compareTestImages | 31 +++++++ pdf2htmlEX/test/installAutomaticTestSoftware | 33 +++++++ pdf2htmlEX/test/installManualTestSoftware | 13 +++ pdf2htmlEX/test/regenerateTest | 48 ++++++++++ pdf2htmlEX/test/runLocalBrowserTests | 51 +++++++++++ pdf2htmlEX/test/runLocalTests | 5 ++ pdf2htmlEX/test/start_xvfb.sh | 2 - pdf2htmlEX/test/test.py.in | 2 +- pdf2htmlEX/test/test_local_browser.py | 62 +++++++------ pdf2htmlEX/test/test_output.py | 6 +- 20 files changed, 405 insertions(+), 104 deletions(-) create mode 100644 .gitattributes create mode 100755 pdf2htmlEX/test/compareTestImages create mode 100755 pdf2htmlEX/test/installAutomaticTestSoftware create mode 100755 pdf2htmlEX/test/installManualTestSoftware create mode 100755 pdf2htmlEX/test/regenerateTest create mode 100755 pdf2htmlEX/test/runLocalBrowserTests create mode 100755 pdf2htmlEX/test/runLocalTests delete mode 100755 pdf2htmlEX/test/start_xvfb.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b451356 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +test export-ignore diff --git a/.gitignore b/.gitignore index c855e82..13e1fba 100644 --- a/.gitignore +++ b/.gitignore @@ -14,19 +14,19 @@ CTestTestfile.cmake gmon.out install_manifest.txt Makefile -pdf2htmlEX -pdf2htmlEX.1 +pdf2htmlEX/build +pdf2htmlEX/pdf2htmlEX.1 *.pyc -share/base.css -share/base.min.css -share/fancy.css -share/fancy.min.css -share/pdf2htmlEX.js -share/pdf2htmlEX.min.js -src/pdf2htmlEX-config.h -src/util/css_const.h -test export-ignore +pdf2htmlEX/share/base.css +pdf2htmlEX/share/base.min.css +pdf2htmlEX/share/fancy.css +pdf2htmlEX/share/fancy.min.css +pdf2htmlEX/share/pdf2htmlEX.js +pdf2htmlEX/share/pdf2htmlEX.min.js +pdf2htmlEX/src/pdf2htmlEX-config.h +pdf2htmlEX/src/util/css_const.h Testing/* DartConfiguration.tcl -test/test.py +pdf2htmlEX/test/test.py +pdf2htmlEX/test/geckodriver.log *.swp diff --git a/buildScripts/buildInstallLocally b/buildScripts/buildInstallLocally index 7091d2c..11c0d69 100755 --- a/buildScripts/buildInstallLocally +++ b/buildScripts/buildInstallLocally @@ -19,6 +19,10 @@ export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" # export PDF2HTMLEX_PREFIX=/usr/local +# Ensure all Apt packages are installed with no user interaction +# +export DEBIAN_FRONTEND=noninteractive + set -ev ################ diff --git a/buildScripts/travisLinuxDoItAll b/buildScripts/travisLinuxDoItAll index 3953b28..07bf766 100755 --- a/buildScripts/travisLinuxDoItAll +++ b/buildScripts/travisLinuxDoItAll @@ -11,6 +11,10 @@ export PDF2HTMLEX_BRANCH="$(git rev-parse --abbrev-ref HEAD)" export PDF2HTMLEX_PREFIX=/usr/local +# Ensure all Apt packages are installed with no user interaction +# +export DEBIAN_FRONTEND=noninteractive + ################ # do the build diff --git a/pdf2htmlEX/test/README.md b/pdf2htmlEX/test/README.md index 9370d8f..7b8f708 100644 --- a/pdf2htmlEX/test/README.md +++ b/pdf2htmlEX/test/README.md @@ -1,3 +1,93 @@ +# pdf2htmlEX tests + +This directory contains a collection of python3 unittests of the output of +pdf2htmlEX. + +The graphical output of pdf2htmlEX can be tested both locally and remotely +using [Selenium](https://www.selenium.dev/) and the [Pillow Python Imaging +Library](https://python-pillow.org/). + +The browser tests use Selenium to take a screenshot of a FireFox browser's +rendering of the pdf2htmlEX output for a given pdf file and compares that +image to an image of the previously saved reference html. + +## Tests which are currently failing: + +- **browser_tests/text_visibility** At the moment clipping has been broken +and needs to be fixed. Rerun `runLocalBrowserTests` and use the +`compareTestImages` for the `test_visibility` test to see the problem. + +## Running tests + +There are three bash scripts which automate the running of a given +collection of tests: + +1. **runLocalTests** runs a simple collection of tests which do not +require Selenium or a browser. + +``` + ./runLocalTests +``` + +2. **runLocalBrowserTests** runs a more complex collection of tests which +*require* Selenium, a FireFox browser, as well as a 'virtual frame buffer' +(Xvfb) to be installed. + +``` + ./runLocalBrowserTests +``` + +3. **runRemoteBrowserTests** runs the same complex collection of tests as +run by `runLocalBrowserTests` but this time using 'Sauce Connect'. (At the +moment this is not fully implemented or (re)tested) + +``` + ./runRemoteBrowserTests +``` + +In order to run these tests, you *must* have the correct testing software +installed locally. To do this you can run the command: + +``` + ./installAutomaticTestSoftware +``` + +## Understanding browser test failures + +If any of the automatic browser tests *fail* then you might want to +manually view the PNG images for a given test using the command: + +``` + ./compareTestImages <> +``` + +This command opens the three PNG images associated with a given failed +test so that you can manually compare the new output (`*.out.png`), the +reference output (`*.ref.png`) and an image of the 'difference' between +the two images (`*.diff.png`). To pass, the 'difference' image must be +*completely* black. + +Usually it will be obvious that the newer version of pdf2htmlEX has only +slightly moved various image elements. Any such tests can be made to pass +by updating the reference html using the tool: + +``` + ./regenerateTestHtml <> +``` + +This command will regenerate the reference html for the specifed test. + +All of these manual comparison tools require additional software which can +be installed using the command: + +``` + ./installManualTestSoftware +``` + +--- + +## OLD README contents: + ### Dependencies - python2 and packages diff --git a/pdf2htmlEX/test/browser_tests.py b/pdf2htmlEX/test/browser_tests.py index c1880a9..dc0066a 100644 --- a/pdf2htmlEX/test/browser_tests.py +++ b/pdf2htmlEX/test/browser_tests.py @@ -5,6 +5,7 @@ import subprocess import shutil import unittest +#from selenium.common.exceptions import WebDriverException from PIL import Image, ImageChops from test import Common @@ -30,7 +31,7 @@ class BrowserTests(Common): def run_test_case(self, filename, args=[], page_must_load=True): basefilename, extension = os.path.splitext(filename) - self.assertEquals(extension.lower(), '.pdf', 'Input file is not PDF') + self.assertEqual(extension.lower(), '.pdf', 'Input file is not PDF') htmlfilename = basefilename + '.html' ref_htmlfolder = os.path.join(self.TEST_DATA_DIR, basefilename) @@ -52,21 +53,28 @@ class BrowserTests(Common): pngfilename_out = os.path.join(self.PNGDIR, basefilename + '.out.png') self.generate_image(out_htmlfilename, pngfilename_out) - out_img = Image.open(pngfilename_out) + out_img = Image.open(pngfilename_out).convert('RGB') pngfilename_ref = os.path.join(self.PNGDIR, basefilename + '.ref.png') self.generate_image(ref_htmlfilename, pngfilename_ref, page_must_load=page_must_load) - ref_img = Image.open(pngfilename_ref) + ref_img = Image.open(pngfilename_ref).convert('RGB') diff_img = ImageChops.difference(ref_img, out_img); + # ALWAYS save the diff image so we can manually check the diff + # see: (http://stackoverflow.com/questions/15721484): + diff_file_name = os.path.join(self.PNGDIR, basefilename + '.diff.png') + diff_img.convert('RGB').save(diff_file_name) + diff_bbox = diff_img.getbbox() - if diff_bbox is not None: + print("\nTesting at: [", basefilename, "]") + + if diff_bbox is None: + print(" passed") + else: + print(" diff bounding box: ", diff_bbox, " should be None") diff_size = (diff_bbox[2] - diff_bbox[0]) * (diff_bbox[3] - diff_bbox[1]) img_size = ref_img.size[0] * ref_img.size[1] - # save the diff image (http://stackoverflow.com/questions/15721484): - diff_file_name = os.path.join(self.PNGDIR, basefilename + '.diff.png') - diff_img.convert('RGB').save(diff_file_name) self.fail(('PNG files %s and %s differ by at most %d pixels, '+ '(%f%% of %d pixels in total), difference: %s') % (pngfilename_out, pngfilename_ref, diff --git a/pdf2htmlEX/test/browser_tests/fontfile3_opentype/fontfile3_opentype.html b/pdf2htmlEX/test/browser_tests/fontfile3_opentype/fontfile3_opentype.html index 6fee4fd..65e7097 100644 --- a/pdf2htmlEX/test/browser_tests/fontfile3_opentype/fontfile3_opentype.html +++ b/pdf2htmlEX/test/browser_tests/fontfile3_opentype/fontfile3_opentype.html @@ -19,9 +19,9 @@