Bug 41599

Summary: optimizeLegibility doesn't play nice with fonts that do not have a space glyph
Product: WebKit Reporter: maarten.vancoile
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, mitz, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.6   
Attachments:
Description Flags
Account for font fallback in initializing wordTrailingSpaceWidth sam: review+

maarten.vancoile
Reported 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; }
Attachments
Account for font fallback in initializing wordTrailingSpaceWidth (1.73 KB, patch)
2010-07-05 10:35 PDT, mitz
sam: review+
mitz
Comment 1 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())
mitz
Comment 2 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.
mitz
Comment 3 2010-07-05 10:35:44 PDT
Created attachment 60554 [details] Account for font fallback in initializing wordTrailingSpaceWidth
mitz
Comment 4 2010-07-05 17:11:46 PDT
WebKit Review Bot
Comment 5 2010-07-06 01:47:07 PDT
http://trac.webkit.org/changeset/62510 might have broken Leopard Intel Release (Tests)
Note You need to log in before you can comment on or make changes to this bug.