Bug 6136

Summary: WebKit should support automatic kerning
Product: WebKit Reporter: mitz
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: alex, bdakin, emacemac7, eric, gavin.sharp, georg.seifert, ian, illenberger, jdaggett, kai, phiw2, pkasting, rik, timothy
Priority: P3 Keywords: InRadar
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Patch
hyatt: review+
Example showing wrong ligatures being created when soft hyphens are used
none
Example showing weird editing and selection behavior if ligatures are rendered none

mitz
Reported 2005-12-18 10:17:33 PST
The CG code path in WebTextRenderer does not perform automatic kerning.
Attachments
Patch (210.42 KB, patch)
2009-09-30 15:37 PDT, Beth Dakin
hyatt: review+
Example showing wrong ligatures being created when soft hyphens are used (452 bytes, text/html)
2009-10-02 00:45 PDT, Frank Illenberger
no flags
Example showing weird editing and selection behavior if ligatures are rendered (322 bytes, text/html)
2009-10-02 00:52 PDT, Frank Illenberger
no flags
mitz
Comment 1 2008-03-20 12:00:22 PDT
*** Bug 17970 has been marked as a duplicate of this bug. ***
Mark Rowe (bdash)
Comment 2 2008-03-20 15:03:52 PDT
Dave Hyatt
Comment 3 2008-04-09 16:05:14 PDT
This is disabled on purpose for performance reasons. In order to enable it, we'll have to find a way to kern without compromising rendering performance.
Frank Illenberger
Comment 4 2008-09-26 23:10:42 PDT
Please consider making automatic kerning at least an opt-in feature. Pehaps by a custom -webkit-CSS attribute. Firefox3 supports automatic kerning. For a nice comparison with Firefox check out: http://opentype.info/blog/2008/06/14/kerning-and-opentype-features-in-firefox-3/
Timothy Hatcher
Comment 5 2008-10-17 09:25:53 PDT
We should consider kerning text runs that are greater than some large font size. So headlines and things are kerned. That might be acceptable performance wise.
mitz
Comment 6 2008-10-17 09:32:17 PDT
Setting a font size threshold may be problematic for things that smoothly animate size.
Frank Illenberger
Comment 7 2008-10-17 09:34:13 PDT
Small text should also be kerned during printing. But printing is most probably not performance critical.
Beth Dakin
Comment 8 2009-09-30 15:37:58 PDT
Created attachment 40405 [details] Patch Here is a patch that implements the SVG text-rendering property as a regular HTML CSS property, just like in Firefox: https://developer.mozilla.org/en/CSS/text-rendering In this implmentation: auto = optimizeSpeed = what we normally when the value's not set optimizeLegibility = geometricPrecision = ligatures + kerning Please note that this builds on Windows but doesn't do anything yet. I filed a Radar bug to track the Windows portion, and perhaps I will file a new bug here to track it too, or just keep this bug open to accept that patch shortly too.
Sam Weinig
Comment 9 2009-09-30 15:55:05 PDT
Comment on attachment 40405 [details] Patch > Index: WebCore/ChangeLog > =================================================================== > --- WebCore/ChangeLog (revision 48948) > +++ WebCore/ChangeLog (working copy) > @@ -1,3 +1,90 @@ > +2009-09-30 Beth Dakin <bdakin@apple.com> > + > + Reviewed by NOBODY (OOPS!). > + > + Fix for <rdar://problem/6934421> Support CSS for Text Kerning and > + ligature > + -and corresponding- > + https://bugs.webkit.org/show_bug.cgi?id=6136 > + > + This patch makes the SVG CSS property text-rendering work with any > + HTML, much like it does in Firefox. It accepts four possible input > + values: auto, optimizeSpee, optimizeLegibility, and Typo "optimizeSpee". You also omit inherit, not sure if that is important. I think Dan should review the text stuff.
Dave Hyatt
Comment 10 2009-10-01 11:14:08 PDT
Comment on attachment 40405 [details] Patch The .vcproj file seems to have unintentional additional changes in it. Merge conflict issue maybe? r=me
Beth Dakin
Comment 11 2009-10-01 12:20:28 PDT
Thanks guys! I committed this with revision 48989.
Frank Illenberger
Comment 12 2009-10-02 00:44:06 PDT
(In reply to comment #11) > Thanks guys! I committed this with revision 48989. Thanks for the nice feature. I tested it right away but found that ligatures are prevented by soft hyphens. Its even worse if a font contains contextual forms. The ligature engine believes to be at a word boundary when seeing the soft hyphen and renders the form for e.g. a word end in the middle of the word. I attached an example file showing the problems.
Frank Illenberger
Comment 13 2009-10-02 00:45:10 PDT
Created attachment 40498 [details] Example showing wrong ligatures being created when soft hyphens are used
Frank Illenberger
Comment 14 2009-10-02 00:52:17 PDT
Created attachment 40499 [details] Example showing weird editing and selection behavior if ligatures are rendered
Frank Illenberger
Comment 15 2009-10-02 00:53:10 PDT
I added another example file which shows that it is nearly impossible to select or edit text which contains rendered ligatures.
Timothy Hatcher
Comment 16 2009-10-02 11:05:26 PDT
Please file new bugs for the issues you find. This bug should be closed now, since a change has been made.
Peter Kasting
Comment 17 2011-01-03 15:31:10 PST
FWIW, bug 41363 is about making "auto" do the nice-but-slow path on fonts 20px and larger. Maybe some people CCed here would like to add themselves there or implement that. Another possibility, from https://bugzilla.mozilla.org/show_bug.cgi?id=595688 : apparently Firefox 4+ no longer has a "slow path" because it uses Harfbuzz to do shaping on all platforms, and that was fast enough that they could completely switch over without regressing perf. Perhaps this makes sense for WebKit, or for particular ports of WebKit, as well; I don't know enough to file a bug, though.
Note You need to log in before you can comment on or make changes to this bug.