Letter spacing is applied to zero width characters (zwsp, zwj, zwnj)

RESOLVED FIXED in Firefox 60

Status

()

RESOLVED FIXED
15 years ago
8 months ago

People

(Reporter: gkn, Assigned: jfkthame)

Tracking

(Blocks: 1 bug)

Trunk
mozilla60
Points:
---

Firefox Tracking Flags

(firefox60 fixed)

Details

Attachments

(5 attachments, 1 obsolete attachment)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7) Gecko/20040724 Firefox/0.9.1+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7) Gecko/20040724 Firefox/0.9.1+

Where a zero width space exists but there is no line-break, CSS letter-spacing
is applied to the zero width space.

Testcase follows.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
(Reporter)

Comment 1

15 years ago
Created attachment 154392 [details]
Zero width spaces letter- and word-spacing test case
(Reporter)

Updated

15 years ago
Summary: Letter- spacing is applied to zero width spaces even when the line does not break → Letter spacing is applied to zero width spaces even when the line does not break

Comment 2

15 years ago
Opera 7.5 behaves the same.
IE6 behaves as expected.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Comment 3

15 years ago
Created attachment 157944 [details]
Test case v2

Added another line (to the top) - a "control group" with no zero-width spaces.

The second line should look like the first line. Failing that, the third line
should look like the first line - it has negative word-spacing applied. The
fourth line demonstrates that positive word-spacing also isn't applied to
zero-width spaces.
(Reporter)

Updated

15 years ago
Attachment #154392 - Attachment is obsolete: true
(Reporter)

Comment 4

14 years ago
(In reply to comment #3)
> Failing that, the third line
> should look like the first line - it has negative word-spacing applied. The
> fourth line demonstrates that positive word-spacing also isn't applied to
> zero-width spaces.

By the way, these bits are bug 253144.
Duplicate of this bug: 598002
Editing summary per duplicate bug.
Summary: Letter spacing is applied to zero width spaces even when the line does not break → Letter spacing is applied to zero width characters (zwsp, zwj, zwnj)

Comment 7

8 years ago
This used to work just fine in Firefox 3.6, but Firefox 4 beta 6 suffers from this bug again.

Comment 8

8 years ago
Created attachment 494989 [details]
New testcase with actual example from German

New testcase with actual sample words from German that were displayed fine in Firefox 3.6 on Mac OS but incorrectly on Firefox 4 Beta 7 (and 6).

Comment 9

4 years ago
Created attachment 8541971 [details]
This is a testcase which tests the zero‐width space, non‐joiner, and joiner characters in conjunction with the letter‐spacing property.

I’m adding an updated testcase. It unifies the two existing testcases by testing all of the three characters mentioned in the title of this bug, removes extraneous tests of the word-spacing property, and uses modern HTML.

In this testcase, only the test involving the zero‐width space character fails to display correctly in Firefox 34. The tests for the other two characters, zero‐width non‐joiner and zero‐width joiner, are displayed correctly. (So, apparently, this bug is 2⁄3s of the way fixed.)

As for other browsers, Chrome 39 displays the entire testcase correctly, and Internet Explorer 11 fails the same test as Firefox.

I’m on Windows 8.1, so the platform listed (x86 Windows XP) must be incorrect.

Comment 10

4 years ago
(In reply to Patrick Garies from comment #9)
> In this testcase, only the test involving the zero‐width space character
> fails to display correctly in Firefox 34. The tests for the other two
> characters, zero‐width non‐joiner and zero‐width joiner, are displayed
> correctly. (So, apparently, this bug is 2⁄3s of the way fixed.)
> 

Not exactly, I think. Although zero‐width non‐joiner and zero‐width joiner don't contribute to letter-spacing they can still affect font selection (tested on FF36 Linux 64). As a result, texts contains zero‐width non‐joiner or zero‐width joiner may looks different from those contains none.

On my computer, "Control"(without special chars) is displayed with font "Source Han Sans SC Normal", while "Test 2" is displayed with fonts "DejaVu Sans" + "Source Han Sans SC Normal", and "Test 3" is displayed with font "DejaVu Sans".
(Assignee)

Updated

10 months ago
Duplicate of this bug: 1439518
(Assignee)

Updated

10 months ago
Blocks: 104960
Component: Layout → Layout: Text
(Assignee)

Updated

10 months ago
OS: Windows XP → All
Hardware: x86 → All
(Assignee)

Updated

10 months ago
Duplicate of this bug: 783180
(Assignee)

Comment 13

10 months ago
Created attachment 8953829 [details] [diff] [review]
Do not add letter-spacing after zero-width format controls such as ZWSP

This fixes the problem for the examples here, AFAICS, as well as for similar format characters (zero-width no-break space, word joiner).
Attachment #8953829 - Flags: review?(jwatt)
(Assignee)

Updated

10 months ago
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
(Assignee)

Comment 14

10 months ago
Created attachment 8953830 [details] [diff] [review]
Add a web-platform reftest for letter-spacing in the presence of zero-width format controls
Attachment #8953830 - Flags: review?(jwatt)
Attachment #8953829 - Flags: review?(jwatt) → review+
Attachment #8953830 - Flags: review?(jwatt) → review+

Comment 15

9 months ago
Thanks Jonathan et al for fixing this!
Flags: needinfo?(jwatt)

Comment 18

9 months ago
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9162eefca30f
Do not add letter-spacing after zero-width format controls such as ZWSP. r=jwatt
https://hg.mozilla.org/integration/mozilla-inbound/rev/b81999f30c15
Add a web-platform reftest for letter-spacing in the presence of zero-width format controls. r=jwatt
Created web-platform-tests PR https://github.com/w3c/web-platform-tests/pull/9864 for changes under testing/web-platform/tests
Upstream PR merged
https://hg.mozilla.org/mozilla-central/rev/9162eefca30f
https://hg.mozilla.org/mozilla-central/rev/b81999f30c15
Status: ASSIGNED → RESOLVED
Last Resolved: 9 months ago
status-firefox60: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
(Reporter)

Comment 22

9 months ago
Thanks everyone for all your work on this over the years, particularly for expanding the scope to other affected characters.

I'm especially impressed by how robust our standard process seems to be now for automated regression testing of web platform features.

Great work everyone!
Thanks, Tobi and Greg. It's nice to seem some positive comments in bugzilla once in a while. :)
Flags: needinfo?(jwatt)

Comment 24

9 months ago
Checked letter-spacing in combination with ​ in Nightly - works :)
Upstream PR merged
You need to log in before you can comment on or make changes to this bug.