RESOLVED FIXED 16715
[Gtk] Uneven glyph spacing with subpixel antialiasing
https://bugs.webkit.org/show_bug.cgi?id=16715
Summary [Gtk] Uneven glyph spacing with subpixel antialiasing
Sylvain Pasche
Reported 2008-01-02 17:33:21 PST
I saw this initially on the gnome.org website when using the Gtk port. I have installed the msttcorefonts on the system, so I guess the Verdana.ttf font from there is used. I'll attach a screenshot.
Attachments
screenshot showing verdana font (2.24 KB, image/png)
2008-01-02 17:33 PST, Sylvain Pasche
no flags
comparison webkit gecko (5.92 KB, image/png)
2008-01-04 04:08 PST, Sylvain Pasche
no flags
demonstrative hack (not for checkin) (828 bytes, patch)
2008-01-04 04:23 PST, Sylvain Pasche
no flags
Using font options from gdk screen (1.99 KB, patch)
2008-01-11 17:18 PST, Sylvain Pasche
alp: review+
Sylvain Pasche
Comment 1 2008-01-02 17:33:54 PST
Created attachment 18246 [details] screenshot showing verdana font
Sylvain Pasche
Comment 2 2008-01-02 17:35:39 PST
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.
Sylvain Pasche
Comment 3 2008-01-04 03:32:24 PST
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) ).
Sylvain Pasche
Comment 4 2008-01-04 04:08:23 PST
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
Sylvain Pasche
Comment 5 2008-01-04 04:23:42 PST
Created attachment 18262 [details] demonstrative hack (not for checkin) The attached patch fixes the issue (but will break in other situations).
Sylvain Pasche
Comment 6 2008-01-04 04:40:03 PST
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);
Sylvain Pasche
Comment 7 2008-01-11 17:18:35 PST
Created attachment 18401 [details] Using font options from gdk screen I found this gdk method to fetch the font option from a gdk screen.
Alp Toker
Comment 8 2008-01-11 18:20:05 PST
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.
Alp Toker
Comment 9 2008-01-11 18:23:16 PST
Landed in r29426.
Note You need to log in before you can comment on or make changes to this bug.