Re: CSS 2.1 text-align:justify issue [CSS2.1] [css3-text]

Bert Bos wrote:
> On Monday 21 July 2008 23:42, fantasai wrote:
>> Robert O'Callahan wrote:
>>> http://www.w3.org/TR/CSS21/text.html says
>>> "If the computed value of text-align is 'justify' while the
>>> computed value of white-space is 'pre' or 'pre-line', the actual
>>> value of text-align is set to the initial value."
>>>
>>> There are two problems:
>>> 1) white-space can apply to inline elements, so this statement
>>> doesn't achieve the apparent intent of disabling text-align:justify
>>> on white-space:pre/pre-line elements. One could have a
>>> white-space:normal, text-align:justify block containing a big lump
>>> of white-space:pre content, or likewise a white-space:pre,
>>> text-align:justify block containing white-space:normal content.
>>> 2) Why are pre-line and pre singled out here, but pre-wrap is not?
>>> pre-line without any newlines present behaves just like pre-wrap.
>>>
>>> I suggest this be replaced by a statement somewhere that
>>> preformatted spaces may not be stretched by text-align:justify.
>> Recorded as CSS2.1 Issue 53:
>>    http://csswg.inkedblade.net/spec/css2.1#issue-53
>>
>> Proposed text:
>>
>>    Replace
>>      "If the computed value of text-align is 'justify' while the
>> computed value of white-space is 'pre' ... initial value."
>>    with
>>      "When 'text-align' is 'justify', characters and letter-spacing
>> whose computed value of white-space is not 'normal' and not 'nowrap'
>> must not be stretched (or shrunk) during justification."
> 
> I think the idea is fine, although it may be a bit late to change it 
> now. It was already in the CR four years ago. But maybe we can contact 
> the implementers outside the WG that we know and ask if they mind 
> changing their code...
> 
> I don't like the proposed text very much, though. How about this:
> 
> In 16.2, replace
> 
>     If the computed value of text-align is 'justify' while the computed
>     value of white-space is 'pre' or 'pre-line', the actual value of
>     text-align is set to the initial value.
> 
> with
> 
>     If the computed value of 'text-align' is 'justify' and the computed
>     value of white-space is 'pre', 'pre-line' or 'pre-wrap', then the
>     actual value of 'text-align' is set to the initial value.
> 
>     If an element has a computed value for 'white-space'
>     of 'pre', 'pre-line' or 'pre-wrap', then neither the glyphs in that
>     element nor the spaces between them must be stretched or shrunk for
>     the purposes of justification.
>
> The first paragraph just adds the missing 'pre-wrap', but otherwise 
> keeps the notion of using the initial value for 'text-align', which 
> disappeared in Elika's rewrite.
> 
> The second tries to express what Elika's text said, but, I think, more 
> precisely.

I like your wording of the second paragraph better. The wording in the
first paragraph bothers me a bit, as I'd use "is treated as" rather than
"the actual value is set to" but since it's effectively correct I suppose
it doesn't need to change.

>     *Note* that this applies also to elements to which 'text-justify'
>     itself does not apply, e.g., inline elements in a justified
>     block-level element.
> 
> The third is a note to explain what the difference between those two 
> paragraphs is.

The flips side of that is that it means if I have
   <pre style="text-align: justify"> Some text
     <span style="white-space: normal">some more text</span>
   </pre>
The text inside the span won't expand. Perhaps we should add that as well.
Both of these would need to be tested.

>> I also noticed that the note at the end of the section should be
>> normative, not non-normative.
>>
>> Proposal:
>>
>>    Make note after example normative.
> 
> No objection, but it doesn't seem to matter. It's redundant, hence the 
> note. It's also true, so you can make it normative. But whether 
> normative or not, it is not a testable statement.

Ok, I see now that I misinterpreted that last paragraph (which needs to
be normative) as being part of the previous note (which doesn't). :)
We can leave it alone, I don't mind.

~fantasai

Received on Wednesday, 30 July 2008 02:10:35 UTC