Re: [CSS21] Shrink-to-fit width algorithm and hyphen as a line break opportunity

Le Ven 21 septembre 2012 3:59, Simon Sapin a écrit :
> Le 21/09/2012 04:34, "Gérard Talbot" a écrit :
>> Q1: Shouldn't an hyphen inside a string normally represent a possible
>> line
>> break opportunity?
>>
>> Q2: Besides a blank space, what else should represent or be considered
>> as
>> a normal line break opportunity?
>>
>> Q3: "CSS 2.1 does not define the exact algorithm." I wonder why. Will
>> CSS
>> 3 provide an exact algorithm? This is more about my curiosity than a
>> formal question.
>
> Hi,
>
> I am nowhere near an 'authoritative source' on this but line breaking is
> far from obvious, especially with international text. (For example Thai,
> from what I read, does not use spaces but does not allow breaks
> anywhere. Breaking "properly" requires a language dictionary.)
>
> Unicode has the beginning of an answer with the poetically named
> UAX #14: http://www.unicode.org/reports/tr14/
>
> But even that can not be universal. Requirements may vary across the
> world, and UAX #14 has a whole section on customization:
> http://www.unicode.org/reports/tr14/#Customization
>
> To answer the initial question, UAX #14 puts the U+002D HYPHEN-MINUS
> character in the "HY" breaking class, which is described as "Provide a
> line break opportunity after the character, except in numeric context".

Simon,

I may have been confused or may have been confusing issues from the start.
Hyphen is normally a break word opportunity. But some browsers when
applying/complying with

"
calculate the preferred minimum width, e.g., by trying all possible line
breaks.
"

may be considering, treating possible word breaks as possible line breaks.
I don't know.

I'm not a text specialist. I wondered why there were so many different
renderings possible with the test I provided.

> Some of the actual rules for this are "tailorable": implementation are
> allowed to do something else.
>
>
> So, unfortunately I’m not sure that CSS can ever have normative
> requirements on line breaking. If you want to test preferred widths and
> shrink-to-fit (without testing the line breaking), I would recommend
> staying in a very small subset of text that everyone agrees how to
> break, maybe only ASCII letters and spaces (no punctuation.) And even
> then, an UA could try to be smart and do automatic hyphenation of words,
> although they may not be allowed to by css3-text without 'hyphens:
> auto'. (The initial value is 'manual'.)
>
> Hope this helps,

It does. I have now lots to read in that
Unicode Standard Annex #14
Unicode Line Breaking Algorithm
document and in CSS3 text.

Thank you!

Gérard
-- 
CSS 2.1 Test suite RC6, March 23rd 2011
http://test.csswg.org/suites/css2.1/20110323/html4/toc.html

Contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

Web authors' contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html

Received on Friday, 21 September 2012 20:28:48 UTC