Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Line breaking should not occur before punctuation, even when preceded by space

UNCONFIRMED
Unassigned

Status

()

Core
Layout: Text
UNCONFIRMED
7 years ago
7 years ago

People

(Reporter: Vincent Lefevre, Unassigned)

Tracking

(Blocks: 1 bug, {testcase})

Trunk
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Build Identifier: 

Firefox currently allows line breaking before a punctuation mark when it is preceded by a breakable space, such as a thin space U+2009 (as used in French). This is incorrect. The line breaking algorithm should be improved, for instance as described by:

  http://www.unicode.org/reports/tr14/

(Unicode Standard Annex #14 - Unicode Line Breaking Algorithm). In particular, see LB13: "Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces." Note that the list of cited characters is not exhaustive.

Reproducible: Always

Steps to Reproduce:
1. Open a page with a word followed by a thin space then by a punctuation mark such as "!" or "?" (see testcase).
2. Adjust the window width to see the various line breaking positions.
Actual Results:  
For some width, Firefox breaks the line before the punctuation mark.

Expected Results:  
Firefox should break the line before the word preceding it.

WebKit-based browsers have no such problem (tested only with a thin space).

The normal space should be handled as well, because some authors use it instead of a thin space (even with such a slightly incorrect typography, authors often don't use the typical no-break space, probably because a normal space is easier to type on a keyboard).
(Reporter)

Comment 1

7 years ago
Created attachment 506932 [details]
testcase (HTML document with thin space before punctuation)
See also Bug 56652 and Bug 206152 with its Dependencies.
Keywords: testcase

Comment 3

7 years ago
Last I checked we purposefully allowed breaking before '/' because it's common for sites to depend on that.
How about the importance of this bug for Western language users? Is that a major format?
Version: unspecified → Trunk
Hmm, looks like the spaces are marked as breakable in nsLineBreaker::AppendText(). However, we need to access to nsILineBreaker's implementation when we check whether the next character is open punctuation or not...
s/open punctuation/close punctuation
http://mxr.mozilla.org/mozilla-central/source/intl/lwbrk/src/nsJISx4501LineBreaker.cpp#867

Now, GetJISx4051Breaks() always returns FALSE for first character. It might be usable. If the first character is not breakable even with a breakable character, we can set TRUE. Then, nsLineBreaker can know the first character's class of "word" and it can overwrite the previous space's state. But this is just my guess.
(Reporter)

Updated

7 years ago
Blocks: 206152
You need to log in before you can comment on or make changes to this bug.