Bug 6136 - WebKit should support automatic kerning
Summary: WebKit should support automatic kerning
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P3 Enhancement
Assignee: Nobody
URL:
Keywords: InRadar
: 17970 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-18 10:17 PST by mitz
Modified: 2011-01-03 15:31 PST (History)
14 users (show)

See Also:


Attachments
Patch (210.42 KB, patch)
2009-09-30 15:37 PDT, Beth Dakin
hyatt: review+
Details | Formatted Diff | Diff
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 Details
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 Details

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2005-12-18 10:17:33 PST
The CG code path in WebTextRenderer does not perform automatic kerning.
Comment 1 mitz 2008-03-20 12:00:22 PDT
*** Bug 17970 has been marked as a duplicate of this bug. ***
Comment 2 Mark Rowe (bdash) 2008-03-20 15:03:52 PDT
<rdar://problem/5811302>
Comment 3 Dave Hyatt 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.

Comment 4 Frank Illenberger 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/
Comment 5 Timothy Hatcher 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.
Comment 6 mitz 2008-10-17 09:32:17 PDT
Setting a font size threshold may be problematic for things that smoothly
animate size.
Comment 7 Frank Illenberger 2008-10-17 09:34:13 PDT
Small text should also be kerned during printing. But printing is most probably not performance critical.
Comment 8 Beth Dakin 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.
Comment 9 Sam Weinig 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.
Comment 10 Dave Hyatt 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
Comment 11 Beth Dakin 2009-10-01 12:20:28 PDT
Thanks guys! I committed this with revision 48989.
Comment 12 Frank Illenberger 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.
Comment 13 Frank Illenberger 2009-10-02 00:45:10 PDT
Created attachment 40498 [details]
Example showing wrong ligatures being created when soft hyphens are used
Comment 14 Frank Illenberger 2009-10-02 00:52:17 PDT
Created attachment 40499 [details]
Example showing weird editing and selection behavior if ligatures are rendered
Comment 15 Frank Illenberger 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.
Comment 16 Timothy Hatcher 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.
Comment 17 Peter Kasting 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.