Created
August 16, 2013 17:25
-
-
Save vonavi/6251794 to your computer and use it in GitHub Desktop.
Force subpixel rendering for Evince 2.32.0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- backend/pdf/ev-poppler.cc 2010-09-27 19:54:34.000000000 +0300 | |
+++ backend/pdf/ev-poppler-patched.cc 2013-08-16 20:08:43.000000000 +0300 | |
@@ -342,6 +342,23 @@ | |
return label; | |
} | |
+/* For some reason, cairo doesn't put this in the public header. */ | |
+typedef enum _cairo_lcd_filter { | |
+ CAIRO_LCD_FILTER_DEFAULT, | |
+ CAIRO_LCD_FILTER_NONE, | |
+ CAIRO_LCD_FILTER_INTRA_PIXEL, | |
+ CAIRO_LCD_FILTER_FIR3, | |
+ CAIRO_LCD_FILTER_FIR5 | |
+} cairo_lcd_filter_t; | |
+ | |
+struct _cairo_font_options { | |
+ cairo_antialias_t antialias; | |
+ cairo_subpixel_order_t subpixel_order; | |
+ cairo_lcd_filter_t lcd_filter; | |
+ cairo_hint_style_t hint_style; | |
+ cairo_hint_metrics_t hint_metrics; | |
+}; | |
+ | |
static cairo_surface_t * | |
pdf_page_render (PopplerPage *page, | |
gint width, | |
@@ -350,10 +367,24 @@ | |
{ | |
cairo_surface_t *surface; | |
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_SLIGHT); | |
+ options->lcd_filter = CAIRO_LCD_FILTER_FIR5; | |
+ | |
cr = cairo_create (surface); | |
+ cairo_set_font_options (cr, options); | |
+ cairo_font_options_destroy (options); | |
switch (rc->rotation) { | |
case 90: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The corresponding patch for Evince-3.14.2 is as follows.