You are not logged in.

#1 2009-10-17 14:42:30

Octoploid
Member
From: Berlin, Germany
Registered: 2009-10-13
Posts: 64

Subpixel pdf rendering for evince

Here is a simple patch for evince to enable sub-pixel rendering of pdf files.

First you should replace cairo with either aur/cairo-cleartype or aur/cairo-glitz-cleartype,
otherwise you will get ugly color fringes on your glyphs.

Then unpack the source with makepkg -o.

Edit the following patch. (e.g. some people might want  CAIRO_SUBPIXEL_ORDER_VRGB
intead of  CAIRO_SUBPIXEL_ORDER_RGB. You can also choose different hinting styles:
CAIRO_HINT_STYLE_SLIGHT,  CAIRO_HINT_STYLE_FULL or CAIRO_HINT_STYLE_NONE.

--- ev-poppler.cc    2009-09-21 15:12:26.000000000 +0200
+++ /home/markus/tmp/ev-poppler.cc    2009-10-17 14:04:21.000000000 +0200
@@ -487,10 +487,25 @@
 
 #ifdef HAVE_POPPLER_PAGE_RENDER
     cairo_t *cr;
+    cairo_font_options_t *options;
+
 
     surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                           width, height);
+    memset (cairo_image_surface_get_data (surface), 0xff,
+                cairo_image_surface_get_height (surface) *
+                cairo_image_surface_get_stride (surface));
+
+    options = cairo_font_options_create ();
+        cairo_surface_get_font_options (surface, options);
+        cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_SUBPIXEL);
+        cairo_font_options_set_subpixel_order (options, CAIRO_SUBPIXEL_ORDER_RGB);
+        cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
+
     cr = cairo_create (surface);
+    cairo_set_font_options (cr, options);
+        cairo_font_options_destroy (options);
+
 
     switch (rc->rotation) {
             case 90:

then hand-apply this patch in abs/extra/evince/src/evince-2.28.0/backend/pdf
and finally build the package with makepkg -e.

Offline

Board footer

Powered by FluxBB