Re: [poppler] qt4: arthur backend: Page.renderToPainter renders very wide lines

2011-03-23 Thread Wilbert Berendsen

Op Di, 22 maart, 2011 20:22, schreef Albert Astals Cid:
 A Dimarts, 22 de març de 2011, Wilbert Berendsen va escriure:
 Hi all,

 Hi

 I am using poppler-qt4 via a Python binding[1] (created by me) and try
 to use the arthur backend and renderToPainter (esp. to print a
 Poppler.Document.)

 The Arthur backend is not ready for prime time (and not sure it'll ever
be),
 so if you want to use it i think you'll have to fix the bugs yourself
(if this
 is the only bug you are hitting it should not really be much difficult to
 fix probably).


Thanks for you answer (and sorry for the doublepost, I used the wrong
address the first time).

With best regards,
Wilbert Berendsen

-- 
http://www.wilbertberendsen.nl/

___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Qt4 Arthur

2009-05-21 Thread Paul Gideon Dann
On Wednesday 20 May 2009 23:25:01 Albert Astals Cid wrote:
 Can i have that pdf for local comparison?

Sorry, I'm afraid it's proprietary material.  (Probably shouldn't have used it 
for comparison; oh well!)  It's my copy of Agile Web Development with Rails.  
I was reading it when I decided I had to get subpixel rendering working :)

However, you should be able to see the results in any PDF.

I've done further work on my patchset since my last e-mail.  After some 
hunting, I discovered how to enable FreeType's default LCD filter (FIR5) in 
the Cairo backend.  (By default Cairo uses the legacy version, hence the 
colour fringing.)  This function (in patch 4) relies on the LCD filtering 
patch for Cairo (http://aur.archlinux.org/packages/cairo-lcd/cairo-lcd/lcd-
filter.patch).

I've also added a further patch that enables slight hinting in the Cairo 
backend.  This has been suggested elsewhere, and does seem to sharpen text up 
a little.

Comparison of FIR5-filtered text with no hinting vs slight hinting:
No hinting: http://snurl.com/ihakt
Slight hinting: http://snurl.com/ihalk

Apologies for re-attaching the whole patchset -- I figured it would be cleaner 
than trying to track changes I made in each patch.

Most of this patchset is of course a quick hack to achieve the desired effect, 
but I do hope that the Cairo backend for Qt4 (patches 1+2) and the slight 
hinting (patch 5) will be considered for merging.  The rest will hopefully be 
helpful to anyone else wanting beautiful fonts in Okular right now.

Paul
From de4279b0a174a7c1b5e2a6974488d45aa5953842 Mon Sep 17 00:00:00 2001
From: Paul Gideon Dann pdgid...@gmail.com
Date: Wed, 20 May 2009 14:10:16 +0100
Subject: [PATCH 2/5] Cairo output can now be built (for Qt4) without building Glib backend

---
 CMakeLists.txt |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03085a5..4018982 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,9 +48,9 @@ endif(JPEG_FOUND)
 macro_optional_find_package(Qt3)
 macro_optional_find_package(Qt4)
 macro_optional_find_package(GTK)
+macro_optional_find_package(Cairo)
+set(HAVE_CAIRO ${CAIRO_FOUND})
 if(GLIB_FOUND)
-  macro_optional_find_package(Cairo)
-  set(HAVE_CAIRO ${CAIRO_FOUND})
   set(POPPLER_WITH_GDK ${GDK_FOUND})
   if(CAIRO_FOUND)
 set(CAIRO_REQ cairo)
-- 
1.6.3.1

From 899e96825df616511a8937f6012e112c7cebb379 Mon Sep 17 00:00:00 2001
From: Paul Gideon Dann pdgid...@gmail.com
Date: Thu, 21 May 2009 10:55:49 +0100
Subject: [PATCH 5/5] Enabling slight hinting in Cairo Backend

Originally suggested at:
http://bugs.freedesktop.org/show_bug.cgi?id=3307#c20
---
 poppler/CairoFontEngine.cc |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index a4edd12..8bf7581 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -123,7 +123,7 @@ CairoFont::getSubstitutionCorrection(GfxFont *gfxFont)
 	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_style(options, CAIRO_HINT_STYLE_SLIGHT);
 	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);
 
