[css3-text] text-justify:distribute behavior

Thank you for your reply.

> If nobody thinks about wrapping, then probably text-wrap won't be set. :P

Right. That's where testing can appeal how much authors don't think about edge cases and justify their budget :)

>Note that text-align-last doesn't take effect unless text-align is 'justify'.
>So both examples need to set text-align: justify.

Oh, I see. I wasn't reading that words carefully in the spec. Thank you for pointing this out.

>Actually, I was thinking something like this:
>
>  | text-align-last: [ start | end | left | right | center ] || justify

Hmm. How does this solve centering the first line when it has no expand opportunities? i.e., this layout:
+-------------+
|      A      |
| w w w w w w |
+-------------+

>We could also add an 'auto' value as the default
>   auto
>     If 'text-justify' is 'distribute', then the used value is 'justify center'.
>     Otherwise the used value is 'start'.
>This means that "text-justify: distribute; text-align: justify" is enough to trigger
>full distribution. It might be more confusing though, since no other text-justify
>methods trigger last-line justification.

>Unbaked thought: maybe we need a shorthand for text-align+text-justify+text-align-last.

I love this. Please bake it :) I'm tired being asked why CSS requires 3 or 4 lines of code just to do "distribute". You might already know this but in the UI of word processors, it's at the same level as "left", "right", "center", "justify", and "distribute". Probably someone invented to unify "justify" and "distribute" in the past, but it not only requires more typing but also does not match to how users used to think.

Can a value be shortcut? If yes, I'd love:
  text-align: distribute;
and then it makes all the necessary work. It matches to the syntax of ruby-align:distribute-letter[1] too, which provides exactly the same layout for ruby base text.

[1] http://dev.w3.org/csswg/css3-ruby/#rubyalign


-----Original Message-----
From: fantasai [mailto:fantasai.lists@inkedblade.net] 
Sent: Wednesday, December 15, 2010 5:39 AM
To: Koji Ishii
Cc: MURAKAMI Shinyu; www-style@w3.org
Subject: Re: text-justify:distribute behavior

Adding www-style.

On 12/14/2010 07:30 AM, Koji Ishii wrote:
> fantasai wrote:
>> Koji Ishii wrote:
>>>            <dt>distribute</dt>
>>>            <dd>Justification primarily changes spacing both at word separators
>>>              and at grapheme cluster boundaries in all scripts except those in
>>>              the connected and cursive groups.
>>> +          If there are no word separators nor grapheme cluster boundaries,
>>> +          the inline contents are centered within the line box.
>>
>> The behavior when there are no expansion opportunities in a line is 
>> to fall back to the value given in text-align-last. I don't think it 
>> makes sense to have 'distribute' be an exception here.
>>
>> What we might want to do, though, is have the 'justify' value of 'text-align-last'
>> fall back to 'center' instead of to 'start'.
>> And/or allow 'text-align-last' to combine 'justify' with another value.
>
> I saw minutes from your meeting with JLTF in 2009[1]. There must have 
> been more discussion than written there, but I'd like to add a couple of items.
>
> First, when you use "distribute", it's not only about the last line. 
> In most cases, nobody thinks about wrapping, so the style should be something like this:
>    text-wrap:none;
>    text-align-last:justify;
>    text-justify:distribute;

If nobody thinks about wrapping, then probably text-wrap won't be set. :P

> If you allow wrapping, although probably normal Japanese had never 
> thought about that because we usually don't see such usage in the 
> printed materials, it should be:
>    text-align:justify;
>    text-align-last:justify;
>    text-justify:distribute;

Note that text-align-last doesn't take effect unless text-align is 'justify'.
So both examples need to set text-align: justify.

> With this styles, if the first line doesn't have expand opportunities, 
> it should be centered. I have attached a sample from Word's distribute 
> implementation. The text is "A wwwww" and the line is wrapped. The 2nd 
> word "wwwww" is wrapped to the next line, and "A" at the first line is 
> centered. InDesign behaves the same way.

+-------------+
|      A      |
| w w w w w w |
+-------------+

> Second. Centering when no expand opportunity is not an option for 
> "distribute"; lines without expand opportunities are always centered. 
> So making it an optional keyword only adds unnecessary test cases where there're no demands on.
>
>> From these two, I think it should be the default behavior of 
>> "distribute" value
> rather than an optional keyword. Do you have any scenarios in your 
> mind to make it optional? Maybe you've got some requests from other scripts?

Actually, I was thinking something like this:

  | text-align-last: [ start | end | left | right | center ] || justify
  |
  | If 'justify' is combined with an alignment keyword, then that alignment
  | is used as the fallback alignment when all expansion opportunities in
  | the line are exhausted. If no alignment keyword is given, the fallback
  | alignment is 'center' when 'text-justify' is 'distribute' and 'start'
  | otherwise.

We could also add an 'auto' value as the default
   auto
     If 'text-justify' is 'distribute', then the used value is 'justify center'.
     Otherwise the used value is 'start'.
This means that "text-justify: distribute; text-align: justify" is enough to trigger full distribution. It might be more confusing though, since no other text-justify methods trigger last-line justification.

Unbaked thought: maybe we need a shorthand for text-align+text-justify+text-align-last.

> [1] http://lists.w3.org/Archives/Public/www-style/2009Mar/0064.html

~fantasai

Received on Wednesday, 15 December 2010 00:04:03 UTC