Summary: | [Gtk] Uneven glyph spacing with subpixel antialiasing | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Sylvain Pasche <sylvain.pasche> | ||||||||||
Component: | Text | Assignee: | Nobody <webkit-unassigned> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | alp | ||||||||||
Priority: | P2 | Keywords: | Gtk | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | PC | ||||||||||||
OS: | Linux | ||||||||||||
URL: | data:text/html,<div style="font-family: verdana;">simply participating</div> | ||||||||||||
Attachments: |
|
Description
Sylvain Pasche
2008-01-02 17:33:21 PST
Created attachment 18246 [details]
screenshot showing verdana font
On the screenshot, you can see that the "i" character is no centered between the "s" and the "m" for instance. The gap between the "p" and the "l" seems to large too. Ok, this is not specific to Verdana font (but most visible with it at 14px). Happens only when you have subpixel smoothing active (under GNOME in System > Preferences > Appearance > Fonts > Subpixel smoothing (LCD) ). Created attachment 18261 [details]
comparison webkit gecko
Testcase: data:text/html,<div style="font-family: verdana;font-size: 14px">simply participating</div>
Webkit on top, gecko 1.9 on bottom
Created attachment 18262 [details]
demonstrative hack (not for checkin)
The attached patch fixes the issue (but will break in other situations).
Some explanations: The scaled font needs a font_options_t object when it is created in FontPlatformData::FontPlatformData. The parameter in this font_options_t object should match the settings of the destination surface, like antialiasing, hinting and others. For retrieving these settings, we need a surface (which can be obtained from the cairo_t object). The trouble is that we do not have the cairo_t object available yet when the scaled font is created. If we had it at this time, we could build the font_options object like: cairo_surface_t* target = cairo_get_target(cr); cairo_font_options_t* options = cairo_font_options_create(); cairo_surface_get_font_options(target, options); ... cairo_font_options_destroy(options); Created attachment 18401 [details]
Using font options from gdk screen
I found this gdk method to fetch the font option from a gdk screen.
Comment on attachment 18401 [details]
Using font options from gdk screen
r=me
I'm making two small changes before landing this:
1) GTK_CHECK_VERSION(2,10,0)
2) null-check for gdk_screen_get_default() so we don't break headless operation.
|