Closed Bug 1072106 Opened 5 years ago Closed 5 years ago

"ASSERTION: After-spacing inside a ligature" with justified text

Categories

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

x86_64
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: jruderman, Assigned: jfkthame)

References

(Blocks 2 open bugs)

Details

(Keywords: assertion, testcase)

Attachments

(4 files)

Attached file testcase
###!!! ASSERTION: After-spacing inside a ligature!: 'i - 1 <= aStart || aSpacing[i - 1 - aStart].mAfter == 0', file gfx/thebes/gfxTextRun.cpp, line 355
Attached file stack+
Although the comment in IsJustifiableCharacter() claims that we "Don't justify spaces that are combined with diacriticals"[1], the helper it uses (nsTextFrameUtils::IsSpaceCombiningSequenceTail) does not actually check that; it checks ONLY for a following zero-width joiner character[2].

As a result, we will apply justification to space (or no-break space) characters that are being used as the base for a combining mark. So besides hitting the assertion here in a debug build, it's also possible to construct examples that will render incorrectly because of this bug.

[1] http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsTextFrame.cpp#2693
[2] http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsTextFrameUtils.h#78
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Reftest for the justification behavior affected by this. These examples fail on current trunk, but pass once the patch is applied.
Attachment #8494415 - Flags: review?(roc)
Note that this similarly affects the behavior of CSS word-spacing; on trunk, an example like

  data:text/html,<div style="word-spacing:10px">abc &%23x308;def

will apply the word-spacing, resulting in a rendering like

  abc¨   def

while the patch will make it render as

  abc¨def

which I believe is correct: when the <space> is being used as the base for a combining mark, it should no longer be treated as a space for word-separation purposes.
https://hg.mozilla.org/mozilla-central/rev/cc4e54e76940
https://hg.mozilla.org/mozilla-central/rev/b5556bdf4c15
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.