Bug 40458

Summary: Font rendering with CAIRO_ANTIALIAS_GRAY fails to produce grayscale antialiasing
Product: cairo Reporter: Ingo Ruhnke <grumbel>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: freedesktop
Version: 1.10.2   
Hardware: Other   
OS: All   
See Also: https://launchpad.net/bugs/703191
Whiteboard:
i915 platform: i915 features:
Attachments: Demo of the problem
Patch for grayscale anti-aliasing issue

Description Ingo Ruhnke 2011-08-29 06:29:13 UTC
Trying to render a font with simple grayscale anti-aliasing, like:

  cairo_font_options_t* fopts = cairo_font_options_create();
  cairo_font_options_set_subpixel_order(fopts, CAIRO_SUBPIXEL_ORDER_DEFAULT);
  cairo_font_options_set_antialias(fopts, CAIRO_ANTIALIAS_GRAY);
  cairo_set_font_options(cr, fopts);

fails to work. The options are ignored and instead the resulting rendering will produce results identical with CAIRO_ANTIALIAS_SUBPIXEL with colored pixel around the edge instead of grayscale ones.

A simple example program reproducing the problem is attached.
Comment 1 Uli Schlachter 2011-08-29 07:52:22 UTC
(In reply to comment #0)
> A simple example program reproducing the problem is attached.

Are you sure about that? Where?
Comment 2 Ingo Ruhnke 2011-08-29 08:07:17 UTC
Created attachment 50660 [details]
Demo of the problem

Yes, reasonable sure about that. The problem originally showed up in Gnome:

https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/703191

But seems to have its cause in Cairo.
Comment 3 Behdad Esfahbod 2011-08-29 08:11:58 UTC
Most probably you have fontconfig config files that override the hinting unconditionally.   That's what's shipped with fontconfig but disabled by default.  It's a bug to ship those (as opposed to config that only sets antialiasiing if not explicitly set), and cairo can force it if user asked, but that wouldn't work nice with fontconfig.
Comment 4 Ingo Ruhnke 2011-08-29 08:14:39 UTC
Created attachment 50661 [details] [review]
Patch for grayscale anti-aliasing issue

Attached is a patch for the issue.
Comment 5 GitLab Migration User 2018-08-25 13:41:03 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/135.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.