Open Bug 628825 Opened 14 years ago Updated 2 years ago

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

Categories

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

defect

Tracking

()

UNCONFIRMED

People

(Reporter: vincent-moz, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Attachments

(1 file)

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).
See also Bug 56652 and Bug 206152 with its Dependencies.
Keywords: testcase
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.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: