Bug 41599 - optimizeLegibility doesn't play nice with fonts that do not have a space glyph
Summary: optimizeLegibility doesn't play nice with fonts that do not have a space glyph
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh Intel OS X 10.6
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-05 03:08 PDT by Maarten Van Coile
Modified: 2010-07-06 01:47 PDT (History)
4 users (show)

See Also:


Attachments
Account for font fallback in initializing wordTrailingSpaceWidth (1.73 KB, patch)
2010-07-05 10:35 PDT, mitz
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Van Coile 2010-07-05 03:08:55 PDT
when using "text-rendering: optimizeLegibility;" on a site with @font-face, webkit tends to clip-off part of the text.

Example:
http://www.fontsquirrel.com/fontfacedemo/Alpha-Echo
+ css:
html { text-rendering: optimizeLegibility; }
Comment 1 mitz 2010-07-05 09:20:57 PDT
The problem appears to be this:

ERROR: Font maps SPACE and ZERO WIDTH SPACE to the same glyph. Glyph width will not be overridden.
(WebCore/platform/graphics/SimpleFontData.cpp:164 void WebCore::SimpleFontData::platformGlyphInit())
Comment 2 mitz 2010-07-05 09:43:04 PDT
Further debugging shows that the problem is that the font doesn’t map the SPACE character to a glyph. WebKit substitutes the space glyph from the next font in fallback order, but in some code paths, WebKit uses the cached space width from the font itself, which is bogus. This discrepancy is what’s causing the incorrect line breaking.

Specifically, in RenderBlock::findNextLineBreak(), the initialization of wordTrailingSpaceWidth should probably be changed to measure a space character instead of using the cached space width.
Comment 3 mitz 2010-07-05 10:35:44 PDT
Created attachment 60554 [details]
Account for font fallback in initializing wordTrailingSpaceWidth
Comment 4 mitz 2010-07-05 17:11:46 PDT
Fixed in <http://trac.webkit.org/projects/webkit/changeset/62510>.
Comment 5 WebKit Review Bot 2010-07-06 01:47:07 PDT
http://trac.webkit.org/changeset/62510 might have broken Leopard Intel Release (Tests)