summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorYichao Zhou2016-05-19 00:42:57 -0700
committerYichao Zhou2016-05-19 00:43:19 -0700
commita8df32dcf58846df816af13914c8e670170b6c05 (patch)
tree4f1757a06c0deb58ec235a56932478cacb88a6f8
parente567c5dfb599ab88342fdece7916e1b6d177989a (diff)
downloadaur-a8df32dcf58846df816af13914c8e670170b6c05.tar.gz
Disable subpixel rendering in type3 fonts
-rw-r--r--PKGBUILD8
-rw-r--r--poppler-subpixel.patch71
2 files changed, 51 insertions, 28 deletions
diff --git a/PKGBUILD b/PKGBUILD
index a6b47942898d..0696b1653f6d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,8 +4,8 @@
_pkgbase=poppler
pkgbase=poppler-lcdfilter
pkgname=('poppler-lcdfilter' 'poppler-glib-lcdfilter')
-pkgver=0.39.0
-pkgrel=2
+pkgver=0.42.0
+pkgrel=0
arch=(i686 x86_64)
license=('GPL')
makedepends=('libjpeg' 'gcc-libs' 'cairo' 'fontconfig' 'openjpeg' 'gtk2' 'qt4' 'pkgconfig' 'lcms2' 'gobject-introspection' 'icu' 'qt5-base' 'git' 'python2')
@@ -14,9 +14,9 @@ url="http://poppler.freedesktop.org/"
source=(http://poppler.freedesktop.org/${_pkgbase}-${pkgver}.tar.xz
git://anongit.freedesktop.org/poppler/test
poppler-subpixel.patch)
-md5sums=('5100960c61b932430b5d74068d71f530'
+md5sums=('SKIP'
'SKIP'
- '561dffc866d4e3ff437a1efcdc6e600e')
+ 'SKIP')
build() {
cd ${_pkgbase}-${pkgver}
diff --git a/poppler-subpixel.patch b/poppler-subpixel.patch
index c92bf57f4176..cfec81bb4a80 100644
--- a/poppler-subpixel.patch
+++ b/poppler-subpixel.patch
@@ -1,5 +1,5 @@
diff --git a/glib/demo/render.c b/glib/demo/render.c
-index 78d24bb..b05d8bf 100644
+index 78d24bb..d482ceb 100644
--- a/glib/demo/render.c
+++ b/glib/demo/render.c
@@ -82,12 +82,14 @@ pgd_render_start (GtkButton *button,
@@ -17,19 +17,18 @@ index 78d24bb..b05d8bf 100644
page = poppler_document_get_page (demo->doc, demo->page);
if (!page)
-@@ -116,6 +118,22 @@ pgd_render_start (GtkButton *button,
+@@ -116,6 +118,21 @@ pgd_render_start (GtkButton *button,
width, height);
cr = cairo_create (demo->surface);
+ fo = cairo_font_options_create ();
+ cairo_get_font_options (cr, fo);
-+ cairo_font_options_set_hint_style (fo, CAIRO_HINT_STYLE_SLIGHT);
+
+ subpixel_rendering = poppler_page_support_subpixel_rendering (page);
++ printf("subpixel_rendering %d\n", subpixel_rendering);
+ if (subpixel_rendering) {
+ cairo_set_source_rgb (cr, 1., 1., 1.);
+ cairo_paint (cr);
-+
+ cairo_font_options_set_antialias (fo, CAIRO_ANTIALIAS_SUBPIXEL);
+ cairo_font_options_set_subpixel_order (fo, CAIRO_SUBPIXEL_ORDER_RGB);
+ }
@@ -40,7 +39,7 @@ index 78d24bb..b05d8bf 100644
cairo_save (cr);
switch (demo->rotate) {
case 90:
-@@ -143,9 +161,11 @@ pgd_render_start (GtkButton *button,
+@@ -143,9 +160,11 @@ pgd_render_start (GtkButton *button,
poppler_page_render (page, cr);
cairo_restore (cr);
@@ -85,35 +84,58 @@ index fdbfd38..0f02a3a 100644
/* A rectangle on a page, with coordinates in PDF points. */
#define POPPLER_TYPE_RECTANGLE (poppler_rectangle_get_type ())
-diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
-index 1d611b5..f4ffb08 100644
---- a/poppler/CairoFontEngine.cc
-+++ b/poppler/CairoFontEngine.cc
-@@ -189,7 +189,6 @@ _ft_new_face_uncached (FT_Library lib,
+diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
+index b0987b3..23ab490 100644
+--- a/poppler/CairoOutputDev.cc
++++ b/poppler/CairoOutputDev.cc
+@@ -1402,6 +1402,7 @@ void CairoOutputDev::drawChar(GfxState *state, double x, double y,
+ void CairoOutputDev::endString(GfxState *state)
+ {
+ int render;
++ GfxFontType fontType;
+
+ if (!currentFont)
+ return;
+@@ -1419,6 +1420,18 @@ void CairoOutputDev::endString(GfxState *state)
+ goto finish;
}
- 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,
-@@ -358,7 +357,6 @@ _ft_new_face (FT_Library lib,
- _ft_open_faces = l;
++ fontType = state->getFont()->getType();
++ // Do not enable subpixel rendering for type3 font
++ // For some reason it does not work
++ if (fontType == fontType3) {
++ cairo_save(cairo);
++ cairo_font_options_t *fo;
++ fo = cairo_font_options_create ();
++ cairo_get_font_options (cairo, fo);
++ cairo_font_options_set_antialias (fo, CAIRO_ANTIALIAS_DEFAULT);
++ cairo_set_font_options (cairo, fo);
++ }
++
+ if (!(render & 1)) {
+ LOG (printf ("fill string\n"));
+ cairo_set_source (cairo, fill_pattern);
+@@ -1469,6 +1482,10 @@ void CairoOutputDev::endString(GfxState *state)
+ }
- 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,
+ finish:
++ // pair with the previous cairo_save to disable subpixel rendering for type3 fonts
++ if (fontType == fontType3) {
++ cairo_restore(cairo);
++ }
+ gfree (glyphs);
+ glyphs = NULL;
+ if (use_show_text_glyphs) {
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
-index 577c482..7d66588 100644
+index 7d748b9..5caf01b 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
-@@ -4684,6 +4684,60 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
+@@ -4727,6 +4727,62 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
error(errSyntaxError, getPos(), "Bad image parameters");
}
+GBool Gfx::checkNormalBlendModeOnly(Object *str) {
++ printf("check blender mode start\n");
+ char *cmd;
+ Object obj;
+ Object args[maxArgs];
@@ -135,6 +157,7 @@ index 577c482..7d66588 100644
+ if (res->lookupGState(args[0].getName(), &obj1)) {
+ if (!obj1.dictLookup("BM", &obj2)->isNull()) {
+ if (state->parseBlendMode(&obj2, &mode)) {
++ printf("check blend mode: %d\n", mode);
+ onlyNormalBlendMode &= (mode == gfxBlendNormal);
+ }
+ }