@@ -178,7 +178,7 @@ _ft_new_face_uncached (FT_Library lib,
 return gFalse;
 
   font_face = cairo_ft_font_face_create_for_ft_face (face,
-			  FT_LOAD_NO_HINTING |
+			  FT_LOAD_TARGET_LIGHT |
 			  FT_LOAD_NO_BITMAP);
   if (cairo_font_face_set_user_data (font_face,
  _ft_cairo_key,
@@ -325,7 +325,7 @@ _ft_new_face (FT_Library lib,
   _ft_open_faces = l;
 
   l-font_face = cairo_ft_font_face_create_for_ft_face (tmpl.face,
-			  FT_LOAD_NO_HINTING |
+			  FT_LOAD_TARGET_LIGHT |
 			  FT_LOAD_NO_BITMAP);
   if (cairo_font_face_set_user_data (l-font_face,
  _ft_cairo_key,
-- 
1.6.3.1

From 23ef6b1d1e130a5ef74335f5d1a10f99459e3051 Mon Sep 17 00:00:00 2001
From: Paul Gideon Dann pdgid...@gmail.com
Date: Wed, 20 May 2009 13:17:29 +0100
Subject: [PATCH 3/5] Setting default QT4 backend to Cairo

---
 qt4/src/poppler-private.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index bd89008..545935d 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -95,7 +95,7 @@ namespace Poppler {
 	void init(GooString *ownerPassword, GooString *userPassword)
 	{
 		m_fontInfoIterator = 0;
-		m_backend = Document::SplashBackend;
+		m_backend = Document::CairoBackend;
 		m_outputDev = 0;
 		paperColor = Qt::white;
 		m_hints = 0;
-- 
1.6.3.1

From c04f338133005f6b52e53e797034ddbe59091d6a Mon Sep 17 00:00:00 2001
From: Paul Gideon Dann pdgid...@gmail.com
Date: Wed, 20 May 2009 11:42:28 +0100
Subject: [PATCH 1/5] Basic Cairo 

Re: [poppler] Qt4 Arthur

2009-05-20 Thread Albert Astals Cid
A Dimecres, 20 de maig de 2009, Paul Gideon Dann va escriure:
 On Saturday 16 May 2009 13:27:46 Albert Astals Cid wrote:
  Splash uses FreeType for fonts so if freetype has subpixel rendering (i
  guess you only want subpixel rendering for fonts?) you should be able to
  get it with some small patch here and there.

 I tried, and it's unfortunately not trivial.  Splash simply assumes that
 text will always be monochrome.  I was able to get subpixel rendering
 working, but at the cost of text colour and the alpha channel, so text is
 always black and looks ugly on anything except white.  Maybe with some more
 work it would be possible (a few core methods would need reworking), but I
 found the Splash code difficult to work with, so I gave up on that
 approach.

It is, noone is going to use Qt4 frontend with Cairo, politics.
  
   Mmm, well in the long term it's not ideal, but there are quite a few of
   us out there that are pragmatists.  Most people will have Cairo
   installed for Firefox anyway.  I'm guessing it shouldn't be too hard to
   do, right? I'll look into it further if I have the time.

 I decided to try this approach anyway, and the results are good.  So that's
 one person at least who will be using the Qt4 frontend with Cairo :)  My
 patchset is attached for people to do with as they wish.  I'm afraid I've
 only modified the CMakeFiles, so this will almost certainly break an
 autotools build.

 Here is a quick comparison:
 Before (Splash): http://snurl.com/if1b1
 After (Cairo + Subpixel Rendering): http://snurl.com/if1c2

 The lcd filtering could do with some work -- there is some nasty colour
 fringing.  For me though, this is a step in the right direction.

Can i have that pdf for local comparison?

Albert


 Paul


___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Qt4 Arthur

2009-05-16 Thread Paul Gideon Dann
On Friday 15 May 2009 23:19:20 Albert Astals Cid wrote:
  The
  main reason I ask is that I'd really like to see subpixel rendering in
  Okular.  As as far as I can tell, that's not going to be possible with
  the Splash backend.

 Why it's not going to be possible and why it would be possible with Arthur?

Is it possible?  I haven't been able to get subpixel rendering with Splash, 
but of course I could be missing something obvious...  I have beautiful 
subpixel rendering everywhere else via Xft and Cairo.

I figured Arthur would bring the same subpixel rendering I get everywhere else 
in KDE via Xft.

  If there's no chance of the Arthur backend being finished any time soon,
  I wonder would it be a stupid idea to write a Qt4 wrapper for the Cairo
  backend?

 It is, noone is going to use Qt4 frontend with Cairo, politics.

Mmm, well in the long term it's not ideal, but there are quite a few of us out 
there that are pragmatists.  Most people will have Cairo installed for Firefox 
anyway.  I'm guessing it shouldn't be too hard to do, right?  I'll look into 
it further if I have the time.

Paul
___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Qt4 Arthur

2009-05-16 Thread Albert Astals Cid
A Dissabte, 16 de maig de 2009, Paul Gideon Dann va escriure:
 On Friday 15 May 2009 23:19:20 Albert Astals Cid wrote:
   The
   main reason I ask is that I'd really like to see subpixel rendering in
   Okular.  As as far as I can tell, that's not going to be possible with
   the Splash backend.
 
  Why it's not going to be possible and why it would be possible with
  Arthur?

 Is it possible?  I haven't been able to get subpixel rendering with Splash,
 but of course I could be missing something obvious... 

Splash uses FreeType for fonts so if freetype has subpixel rendering (i guess 
you only want subpixel rendering for fonts?) you should be able to get it with 
some small patch here and there.

Albert

 I have beautiful
 subpixel rendering everywhere else via Xft and Cairo.

 I figured Arthur would bring the same subpixel rendering I get everywhere
 else in KDE via Xft.

   If there's no chance of the Arthur backend being finished any time
   soon, I wonder would it be a stupid idea to write a Qt4 wrapper for the
   Cairo backend?
 
  It is, noone is going to use Qt4 frontend with Cairo, politics.

 Mmm, well in the long term it's not ideal, but there are quite a few of us
 out there that are pragmatists.  Most people will have Cairo installed for
 Firefox anyway.  I'm guessing it shouldn't be too hard to do, right?  I'll
 look into it further if I have the time.

 Paul


___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Qt4 Arthur

2009-05-15 Thread Albert Astals Cid
A Divendres, 15 de maig de 2009, Paul Gideon Dann va escriure:
 Hello there,

 I'm wondering if the Arthur backend is currently under development?

No, help is more than welcome.

 The
 main reason I ask is that I'd really like to see subpixel rendering in
 Okular.  As as far as I can tell, that's not going to be possible with the
 Splash backend.

Why it's not going to be possible and why it would be possible with Arthur?

 If there's no chance of the Arthur backend being finished any time soon, I
 wonder would it be a stupid idea to write a Qt4 wrapper for the Cairo
 backend?

It is, noone is going to use Qt4 frontend with Cairo, politics.

 I believe Cairo is being used by Evince via the Glib bindings, but
 it's not available for Qt4.

Right.

Albert


 Thanks,
 Paul


___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler