Bug 29618 - Text isn't fully rendered with certain fonts in Win32/Cairo
Summary: Text isn't fully rendered with certain fonts in Win32/Cairo
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-21 14:55 PDT by Marshall Culpepper
Modified: 2009-12-22 21:06 PST (History)
5 users (show)

See Also:


Attachments
Screenshot (18.72 KB, image/png)
2009-09-21 14:55 PDT, Marshall Culpepper
no flags Details
Testcase HTML (985 bytes, text/html)
2009-09-21 15:01 PDT, Marshall Culpepper
no flags Details
Screenshot (69.18 KB, image/png)
2009-09-21 15:01 PDT, Marshall Culpepper
no flags Details
Disable subpixel antialiasing (2.14 KB, patch)
2009-12-21 11:08 PST, Martin Robinson
eric: review+
Details | Formatted Diff | Diff
Patch to Cairo to correct the win32 rendering problem (1.66 KB, patch)
2009-12-22 21:00 PST, Brent Fulgham
no flags Details | Formatted Diff | Diff
Comparison of Cairo rendered glyphs with (right side) and without (left side) the cairo-win32-font patch. (46.29 KB, image/png)
2009-12-22 21:04 PST, Brent Fulgham
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marshall Culpepper 2009-09-21 14:55:28 PDT
Created attachment 39882 [details]
Screenshot

In some cases, at the end of a line of text, it looks like a few pixels are cut off from the rendered text. This appears in both inline text and buttons as far as I've seen. I've attached a sample HTML file which reproduces this behavior as of r48572, as well as a screenshot of what it looks like in both Windows 7 and Windows XP SP2.
Comment 1 Marshall Culpepper 2009-09-21 15:01:07 PDT
Created attachment 39883 [details]
Testcase HTML
Comment 2 Marshall Culpepper 2009-09-21 15:01:36 PDT
Created attachment 39884 [details]
Screenshot
Comment 3 Martin Robinson 2009-12-21 11:08:11 PST
Created attachment 45338 [details]
Disable subpixel antialiasing

The rendering glitches are due to limitations in Cairo (or GDI) with rendering ClearType-quality (subpixel) anti-aliased fonts onto a non-DDB surface. The WebKit in Windows currently uses a DIBSection for the backing store.
Comment 4 WebKit Review Bot 2009-12-21 11:09:56 PST
style-queue ran check-webkit-style on attachment 45338 [details] without any errors.
Comment 5 Eric Seidel (no email) 2009-12-22 16:18:23 PST
OK.
Comment 6 Eric Seidel (no email) 2009-12-22 16:20:26 PST
Comment on attachment 45338 [details]
Disable subpixel antialiasing

Does the WinCairo build have pixel tests?  If so, they'll have to be updated as a result of this change.
Comment 7 Brent Fulgham 2009-12-22 17:18:44 PST
Note that a very similar issue was discussed on the Cairo mailing list over three years ago.  See http://lists.freedesktop.org/archives/cairo/2006-October/008081.html.  While the referenced images seem to be lost in time, the commentary is illuminating:

 "note how the "1" digits that occur as the final character of a string have been partially cut off)"

At the time, the resolution seemed to be to force use of the 24-bit backend for certain operations:

  "If I changed cairo_win32_surface_create() to use RGB24 also when BITSPIXEL is 32, the problem went away, as _cairo_win32_scaled_font_show_glyphs() then uses the "direct" branch. But this seemed like using a awfully large hammer to fix the problem."
Comment 8 Eric Seidel (no email) 2009-12-22 17:36:37 PST
Comment on attachment 45338 [details]
Disable subpixel antialiasing

I'm confused by bfulgam's recent comment.  Removing cq+ for now.
Comment 9 Brent Fulgham 2009-12-22 17:40:33 PST
Thanks, Eric.

I would prefer to hold off committing this change (even though I twisted Martin's arm into posting his patch), because what it does is remove the sub-pixel anti-aliasing resulting in very blocky text.  I'd prefer to review this issue with the Cairo team to see if a 'correct' fix could be identified that would allow us to continue seeing ClearType rendered text, but resolve the trailing pixel problem Martin and Marshall identified.
Comment 10 Brent Fulgham 2009-12-22 17:41:00 PST
BTW, this issue is definitely confirmed.  :-)
Comment 11 Brent Fulgham 2009-12-22 21:00:44 PST
Created attachment 45417 [details]
Patch to Cairo to correct the win32 rendering problem

Note: This is not a WebKit patch, but is shown here to help other implementors.
Comment 12 Brent Fulgham 2009-12-22 21:04:30 PST
Created attachment 45418 [details]
Comparison of Cairo rendered glyphs with (right side) and without (left side) the cairo-win32-font patch.
Comment 13 Brent Fulgham 2009-12-22 21:06:24 PST
I believe removing the sub-pixel antialiasing is ill-advised.  The true problem is in the underlying Cairo library.  Making the recommended change (which is already in use on FireFox) will resolve the problem properly.