New issue
Advanced search Search tips

Issue 896033 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 3
Cc:
Components:
EstimatedDays: ----
NextAction: 2018-10-28
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 894954



Sign in to add a comment

When letter-spacing != 0 common ligatures should not be applied.

Project Member Reported by bunge...@chromium.org, Oct 16

Issue description

An old informative report and live example available at http://unifraktur.sourceforge.net/testcases/letter-spacing_ligatures/ . There is also a test case at https://chromium.googlesource.com/chromium/src/+/7c6aeb96da8745b949f1a246a19e41f6d6772f4b/third_party/WebKit/LayoutTests/fast/text/font-ligature-letter-spacing-expected.txt having two FAIL expectations .

When letter-spacing != 0, optional ligatures should not be applied. There is even a comment in the code at https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/fonts/font_description.cc?l=271&rcl=a47c1f87c8f9616b839db391ce2d6de586824ec3 about this. However, this code does not appear to be correct, in that it doesn't disable ligatures in the feature settings when letter-spacing == 0. Even if it did, this feature setting is currently ignored when setting the ligatures in SetFontFeatures.

Attached is a minimal diff to illustrate a possible change. It isn't complete in light of similar issues like issue 893330 it may be desirable to fix this a different way.
 
letter_spacing.diff
2.6 KB Download
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b229b71ef89c1f627afa0946a4f90840ac04e085

commit b229b71ef89c1f627afa0946a4f90840ac04e085
Author: Ben Wagner <bungeman@chromium.org>
Date: Fri Oct 19 16:10:14 2018

Add wpt test for ligature feature precedence.

Specifies the cross product of '@font-face font-feature-settings',
'font-variant-ligatures', 'letter-spacing', and 'font-feature-settings'
with various values to test feature precedence with respect to
ligatures.

Bug: chromium:894954,  chromium:896033 , chromium:450619, chromium:443467
Change-Id: I182ce477fd0ec5dd5070c540460b1ee4e1148b8a
Reviewed-on: https://chromium-review.googlesource.com/c/1289729
Commit-Queue: Ben Wagner <bungeman@chromium.org>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601172}
[modify] https://crrev.com/b229b71ef89c1f627afa0946a4f90840ac04e085/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/b229b71ef89c1f627afa0946a4f90840ac04e085/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-feature-resolution-001-ref.html
[add] https://crrev.com/b229b71ef89c1f627afa0946a4f90840ac04e085/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-feature-resolution-001.html

After creating a partial fix at https://chromium-review.googlesource.com/c/chromium/src/+/1292436 to fix the above test for letter-spacing (still issues with @font-face font-feature-settings), it was discovered that https://chromium.googlesource.com/chromium/src/+/7c6aeb96da8745b949f1a246a19e41f6d6772f4b/third_party/WebKit/LayoutTests/fast/text/font-ligature-letter-spacing-expected.txt and the associated test are simply incorrect. The letter-spacing != 0 should only disable common ligatures ('liga' and 'clig'), not discretionary ligatures like 'dlig'. That test needs to be fixed as part of this. 
Cc: drott@chromium.org e...@chromium.org
Labels: Needs-Feedback
Owner: ----
Thanks Ben.

Is the desired behavior here specified anywhere? I.e. should letter-spacing-induced disabling of ligatures take precedence over explicit font-variant-ligatures or font-feature-settings declarations? I can't find anything more recent than a discussion from 2013.

https://lists.w3.org/Archives/Public/www-style/2013Jul/0691.html
NextAction: 2018-10-28
Summary: When letter-spacing != 0 common ligatures should not be applied. (was: When letter-spacing != 0 optional ligatures should not be applied.)
I'm mostly going on https://www.w3.org/TR/css-fonts-3/#feature-precedence , which while updated a bit with css4 is essentially the same in this regard. A summary of those rules is stated in the test,

default < @font-face < font-variant < letter-spacing < font-feature-settings

