diff options
-rw-r--r-- | .SRCINFO | 30 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | 0001-Cairo-backend-added-to-Qt4-wrapper.patch | 199 | ||||
-rw-r--r-- | 0002-Setting-default-Qt4-backend-to-Cairo.patch | 25 | ||||
-rw-r--r-- | 0003-Forcing-subpixel-rendering-in-Cairo-backend.patch | 30 | ||||
-rw-r--r-- | 0004-Don-t-build-the-main-poppler-library.patch | 35 | ||||
-rw-r--r-- | PKGBUILD | 49 |
7 files changed, 372 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2239dde0e5b5 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,30 @@ +pkgbase = poppler-qt-lcd + pkgdesc = Poppler Qt bindings, with patches to allow subpixel rendering via Cairo + pkgver = 0.36.0 + pkgrel = 1 + url = https://github.com/giddie/poppler-qt4-cairo-backend + arch = i686 + arch = x86_64 + license = GPL + makedepends = cmake + makedepends = pkgconfig + depends = qt4 + depends = cairo + depends = poppler>=0.36.0 + provides = poppler-qt=0.36.0 + provides = poppler-qt4=0.36.0 + conflicts = poppler-qt + conflicts = poppler-qt4 + source = http://poppler.freedesktop.org/poppler-0.36.0.tar.xz + source = 0001-Cairo-backend-added-to-Qt4-wrapper.patch + source = 0002-Setting-default-Qt4-backend-to-Cairo.patch + source = 0003-Forcing-subpixel-rendering-in-Cairo-backend.patch + source = 0004-Don-t-build-the-main-poppler-library.patch + md5sums = 9f72a76e6ca899dd81b03537c4ce3680 + md5sums = f4ffd943af8fc0645b5dec3a27f156d9 + md5sums = 25a9186b16d2e94a9fee3a27ec17a359 + md5sums = f8a6c56fd452a0146e58ea9cc2ecd431 + md5sums = 4591aed8f2ead759a5d307100f18c150 + +pkgname = poppler-qt-lcd + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..35abb9ee4b92 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.swp +*.tar.xz +/src +/pkg diff --git a/0001-Cairo-backend-added-to-Qt4-wrapper.patch b/0001-Cairo-backend-added-to-Qt4-wrapper.patch new file mode 100644 index 000000000000..45149460b6bd --- /dev/null +++ b/0001-Cairo-backend-added-to-Qt4-wrapper.patch @@ -0,0 +1,199 @@ +From e5bdc19bd2ee4ac5ca3a701c07b0b33ae4c1ebb1 Mon Sep 17 00:00:00 2001 +From: Paul Gideon Dann <pdgiddie@gmail.com> +Date: Wed, 20 May 2009 11:42:28 +0100 +Subject: [PATCH 1/4] Cairo backend added to Qt4 wrapper + +--- + qt4/src/CMakeLists.txt | 15 ++++++++++ + qt4/src/poppler-document.cc | 3 ++ + qt4/src/poppler-page.cc | 70 +++++++++++++++++++++++++++++++++++++++++++++ + qt4/src/poppler-qt4.h | 3 +- + qt4/tests/CMakeLists.txt | 5 ++++ + 5 files changed, 95 insertions(+), 1 deletion(-) + +diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt +index 5ec1b48..bc946d7 100644 +--- a/qt4/src/CMakeLists.txt ++++ b/qt4/src/CMakeLists.txt +@@ -6,6 +6,11 @@ include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ) + ++if (HAVE_CAIRO) ++ include_directories(${CAIRO_INCLUDE_DIRS}) ++ add_definitions(${CAIRO_CFLAGS}) ++endif (HAVE_CAIRO) ++ + set(poppler_qt4_SRCS + poppler-annotation.cc + poppler-document.cc +@@ -28,10 +33,20 @@ set(poppler_qt4_SRCS + poppler-media.cc + ArthurOutputDev.cc + ) ++if (HAVE_CAIRO) ++ set(poppler_qt4_SRCS ${poppler_qt4_SRCS} ++ ${CMAKE_SOURCE_DIR}/poppler/CairoOutputDev.cc ++ ${CMAKE_SOURCE_DIR}/poppler/CairoRescaleBox.cc ++ ${CMAKE_SOURCE_DIR}/poppler/CairoFontEngine.cc ++ ) ++endif(HAVE_CAIRO) + qt4_automoc(${poppler_qt4_SRCS}) + add_library(poppler-qt4 SHARED ${poppler_qt4_SRCS}) + set_target_properties(poppler-qt4 PROPERTIES VERSION 4.8.0 SOVERSION 4) + target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBRARY} ${QT4_QTXML_LIBRARY}) ++if (HAVE_CAIRO) ++ target_link_libraries(poppler-qt4 ${CAIRO_LIBRARIES}) ++endif (HAVE_CAIRO) + if(MSVC) + target_link_libraries(poppler-qt4 poppler ${poppler_LIBS}) + endif(MSVC) +diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc +index 94f997d..6decaaf 100644 +--- a/qt4/src/poppler-document.cc ++++ b/qt4/src/poppler-document.cc +@@ -547,6 +547,9 @@ namespace Poppler { + ret << Document::SplashBackend; + #endif + ret << Document::ArthurBackend; ++#if defined(HAVE_CAIRO) ++ ret << Document::CairoBackend; ++#endif + return ret; + } + +diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc +index 83bcf4a..df1d344 100644 +--- a/qt4/src/poppler-page.cc ++++ b/qt4/src/poppler-page.cc +@@ -40,6 +40,7 @@ + #include <QtGui/QPainter> + + #include <config.h> ++#include <math.h> + #include <PDFDoc.h> + #include <Catalog.h> + #include <Form.h> +@@ -53,6 +54,9 @@ + #include <SplashOutputDev.h> + #include <splash/SplashBitmap.h> + #endif ++#if defined(HAVE_CAIRO) ++#include <CairoOutputDev.h> ++#endif + + #include "poppler-private.h" + #include "poppler-page-transition-private.h" +@@ -405,6 +409,70 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, + img = tmpimg; + break; + } ++ case Poppler::Document::CairoBackend: ++ { ++#if defined(HAVE_CAIRO) ++ CairoOutputDev *output_dev = new CairoOutputDev(); ++ output_dev->startDoc(m_page->parentDoc->doc); ++ int buffer_width, buffer_height, rotate; ++ cairo_surface_t *surface; ++ cairo_t *cairo; ++ ++ // If w or h are -1, that indicates the whole page, so we need to ++ // calculate how many pixels that corresponds to. Otherwise, we can use w ++ // or h directly for our buffer size. ++ const QSize pageSize = this->pageSize(); ++ if (w == -1) { ++ const double xscale = xres / 72.0; ++ const double width = pageSize.width();; ++ buffer_width = (int) ceil(width * xscale); ++ } else { ++ buffer_width = w; ++ } ++ if (h == -1) { ++ const double yscale = yres / 72.0; ++ const double height = pageSize.height(); ++ buffer_height = (int) ceil(height * yscale); ++ } else { ++ buffer_height = h; ++ } ++ ++ rotate = rotation + m_page->page->getRotate(); ++ ++ // FIXME: Okular never provides a rotation value, so I don't have any way ++ // of testing this right now. The result is that subpixels are ordered ++ // incorrectly when the page is rotated. ++ ++ //if (rotate == 90 || rotate == 270) { ++ // const double temp = height; ++ // height = width; ++ // width = temp; ++ //} ++ ++ img = QImage(buffer_width, buffer_height, QImage::Format_ARGB32); ++ img.fill(Qt::white); // Never transparent ++ ++ surface = cairo_image_surface_create_for_data( ++ img.bits(), ++ CAIRO_FORMAT_ARGB32, ++ buffer_width, buffer_height, ++ img.bytesPerLine()); ++ ++ cairo = cairo_create(surface); ++ output_dev->setCairo(cairo); ++ ++ m_page->parentDoc->doc->displayPageSlice( ++ output_dev, m_page->index + 1, xres, yres, rotation, false, true, ++ false, x, y, w, h); ++ ++ // Clean up ++ output_dev->setCairo(NULL); ++ cairo_destroy(cairo); ++ cairo_surface_destroy(surface); ++ delete output_dev; ++#endif ++ break; ++ } + } + + return img; +@@ -447,6 +515,8 @@ bool Page::renderToPainter(QPainter* painter, double xres, double yres, int x, i + painter->restore(); + return true; + } ++ case Poppler::Document::CairoBackend: ++ return false; + } + return false; + } +diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h +index c0340a4..118f8ba 100644 +--- a/qt4/src/poppler-qt4.h ++++ b/qt4/src/poppler-qt4.h +@@ -886,7 +886,8 @@ delete it; + */ + enum RenderBackend { + SplashBackend, ///< Splash backend +- ArthurBackend ///< Arthur (Qt4) backend ++ ArthurBackend, ///< Arthur (Qt4) backend ++ CairoBackend ///< Cairo backend + }; + + /** +diff --git a/qt4/tests/CMakeLists.txt b/qt4/tests/CMakeLists.txt +index 4f16f24..2ab3555 100644 +--- a/qt4/tests/CMakeLists.txt ++++ b/qt4/tests/CMakeLists.txt +@@ -8,6 +8,11 @@ include_directories( + ${QT4_INCLUDE_DIR} + ) + ++if (HAVE_CAIRO) ++ include_directories(${CAIRO_INCLUDE_DIRS}) ++ add_definitions(${CAIRO_CFLAGS}) ++endif (HAVE_CAIRO) ++ + macro(QT4_ADD_SIMPLETEST exe source) + string(REPLACE "-" "" test_name ${exe}) + set(${test_name}_SOURCES +-- +2.6.0 + diff --git a/0002-Setting-default-Qt4-backend-to-Cairo.patch b/0002-Setting-default-Qt4-backend-to-Cairo.patch new file mode 100644 index 000000000000..f52edbdc0640 --- /dev/null +++ b/0002-Setting-default-Qt4-backend-to-Cairo.patch @@ -0,0 +1,25 @@ +From 13d7a4b293246bf0c9e0b0aaf1bb10e7748bcbe0 Mon Sep 17 00:00:00 2001 +From: Paul Gideon Dann <pdgiddie@gmail.com> +Date: Wed, 20 May 2009 13:17:29 +0100 +Subject: [PATCH 2/4] Setting default Qt4 backend to Cairo + +--- + qt4/src/poppler-private.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc +index cbf21b1..1c7f16c 100644 +--- a/qt4/src/poppler-private.cc ++++ b/qt4/src/poppler-private.cc +@@ -236,7 +236,7 @@ namespace Debug { + void DocumentData::init() + { + m_fontInfoIterator = 0; +- m_backend = Document::SplashBackend; ++ m_backend = Document::CairoBackend; + paperColor = Qt::white; + m_hints = 0; + m_optContentModel = 0; +-- +2.6.0 + diff --git a/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch b/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch new file mode 100644 index 000000000000..f6ae93fbe77c --- /dev/null +++ b/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch @@ -0,0 +1,30 @@ +From 1c226f56147ea14519ee2cc5a50272f90fc55641 Mon Sep 17 00:00:00 2001 +From: Paul Gideon Dann <pdgiddie@gmail.com> +Date: Wed, 20 May 2009 13:06:48 +0100 +Subject: [PATCH 3/4] Forcing subpixel rendering in Cairo backend + +--- + poppler/CairoOutputDev.cc | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc +index 1e201d3..671e505 100644 +--- a/poppler/CairoOutputDev.cc ++++ b/poppler/CairoOutputDev.cc +@@ -203,6 +203,13 @@ void CairoOutputDev::setCairo(cairo_t *cairo) + } + if (cairo != NULL) { + this->cairo = cairo_reference (cairo); ++ { ++ cairo_font_options_t *options = cairo_font_options_create (); ++ cairo_get_font_options (cairo, options); ++ cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_SUBPIXEL); ++ cairo_set_font_options (cairo, options); ++ cairo_font_options_destroy (options); ++ } + /* 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); +-- +2.6.0 + diff --git a/0004-Don-t-build-the-main-poppler-library.patch b/0004-Don-t-build-the-main-poppler-library.patch new file mode 100644 index 000000000000..adffbc9cfe39 --- /dev/null +++ b/0004-Don-t-build-the-main-poppler-library.patch @@ -0,0 +1,35 @@ +From 3b134589bcf9a4e8317f0b501ea77075f7e46dc8 Mon Sep 17 00:00:00 2001 +From: Paul Gideon Dann <pdgiddie@gmail.com> +Date: Tue, 20 Oct 2009 18:32:35 +0100 +Subject: [PATCH 4/4] Don't build the main poppler library. + +--- + CMakeLists.txt | 12 ------------ + 1 file changed, 12 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ac3d090..2d18c1e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -471,18 +471,6 @@ if(HAVE_PTHREAD) + set(poppler_LIBS ${poppler_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + endif() + +-if(MSVC) +-add_definitions(-D_CRT_SECURE_NO_WARNINGS) +-set(CMAKE_CXX_FLAGS "/Zc:wchar_t- ${CMAKE_CXX_FLAGS}") +-add_library(poppler STATIC ${poppler_SRCS}) +-else(MSVC) +-add_library(poppler SHARED ${poppler_SRCS}) +-endif(MSVC) +-set_target_properties(poppler PROPERTIES VERSION 55.0.0 SOVERSION 55) +-target_link_libraries(poppler ${poppler_LIBS}) +-target_link_libraries(poppler LINK_INTERFACE_LIBRARIES "") +-install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}) +- + if(ENABLE_XPDF_HEADERS) + install(FILES + poppler/Annot.h +-- +2.6.0 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..0bf1e640c601 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,49 @@ +# $Id: PKGBUILD 36062 2009-04-19 20:15:39Z jgc $ +# Maintainer: Paul Gideon Dann <pdgiddie_at_gmail.com> + +pkgname=poppler-qt-lcd +pkgver=0.36.0 +pkgrel=1 +pkgdesc="Poppler Qt bindings, with patches to allow subpixel rendering via Cairo" +license=('GPL') +arch=(i686 x86_64) +provides=("poppler-qt=${pkgver}" "poppler-qt4=${pkgver}") +conflicts=('poppler-qt' 'poppler-qt4') +depends=('qt4' 'cairo' "poppler>=${pkgver}") +makedepends=('cmake' 'pkgconfig') +url="https://github.com/giddie/poppler-qt4-cairo-backend" +source=(http://poppler.freedesktop.org/poppler-${pkgver}.tar.xz + 0001-Cairo-backend-added-to-Qt4-wrapper.patch + 0002-Setting-default-Qt4-backend-to-Cairo.patch + 0003-Forcing-subpixel-rendering-in-Cairo-backend.patch + 0004-Don-t-build-the-main-poppler-library.patch) +md5sums=('9f72a76e6ca899dd81b03537c4ce3680' + 'f4ffd943af8fc0645b5dec3a27f156d9' + '25a9186b16d2e94a9fee3a27ec17a359' + 'f8a6c56fd452a0146e58ea9cc2ecd431' + '4591aed8f2ead759a5d307100f18c150') + +build() { + cd "${srcdir}/poppler-${pkgver}" + + for patch in ${srcdir}/*.patch; do + patch -Np1 -i $patch + done; + + mkdir -p build + cd build + cmake -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4 \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DENABLE_CPP=OFF -DENABLE_UTILS=OFF \ + -DWITH_GLIB=OFF -DBUILD_QT4_TESTS=OFF \ + .. + make poppler-qt4 +} + +package() { + cd "${srcdir}/poppler-${pkgver}/build" + + make DESTDIR="${pkgdir}" -C qt4/src install + msg "Removing unwanted pkg-config files" + rm -f "${pkgdir}"/usr/lib/pkgconfig/poppler{,-splash,-cairo}.pc +} |