Closed Bug 1746172 Opened 2 years ago Closed 2 years ago

Letter-spacing & first-letter selection must keep yo-phola with preceding independent vowels

Categories

(Core :: Layout: Text and Fonts, defect)

defect

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: ishida, Assigned: jfkthame)

Details

Attachments

(2 files)

Steps to reproduce:

The issues Letter-spacing splits conjuncts and Conjuncts are not selected as a single unit when styling initials describe how conjuncts should not be split by letter-spacing. See those issues for more details.

This topic builds on that for some specific cases in Bengali.

There are two cases in Bengali where hasant (virama) is preceded by an independent vowel, rather than a consonant. These are:

অ্যা [U+0985 BENGALI LETTER A + U+09CD BENGALI SIGN VIRAMA + U+09AF BENGALI LETTER YA + U+09BE BENGALI VOWEL SIGN AA], and
এ্যা [U+098F BENGALI LETTER E + U+09CD BENGALI SIGN VIRAMA + U+09AF BENGALI LETTER YA + U+09BE BENGALI VOWEL SIGN AA]

https://user-images.githubusercontent.com/4839211/146041054-f96714a2-b926-4ea4-8e17-ba4e003a671e.png

https://user-images.githubusercontent.com/4839211/146041082-fbdd1cee-1bdc-4c45-b2d8-d427b8027c77.png
https://user-images.githubusercontent.com/4839211/146041100-ab30d934-2a22-4e2e-9c6e-68cb3965f3e9.png

(In both cases this produces the sound æ, used for non-native words, such as 'application', 'administration' etc.)

This combination should not be split either, even though it doesn't fit the typical CvC structure of a conjunct (where 'v' is the virama).

Actual results:

Both of the following tests were run with the following pre-installed fonts:

Windows: Shonar Bangla, Arial Unicode MS, Nirmala UI, Vrinda<br>
Mac: Bangla MN, Bangla Sangam MN, Kohinoor Bangla, Tiro Bangla, Baloo Da<br>
Also tested with Noto Sans Bengali and Noto Serif Bengali on the Mac.

<i>Interactive test</i>, Bengali অ্যা and এ্যা (æ) are selected as a single grapheme by ::first-letter.<br>

  • Gecko: ✅❌ Mac: fails for Bangla MN, and Bangla Sangam MN, but passes for the other 3 fonts. Windows: works fine for all fonts.
  • Blink: ❌ Mac & Windows: fails for all fonts.
  • Webkit: ❌ Mac: fails for all fonts. It was not possible to apply the Noto fonts.

Note that Blink and Webkit actually handle the more usual CvC conjunct arrangement (see this test).

<i>Interactive test</i>, Bengali অ্যা and এ্যা (æ) are treated as a single grapheme for letter-spacing.<br>

  • Gecko: ✅❌ Windows: works with all fonts. Mac: fails with Bangla MN, Bangla Sangam MN, and Baloo Da, but works with the others. Works with Noto fonts.
  • Blink: ✅❌ Windows: works with all fonts. Mac: same results as for Gecko.
  • Webkit: ❌ Mac: failed for all fonts. In fact, letters were all spaced individually, rather than by grapheme cluster. Could not apply Noto fonts.

<span class="fail">Gecko</span>, <span class="fail">Blink</span>, and <span class="fail">Webkit</span> all fail to treat the sequence as a single grapheme, despite the fact that Blink and Webkit actually handle the more usual CvC conjunct arrangement (see this test).

Expected results:

This bug is related to https://bugzilla.mozilla.org/show_bug.cgi?id=1742626

This bug deals with both initial-letter and letter-spacing issues together, since i though the solution might be related. If preferred, i could split the above into 2 bugs.

The severity field is not set for this bug.
:jwatt, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jwatt)
Flags: needinfo?(jwatt) → needinfo?(jfkthame)

The ::first-letter case seems to work for me on macOS (including with the Bangla MN / Bangla Sangam MN fonts) using Firefox Nightly (v97), although it was broken in Release (v95). So I suspect bug 1742626 may have fixed this aspect.

The letter-spacing case does still introduce a gap within অ্যা and এ্যা, so that remains to be addressed.

Richard, could you please confirm whether you're still seeing a problem with ::first-letter in Nightly? If that is resolved since bug 1742626, we can narrow the scope of this to just the letter-spacing issue.

Flags: needinfo?(jfkthame) → needinfo?(ishida)

This is a pretty unique special-case; in general, Indic-script VIRAMA characters
cluster with the preceding base, but in Bengali (Bangla) script, VIRAMA combines
with a following YA to create the ya-phala form, which as a whole then needs to
stay associated with the preceding letter.

This works for us if the font ligates the entire letter + ya-phala cluster, but
if ya-phala remains a separate glyph then we could introduce unwanted spacing.
Checking for this case in SetupClusterBoundaries enables us to ensure that the
entire letter + ya-phala cluster stays together, regardless of the specifics of
the font implementation.

Assignee: nobody → jfkthame
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fd2b7ad18465
Merge Bengali ya-phala with the preceding cluster, to prevent letter-spacing introducing a gap between the glyphs. r=TYLin
https://hg.mozilla.org/integration/autoland/rev/7ef7d0a31589
Add WPT reftest for letter-spacing vs Bengali ya-phala. r=TYLin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/32338 for changes under testing/web-platform/tests
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
Upstream PR merged by moz-wptsync-bot

Richard, could you please confirm whether you're still seeing a problem with ::first-letter in Nightly? If that is resolved since bug 1742626, we can narrow the scope of this to just the letter-spacing issue.

jfkthame, sorry it took so long. I just ran the test on Nightly and can confirm that it now passes for the Bangla MN and Bangla Sangam MN fonts, which were the ones that were failing before.

Flags: needinfo?(ishida)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: