W3C home > Mailing lists > Public > www-style@w3.org > April 2012

Re: [css3-text] wrapping text while keeping line lengths balanced

From: fantasai <fantasai.lists@inkedblade.net>
Date: Fri, 20 Apr 2012 16:09:01 -0700
Message-ID: <4F91EC8D.9000304@inkedblade.net>
To: www-style@w3.org
On 04/20/2012 03:54 PM, Ian Hickson wrote:
>
> Hi,
>
> As part of WebVTT we've run into a problem of wanting text wrapping to
> have automatically balanced line lengths in captions.
>
> Looking at the CSS Text specification, it looks like this is a new axis on
> the 'white-space' shorthand, which applies only at the block level,
> controlling whether the line breaks are distributed eagerly, like today,
> modulo 'text-wrap:avoid', or whether they are distributed so as to
> minimise the difference in line lengths, again modulo 'text-wrap:avoid'.
>
> Any advice on how to proceed in addressing this use case in WebVTT would
> be most welcome. Short-term I expect we will look at introducing a new
> 'white-space' keyword, which expands to the same as 'normal' but with a
> new property 'text-balance' or something set to a value indicating that
> the lines should be balanced, but it would be good if we could instead
> point to something that browsers implement for all of CSS rendering.

IIRC there was previously a proposal for a 'last-line-length' or some
such property, which would set a minimum length to fill for the last
line. (Other lines are considered to be 100%.) This would handle your
use case: you'd set it to 100%.

The problem is this would require a line-breaking algorithm that does
full-paragraph line balancing, and no one has stepped forward to say
they want to implement that. And so I have not bothered to spec that.

~fantasai
Received on Friday, 20 April 2012 23:09:32 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:52 GMT