Re: WebVTT wrapping

On Wed, 25 Apr 2012, Glenn Maynard wrote:
> On Tue, Apr 24, 2012 at 4:43 PM, Ian Hickson <ian@hixie.ch> wrote:
> > 
> > I've fixed WebVTT to say that lines should be wrapped with line 
> > balancing. So now if you want good line wrapping you can just put it 
> > all on one line, and if you want explicit line breaks you can just put 
> > those in too.
> > 
> > Regardless of the value of the 'white-space' property, any line breaks 
> > inserted by the user agent for the purposes of line wrapping must be 
> > placed so as to minimise Δ across each run of consecutive lines 
> > between preserved newlines in the source. Δ for a set of lines is 
> > defined as the sum over each line of the absolute of the difference 
> > between the line's length and the mean line length of the set.
> 
> This sounds like the "optimal" approach that was--from what I 
> understand--rejected from CSS because it was O(n^2).

In CSS you can envisage cases where the content to balance is thousands of 
lines long. In WebVTT we'ren normally talking about a couple of lines.


> The algorithm I proposed is is O(n), so it should be possible to change 
> it into a CSS white-space style later (which is really where it 
> belongs).

We can still do that; the white-space value isn't going to _disallow_ the 
ideal rendering, that would be silly.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 25 April 2012 17:46:28 UTC