RE: [css3-text] interaction of hanging-punctuation:force-end, text-align and text-justify

> From: Florian Rivoal [mailto:florianr@opera.com]
> If I am reading the spec right, when the hanging-punctuation property is set to force-end,
> and text-align is left in ltr text or right in rtl text, if effectively causes a single line to be
> justified.

No it does not. It first defines what characters can hang and when for each value, then the next paragraph defines what the "hang" means in this context:

| When a punctuation mark hangs, it is not considered when
| measuring the line's contents for fit, alignment, or justification.

This feature may require you to change the way you think slightly. It defines how UA measures the line's content, and punctuation hangs as a result of that.

> The spec does not say if this single line justification is expected to follow the justification
> method determined by text-justify or not. I think it should follow text-justify.

Correct. It doesn't affect text-justify, text-align, or any other properties.

> If text-align is justify, my understanding is that hanging-punctuation:force-end and
> hanging-punctuation:allow-end would give the same result. Is that correct?

Example 17 shows how "allow-end" and "force-end" differ from each other. "force-end" measures the line without stop or comma even if it fits, while "allow-end" does so only if it doesn't fit.

> If text-align is right in ltr text or left in rtl text, I am not entirely sure what the expected
> behavior is. In the following examples, the '|' character marks where the padding starts.
> 
> text-align:right; hanging-punctuation:none;
> |      some words.|
> 
> text-align:right; hanging-punctuation:force-end;text-justify:inter-word;
> |       some words|.
> |      some  words|.
> |some        words|.
> |s o m e w o r d s|.
> 
> The first interpretation shifts the line.
> The second uses justification, but without putting any text further left than you would have
> without hanging-punctuation:force-end; The third justifies using the whole line.
> The fourth justifies using the whole line, without respecting justify:inter-word;

The first one, because what the property changes is how UA measures the content. UA measures the line without the ending stop, then align right.

If you use "allow-end" against this example, it has no effect, because the line fits without hanging.

> If text-align is center or <string>, I am even more at loss when trying to imagine what the
> expected behavior is.

I hope it's clear now, UA measures string without the ending stop, and center the line, if "force-end".

> An alternative to all this would be that force-end never does anything unless text-align is
> justify, and that the example give in the spec assumes text-align:justify.

I agree that's another possible approach. But I think the current approach is more flexible and make the feature independent from other properties, which I think is good.


Regards,
Koji

Received on Friday, 4 May 2012 18:24:46 UTC