New issue
Advanced search Search tips

Issue 893330 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 894954



Sign in to add a comment

SetFontFeatures and UpdateTypesettingFeatures disagree on common ligature default setting.

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

Issue description

SetFontFeatures assumes that CommonLigaturesState() returning kNormalLigaturesState means use ligatures, but UpdateTypesettingFeatures assumes that CommonLigaturesState() returning kNormalLigaturesState in the 'auto' state means no ligatures (since default_typesetting_features_ is always 0, since SetDefaultTypesettingFeatures is unused). These two bits of code should use the same criteria for determining which ligatures are active, in particular the common ligatures ('clig' and 'liga').

This was noticed by using a font with ligatures with and without spaces. In the 'auto' state the without-space ligatures are seen (because SetFontFeatures enabled them), but the with-space ligatures are not seen (because UpdateTypesettingFeatures did not set kLigatures on typesetting_features_, resulting in 'per-word' shaping).




 
Almost certain to be wrong or incomplete, this somewhat demonstrates the kind of behavior of interest.
liga.diff
1.5 KB Download
Status: Assigned (was: Untriaged)
Thanks for the report. Was this an open source font that we could use for testing?
I noticed this behavior while testing the behavior of SansBullshitSans which is hosted on github and Apache 2.0 licensed (it's Droid Sans with three extra glyphs and a bunch of long ligatures). I think the version on github has enough ligatures of the appropriate sort to see this issue, I'm currently testing with a slightly altered version with a few more ligatures.
Blocking: 894954
Attaching a test case. This is SansBullshitSans but with the 'liga' feature not marked as required. By default ("font-variant-ligatures: normal;") the ligatures without spaces are applied and the ligatures with spaces are not applied. If "font-variant-ligatures: common-ligatures;" is added to the text area then the ligatures with spaces start showing up. It doesn't appear that "font-variant-ligatures: common-ligatures;" is actually changing any font features (compared to 'normal'), instead it appears to be simply toggling the word by word shaping. The behavior seems to be the same with #enable-layout-ng on and off.
index.html
305 bytes View Download
SansBullshitSans_LigaNotRequired.ttf
51.9 KB Download
Playing around with the above example shows that #enable-layout-ng is improving things (apparently by not using the word cache). The above example works as described, but only because the text is in a textarea (for ease of changing the size). With #enable-layout-ng off the same behavior is seen if the textarea is changed to a div, with #enable-layout-ng on the behavior when the textarea is changed to a div is improved with the ligatures being used as expected. It appears this is because layout-ng doesn't do the per-word shaping, but textareas aren't yet layout-ng-ified.

It appears that ComputeCanShapeWordByWord is the only user of kLigatures, so it seems that after layout-ng lands it can simply be removed. It appears there is no user of kCaps currently? Also FontDescription::SetDefaultTypesettingFeatures doesn't appear to be used. kKerning does appear to be used, but the default is always off? If so, it looks like UpdateTypesettingFeatures is evaporating?
Just discovered that this is covered by wpt test font-features-across-space-3.html which layout-ng has marked as Pass. However, this test doesn't cover the case of this happening in a textarea and layout-ng still doesn't cover that, so I'm hesitant to mark this as fixed by layout-ng yet.

Sign in to add a comment