Presently, and as noted in comment #15, poppler-glib appears to use font options from the surface it was given by the caller. It is rather convenient, as it allows to implement management of subpixel rendering from the application with minimal effort. As an example, here's a patch for evince pdf backend that hard-codes horizontal rgb with slight hinting:
So I think poppler is already doing its job with regards to subpixel rendering.
However, I'd like to second the point from comment #17: I believe it is better to use slight hinting instead of disabling hinting altogether. What about something along these lines:
Presently, and as noted in comment #15, poppler-glib appears to use font options from the surface it was given by the caller. It is rather convenient, as it allows to implement management of subpixel rendering from the application with minimal effort. As an example, here's a patch for evince pdf backend that hard-codes horizontal rgb with slight hinting:
diff -pur evince- 2.24.2- r1/work/ evince- 2.24.2/ backend/ pdf/ev- poppler. cc evince- 2.24.2- r2/work/ evince- 2.24.2/ backend/ pdf/ev- poppler. cc 2.24.2- r1/work/ evince- 2.24.2/ backend/ pdf/ev- poppler. cc 2008-11-24 22:09:30.000000000 +0300 2.24.2- r2/work/ evince- 2.24.2/ backend/ pdf/ev- poppler. cc 2009-01-19 01:15:15.048150478 +0300
--- evince-
+++ evince-
@@ -451,14 +451,22 @@ pdf_page_render (PopplerPage *page,
#ifdef HAVE_POPPLER_ PAGE_RENDER options_ t *options;
cairo_t *cr;
+ cairo_font_
surface = cairo_image_ surface_ create (CAIRO_ FORMAT_ RGB24,
width, height); image_surface_ get_data (surface), 0xff,
cairo_ image_surface_ get_height (surface) *
cairo_ image_surface_ get_stride (surface)); options_ create (); get_font_ options (surface, options); options_ set_antialias (options, CAIRO_ANTIALIAS _SUBPIXEL) ; options_ set_subpixel_ order (options, CAIRO_SUBPIXEL_ ORDER_RGB) ; options_ set_hint_ style (options, CAIRO_HINT_ STYLE_SLIGHT) ;
memset (cairo_
+ options = cairo_font_
+ cairo_surface_
+ cairo_font_
+ cairo_font_
+ cairo_font_
cr = cairo_create (surface); font_options (cr, options); options_ destroy (options);
case 90:
cairo_ translate (cr, width, 0);
+ cairo_set_
+ cairo_font_
switch (rc->rotation) {
So I think poppler is already doing its job with regards to subpixel rendering.
However, I'd like to second the point from comment #17: I believe it is better to use slight hinting instead of disabling hinting altogether. What about something along these lines:
diff -pur poppler- 0.10.0/ poppler/ CairoFontEngine .cc poppler- 0.10.0- r1/poppler/ CairoFontEngine .cc 0.10.0/ poppler/ CairoFontEngine .cc 2008-09-22 22:25:45.000000000 +0400 0.10.0- r1/poppler/ CairoFontEngine .cc 2008-10-31 14:10:27.000000000 +0300 face_uncached (FT_Library lib,
--- poppler-
+++ poppler-
@@ -80,7 +80,7 @@ _ft_new_
return gFalse;
font_face = cairo_ft_ font_face_ create_ for_ft_ face (face, TARGET_ LIGHT |
FT_LOAD_ NO_BITMAP) ; font_face_ set_user_ data (font_face,
&_ft_ cairo_key,
- FT_LOAD_NO_HINTING |
+ FT_LOAD_
if (cairo_
@@ -214,7 +214,7 @@ _ft_new_face (FT_Library lib,
_ft_open_faces = l;
l->font_face = cairo_ft_ font_face_ create_ for_ft_ face (tmpl.face, TARGET_ LIGHT |
FT_LOAD_ NO_BITMAP) ; font_face_ set_user_ data (l->font_face,
&_ft_ cairo_key, :getSubstitutio nCorrection( Gfx
cairo_ matrix_ t m;
cairo_ matrix_ init_identity( &m);
cairo_ font_options_ t *options = cairo_font_ options_ create( ); options_ set_hint_ style(options, CAIRO_HINT_ STYLE_NONE) ; 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);
- FT_LOAD_NO_HINTING |
+ FT_LOAD_
if (cairo_
@@ -481,7 +481,7 @@ CairoFont:
- cairo_font_
+ cairo_font_