Note that only 'common ligatures' are supposed to be disabled by 'letter-spacing != 0', which are 'liga' and 'clig'. Apparently this is not supposed to apply to other ligatures like 'dlig' or 'hlig', since it explicitly calls out 'common ligatures' and defines that to mean 'liga' and'clig'.
Labels: -Pri-3 Pri-2
Owner: e...@chromium.org
Status: Assigned (was: Untriaged)
Thanks Ben. I'll try to make the requires changes on the Blink side post-TPAC.
The NextAction date has arrived: 2018-10-28
Note that I have asked directly about letter-spacing and 'hlig' and 'dlig' at https://github.com/w3c/csswg-drafts/issues/2644 (in a addition to discovering an issue with the Khmer shaping spec and HarfBuzz). Hopefully this situation can be considered soon. If you know someone to around the css-fonts-3 or -4 spec to ask about this it might help to prod them a bit. Seems like this should be fairly straight forward to give an up or down on.
Note that we're not the only ones who think that maybe 'hlig' and 'dlig' should be affected by letter-spacing... https://github.com/w3c/csswg-drafts/issues/2644#issuecomment-386950844 .
Project Member

Comment 10 by bugdroid1@chromium.org, Dec 1

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/78d30d938d765e7f8ac811166630f164dcc6df5b

commit 78d30d938d765e7f8ac811166630f164dcc6df5b
Author: Ben Wagner <bungeman@chromium.org>
Date: Sat Dec 01 18:39:11 2018

Fix ligature interaction with letter-spacing and text-rendering.

This is a minimal change to cover most cases. In particular this does
not take @font-face font-feature-settings into account, but does make
letter-spacing with a non-default value disable optional ligatures for
all cases except when enabled directly by font-feature-settings. It
also makes optimizeSpeed force the default setting for optional
ligatures to off.

This avoids using or changing TypesettingFeatures, leaving
blink::kLigatures to only affect the use of the word shaper. The use of
the word shaper can be modified independently and will involve
rebaselines and consideration of the performance impact (since common
fonts like Arial, Times New Roman, and DejaVu Sans use spaces in GPOS
or GSUB).

Bug:  chromium:896033 
Change-Id: I764b1a7eed6d9f06ff8df31c4225dee2ea860684
Reviewed-on: https://chromium-review.googlesource.com/c/1292436
Commit-Queue: Ben Wagner <bungeman@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612933}
[modify] https://crrev.com/78d30d938d765e7f8ac811166630f164dcc6df5b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
[modify] https://crrev.com/78d30d938d765e7f8ac811166630f164dcc6df5b/third_party/blink/web_tests/fast/css/text-rendering.html
[delete] https://crrev.com/7238fc338593650f478451609bf5fcb599a1ab3d/third_party/blink/web_tests/fast/text/font-ligature-letter-spacing-expected.txt
[modify] https://crrev.com/78d30d938d765e7f8ac811166630f164dcc6df5b/third_party/blink/web_tests/fast/text/font-ligature-letter-spacing.html
[modify] https://crrev.com/78d30d938d765e7f8ac811166630f164dcc6df5b/third_party/blink/web_tests/flag-specific/enable-blink-features=LayoutNG/fast/css/text-rendering-expected.png
[modify] https://crrev.com/78d30d938d765e7f8ac811166630f164dcc6df5b/third_party/blink/web_tests/platform/linux/fast/css/text-rendering-expected.png
[delete] https://crrev.com/7238fc338593650f478451609bf5fcb599a1ab3d/third_party/blink/web_tests/platform/linux/fast/text/font-ligature-letter-spacing-expected.txt
[modify] https://crrev.com/78d30d938d765e7f8ac811166630f164dcc6df5b/third_party/blink/web_tests/platform/mac/fast/css/text-rendering-expected.png
[modify] https://crrev.com/78d30d938d765e7f8ac811166630f164dcc6df5b/third_party/blink/web_tests/platform/win/fast/css/text-rendering-expected.png

Status: Fixed (was: Assigned)

Sign in to add a comment