|
|
Created:
7 years, 1 month ago by efidler1 Modified:
6 years, 10 months ago CC:
blink-reviews, jamesr, krit, dsinclair, danakj, Rik, Stephen Chennney, pdr., rwlbuis, Dominik Röttsches, behdad Base URL:
https://chromium.googlesource.com/chromium/blink.git@master Visibility:
Public. |
DescriptionImplement TrueType kerning support for HarfBuzz text path.
BUG=41990
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=167463
Patch Set 1 #Patch Set 2 : fix layout tests #
Total comments: 1
Patch Set 3 : fix hb.h header include #Patch Set 4 : don't remove empty line at the end of TextExpectations #
Total comments: 2
Patch Set 5 : separate out just the TrueType kerning support part #Patch Set 6 : rebase patch #Patch Set 7 : rebase again #Patch Set 8 : rebase again #
Messages
Total messages: 47 (0 generated)
ptal
On 2013/11/11 22:20:26, efidler1 wrote: > ptal This change needs new tests as it is adding new functionality.
This is actually already tested by fast/text/font-kerning.html, but currently both the test and the reference do no kerning so it "passes" incorrectly. My patch fixes it. It's also tested by fast/css/text-rendering.html, fast/text/font-variant-ligatures.html, fast/text/atsui-kerning-and-ligatures.html and some others, but the default font used by the layout test driver doesn't always have an "fi" ligature or any kerning info defined. This is actually a similar issue to the fast/text/ipa-tone-letters.html issue where the version of Arial you have matters. I'm not sure what the best fix is, since anything is likely to cause major rebaselining. Maybe we should install a featureful font into LayoutTests/resources and switch all those tests to use it?
On 2013/11/11 22:55:27, efidler1 wrote: > This is actually already tested by fast/text/font-kerning.html, but currently > both the test and the reference do no kerning so it "passes" incorrectly. My > patch fixes it. If so we should fix the test to fail without your patch or the test itself is pointless. > It's also tested by fast/css/text-rendering.html, > fast/text/font-variant-ligatures.html, > fast/text/atsui-kerning-and-ligatures.html and some others, but the default font > used by the layout test driver doesn't always have an "fi" ligature or any > kerning info defined. Ok, could we switch those tests to use a font that has the required kerning info? > This is actually a similar issue to the fast/text/ipa-tone-letters.html issue > where the version of Arial you have matters. > > I'm not sure what the best fix is, since anything is likely to cause major > rebaselining. Maybe we should install a featureful font into > LayoutTests/resources and switch all those tests to use it? Sounds like a good idea!
I've looked around for a font to use, and there doesn't seem to be any obvious choice out of the box. Here's what I suggest: We pick one of the metric-compatible alternatives to Times New Roman, either Tinos from ChromeOS (apache licensed) or Liberation Serif 2.0 from RedHat (OFL licensed), and add a ligature substitution for "f i". We then put this in the LayoutTests and use it as the default font for the test driver (instead of Times New Roman as it is now). We can also ensure there's TrueType kerning and IPA tone letter ligatures. This shouldn't require too much massive rebaselining, since the font is metric-compatible. I can make the font changes, but I want to get some feedback on whether we're open to changing the default font at all.
On 2013/11/12 16:41:59, efidler1 wrote: > I've looked around for a font to use, and there doesn't seem to be any obvious > choice out of the box. Here's what I suggest: > > We pick one of the metric-compatible alternatives to Times New Roman, either > Tinos from ChromeOS (apache licensed) or Liberation Serif 2.0 from RedHat (OFL > licensed), and add a ligature substitution for "f i". We then put this in the > LayoutTests and use it as the default font for the test driver (instead of Times > New Roman as it is now). We can also ensure there's TrueType kerning and IPA > tone letter ligatures. This shouldn't require too much massive rebaselining, > since the font is metric-compatible. > > I can make the font changes, but I want to get some feedback on whether we're > open to changing the default font at all. Changing the default font will require a lot of test rebaselines, perhaps a better option is just using this customized font for a handful of text rendering tests? Apart from that I do like your plan.
Ok, this approach is much less drastic. I didn't previously realize we had DejaVu Sans on Linux, but that does have kerning and ligatures. On Mac, Times and Arial work. Not sure about Windows, Android, ChromeOS, etc. I still can't find an already-installed font that supports the IPA stuff properly, so we'll need something custom there. I just disabled the test for now.
LGTM https://codereview.chromium.org/69513002/diff/100001/Source/core/platform/gra... File Source/core/platform/graphics/harfbuzz/HarfBuzzFace.h (right): https://codereview.chromium.org/69513002/diff/100001/Source/core/platform/gra... Source/core/platform/graphics/harfbuzz/HarfBuzzFace.h:40: #include <hb.h> #include "hb.h"
ok, fixed the include. I'm a bit worried about layout test result changes from fonts with TrueType kerning. Can you trybot this for me?
hmm.. there are some bad regressions there. In particular, lam-alef ligatures are going away because the old Arial in msttcorefonts has a liga for them instead of an rlig, and I'm disabling liga if we're automagically sent to the complex path. Looking into it.
Ok, I think this is arguably a HarfBuzz bug: https://bugs.freedesktop.org/show_bug.cgi?id=71615 We'll see if Behdad agrees.
Some serious misunderstandings in this thread. Details coming in a bit. Doesn'tLGTM.
If you like, I can split the patch into fixing ligatures and kerning in the HarfBuzz complex text path, and separately adding TrueType kerning support.
actually, looks like there's already an issue for the first part: https://code.google.com/p/chromium/issues/detail?id=114235
- I strongly oppose turning liga and kerning off by default. It's bad enough that we have a fast path. Please don't break the complex path! - I'll follow up on the HarfBuzz bug you reported, but my gut feeling is that that's a WONTFIX. - See comments for more info. In particular, you should just have one set of font funcs. https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... File Source/core/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp (right): https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... Source/core/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp:189: return harfBuzzSkiaFontFuncsWithKerning; This is the wrong approach to control kerning. https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... File Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (right): https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp:555: m_features.append(liga); Don't append features that are enabled by default. This pollutes harfbuzz's internal caches unnecessarily.
> - I strongly oppose turning liga and kerning off by default. It's bad enough > that we have a fast path. Please don't break the complex path! There's a longstanding bug that getting promoted to the complex text path is supposed to be undetectable. For example (from https://bugs.webkit.org/show_bug.cgi?id=101009#c31): “If your port renders the same characters *with the same style* differently depending on whether it takes the fast path or the complex path, then your port has a bug in the complex path.” Choice of code path (an implementation detail) affecting appearance is a bug. If a port doesn’t render the AV these two divs the same, then it has a bug: <div>AV e</div> <div>AV è</div> This bug (used to, maybe still does) block https://bugs.webkit.org/show_bug.cgi?id=100794 (see https://bugs.webkit.org/show_bug.cgi?id=113243 and https://chromium.googlesource.com/chromium/blink/+/02e860e42fcc82226a77bf740b...) > - I'll follow up on the HarfBuzz bug you reported, but my gut feeling is that > that's a WONTFIX. Thanks. I think this is worth fixing, since i can have a page today with '-webkit-font-feature-settings: "liga" 0' or "-webkit-font-variant-ligatures: no-common-ligatures" and lam-alef will be broken with that font. > - See comments for more info. In particular, you should just have one set of > font funcs. > > https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... > File Source/core/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp (right): > > https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... > Source/core/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp:189: return > harfBuzzSkiaFontFuncsWithKerning; > This is the wrong approach to control kerning. > Ok. I was worried that adding the truetype kerning callbacks would enable kerning, even with OpenType "kern" disabled, so I make two sets of funcs to allow "all kerning off". Is this a bad assumption? > https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... > File Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (right): > > https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... > Source/core/platform/graphics/harfbuzz/HarfBuzzShaper.cpp:555: > m_features.append(liga); > Don't append features that are enabled by default. This pollutes harfbuzz's > internal caches unnecessarily. Will do.
> > - I strongly oppose turning liga and kerning off by default. It's bad enough > > that we have a fast path. Please don't break the complex path! > > There's a longstanding bug that getting promoted to the complex text path is > supposed to be undetectable. For example (from > https://bugs.webkit.org/show_bug.cgi?id=101009#c31%29: > > “If your port renders the same characters *with the same style* differently > depending on whether it takes the fast path or the complex path, then your port > has a bug in the complex path.” The whole idea of fastpath is broken to begin with... I think you are trying to "fix" things at the wrong spot. What we need is to implement a Firefox-style word cache and remove fastpath completely. That still doesn't justify why you want to turn kern/liga off for Arabic and other complex scripts. Fastpath is always broken for those, so your argument above can't be correct. PLEASE don't break complex text rendering for 1) complex scripts, and 2) under text-rendering:optimizeLegibility. > Choice of code path (an implementation detail) affecting appearance is a bug. If > a port doesn’t render the AV these two divs the same, then it has a bug: > <div>AV e</div> > <div>AV è</div> > > This bug (used to, maybe still does) block > https://bugs.webkit.org/show_bug.cgi?id=100794 (see > https://bugs.webkit.org/show_bug.cgi?id=113243 and > https://chromium.googlesource.com/chromium/blink/+/02e860e42fcc82226a77bf740b...) > > > > - I'll follow up on the HarfBuzz bug you reported, but my gut feeling is that > > that's a WONTFIX. > > Thanks. I think this is worth fixing, since i can have a page today with > '-webkit-font-feature-settings: "liga" 0' or "-webkit-font-variant-ligatures: > no-common-ligatures" and lam-alef will be broken with that font. Garbage-in garbage-out. > > - See comments for more info. In particular, you should just have one set of > > font funcs. > > > > > https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... > > File Source/core/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp (right): > > > > > https://codereview.chromium.org/69513002/diff/300001/Source/core/platform/gra... > > Source/core/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp:189: return > > harfBuzzSkiaFontFuncsWithKerning; > > This is the wrong approach to control kerning. > > > > Ok. I was worried that adding the truetype kerning callbacks would enable > kerning, even with OpenType "kern" disabled, so I make two sets of funcs to > allow "all kerning off". Is this a bad assumption? Yes. HarfBuzz does the right thing when you say kern:0. It disables both GPOS and TrueType kerning.
> The whole idea of fastpath is broken to begin with... I think you are trying to > "fix" things at the wrong spot. What we need is to implement a Firefox-style > word cache and remove fastpath completely. > > That still doesn't justify why you want to turn kern/liga off for Arabic and > other complex scripts. Fastpath is always broken for those, so your argument > above can't be correct. PLEASE don't break complex text rendering for 1) > complex scripts, and 2) under text-rendering:optimizeLegibility. Fair enough, but removing fast path is definitely a longer-term change. To be clear, the fact that the complex text path already enabled ligatures (and kerning) automatically is a bug today. fast/text/font-kerning.html and fast/text/font-variant-ligatures.html currently fail if you have a font that supports kerning and ligatures. Also, my patch here doesn't change anything for text-rendering:optimizeLegibility. If you explicitly request that, you get kerning and ligatures by default. The case I've changed (that's causing problems) is when you get transparently promoted to the complex text path because of the codepoints you're trying to render. > Yes. HarfBuzz does the right thing when you say kern:0. It disables both GPOS > and TrueType kerning. Ok, I'll clean it up.
On 2013/11/15 20:57:39, efidler1 wrote: > > The whole idea of fastpath is broken to begin with... I think you are trying > to > > "fix" things at the wrong spot. What we need is to implement a Firefox-style > > word cache and remove fastpath completely. > > > > That still doesn't justify why you want to turn kern/liga off for Arabic and > > other complex scripts. Fastpath is always broken for those, so your argument > > above can't be correct. PLEASE don't break complex text rendering for 1) > > complex scripts, and 2) under text-rendering:optimizeLegibility. > > Fair enough, but removing fast path is definitely a longer-term change. To be > clear, the fact that the complex text path already enabled ligatures (and > kerning) automatically is a bug today. fast/text/font-kerning.html and > fast/text/font-variant-ligatures.html currently fail if you have a font that > supports kerning and ligatures. > > Also, my patch here doesn't change anything for > text-rendering:optimizeLegibility. If you explicitly request that, you get > kerning and ligatures by default. The case I've changed (that's causing > problems) is when you get transparently promoted to the complex text path > because of the codepoints you're trying to render. Ok, then please make sure it wouldn't apply to Arabic, etc either.
Ok, I'm going to separate this out into a few bugs, since some parts will hopefully be uncontroversial. Stay tuned.
The latest patch on this review just adds Truetype kerning support, without changing the default kerning or ligatures when promoted to the complex path. PTAL.
On 2014/02/18 16:29:27, efidler1 wrote: > The latest patch on this review just adds Truetype kerning support, without > changing the default kerning or ligatures when promoted to the complex path. > PTAL. LGTM
The CQ bit was checked by eae@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/efidler@blackberry.com/69513002/600001
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for LayoutTests/TestExpectations: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file LayoutTests/TestExpectations Hunk #1 FAILED at 949. 1 out of 1 hunk FAILED -- saving rejects to file LayoutTests/TestExpectations.rej Patch: LayoutTests/TestExpectations Index: LayoutTests/TestExpectations diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations index 24e076a8ef8cc5f051da5534d03ef60a92f4191f..22bdca992835ee54c7fe7cc33ac63f4d2384caed 100644 --- a/LayoutTests/TestExpectations +++ b/LayoutTests/TestExpectations @@ -949,4 +949,28 @@ crbug.com/340105 svg/custom/createelement.svg [ NeedsManualRebaseline ] crbug.com/340105 svg/dom/svgpath-out-of-bounds-getPathSeg.html [ NeedsManualRebaseline ] crbug.com/340105 virtual/deferred/fast/images/support-broken-image-delegate.html [ NeedsManualRebaseline ] +# We now support TrueType kerning, so some tests using old versions of Times New Roman or Arial get shorter lines +crbug.com/41990 [ Linux ] fast/css/text-rendering.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/atsui-kerning-and-ligatures.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/capitalize-boundaries.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/drawBidiText.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/emphasis.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/font-smallcaps-layout.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/justify-ideograph-complex.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/text/bidi-tspans.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirLTR-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirLTR-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirRTL-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirRTL-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirLTR-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirLTR-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirRTL-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirRTL-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-direction-rtl.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirLTR-ubEmbed-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirLTR-ubNone-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirLTR-ubOverride-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirRTL-ubOverride-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-SVG-1.1/filters-conv-01-f.svg [ NeedsRebaseline ] + crbug.com/329786 http/tests/inspector/network/network-shared-worker.html [ Pass Failure ]
The CQ bit was checked by efidler@blackberry.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/efidler@blackberry.com/69513002/730001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on linux_blink for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blin...
The CQ bit was checked by efidler@blackberry.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/efidler@blackberry.com/69513002/730001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on linux_blink for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blin...
The CQ bit was checked by efidler@blackberry.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/efidler@blackberry.com/69513002/730001
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for LayoutTests/TestExpectations: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file LayoutTests/TestExpectations Hunk #1 FAILED at 1042. 1 out of 1 hunk FAILED -- saving rejects to file LayoutTests/TestExpectations.rej Patch: LayoutTests/TestExpectations Index: LayoutTests/TestExpectations diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations index 25a88b77b7a3e8b6f37ee86d1c30603ccbd09f48..0c1f4b85cbca25ee64dc94007cb9a9679b239428 100644 --- a/LayoutTests/TestExpectations +++ b/LayoutTests/TestExpectations @@ -1042,6 +1042,30 @@ crbug.com/340105 svg/dom/svgpath-out-of-bounds-getPathSeg.html [ NeedsRebaseline crbug.com/340105 virtual/deferred/fast/images/support-broken-image-delegate.html [ NeedsRebaseline ] crbug.com/331301 editing/selection/move-left-right.html [ NeedsManualRebaseline ] +# We now support TrueType kerning, so some tests using old versions of Times New Roman or Arial get shorter lines +crbug.com/41990 [ Linux ] fast/css/text-rendering.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/atsui-kerning-and-ligatures.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/capitalize-boundaries.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/drawBidiText.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/emphasis.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/font-smallcaps-layout.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] fast/text/justify-ideograph-complex.html [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/text/bidi-tspans.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirLTR-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirLTR-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirRTL-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/g-dirRTL-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirLTR-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirLTR-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirRTL-ubNone.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/text-dirRTL-ubOverride.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-direction-rtl.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirLTR-ubEmbed-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirLTR-ubNone-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirLTR-ubOverride-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-I18N/tspan-dirRTL-ubOverride-in-rtl-context.svg [ NeedsRebaseline ] +crbug.com/41990 [ Linux ] svg/W3C-SVG-1.1/filters-conv-01-f.svg [ NeedsRebaseline ] + # Needs rebaselining after fixing issue with text-overflow: ellipsis (not showing up). crbug.com/166263 fast/css/text-overflow-ellipsis-text-align-center.html [ NeedsRebaseline ] crbug.com/166263 fast/css/text-overflow-ellipsis-text-align-left.html [ NeedsRebaseline ]
The CQ bit was checked by efidler@blackberry.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/efidler@blackberry.com/69513002/1000002
The CQ bit was unchecked by phajdan.jr@chromium.org
The CQ bit was checked by phajdan.jr@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/efidler@blackberry.com/69513002/1000002
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/efidler@blackberry.com/69513002/1000002
Message was sent while issue was closed.
Change committed as 167463 |