- From: David Singer <singer@apple.com>
- Date: Wed, 18 Apr 2012 14:36:26 +0900
- To: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
- Cc: Glenn Maynard <glenn@zewt.org>, Frank Olivier <Frank.Olivier@microsoft.com>, "public-texttracks@w3.org" <public-texttracks@w3.org>
Two questions: 1 when line number addressing is used, which line is meant if the text needs multiple lines? 2 the existence of soft-wrapped text doesn't answer the question of whether we need hard-wrapped; we could a) say that line breaks in the VTT are treated as whitespace b) (a) plus allow <br> c) say that line breaks in the VTT file are 'hard' which are we settling on? On Apr 18, 2012, at 10:17 , Silvia Pfeiffer wrote: > On Wed, Apr 18, 2012 at 10:15 AM, Glenn Maynard <glenn@zewt.org> wrote: >> On Tue, Apr 17, 2012 at 4:45 PM, Silvia Pfeiffer <silviapfeiffer1@gmail.com> >> wrote: >>> >>> I've had a bit of a chat with some people on the Chrome team that work >>> on CSS and the balanced text wrapping mode that we are after indeed is >>> not easy to implement using CSS. It basically requires a new CSS >>> algorithm. >> >> >> Right, it belongs in CSS. (I found the earlier discussion: >> http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-December/034026.html >> "basic algorithm should be ...".) >> >> It shouldn't be difficult--at least, no more difficult than any other >> wrapping algorithm. >> >>> We're considering this to be a new value for text-wrap - something >>> like "text-wrap: balance;". It would states something along the lines >>> of what you outlined - basically that it minimizes white space in the >>> last line of a multi-line paragraph by re-distributing this white >>> space over all lines and thus making the individual lines shorter. How >>> a browser implements this would be up to the browser. >>> >>> What we likely need to do is: write a proposal (in a wiki page or so) >>> for this new mode, explaining our use case. We should then send it out >>> to the www-style list for general discussion. If you are keen, do go >>> ahead with preparing such a proposal. >> >> >> I don't know if I'll have the bandwidth to explain this from scratch to yet >> another audience. I'll try to get to it eventually if someone else doesn't >> get to it first... >> >> The suggested algorithm is: >> >> 1: Wrap the text using the ordinary word-wrapping algorithm, and let L be >> the resulting number of lines. >> 2: For each possible width W, starting at 1 and ending at the maximum >> wrapping width, do the following: >> 2.1. Wrap the text to width W, using the ordinary word-wrapping algorithm. >> 2.2. If the resulting number of lines is less than or equal to than L, >> return the wrapped text. Otherwise, continue to the next possible width. >> >> This simply finds the narrowest width that doesn't require additional lines >> than ordinary wrapping. This runs in linear time on the size of the input >> text. (Of course, this can be optimized without changing the results, by >> performing a binary search on W instead of a linear one, but that's an >> implementation detail.) >> >> This may not produce great results for large paragraphs, but it should work >> well for caption-size text, where the common case is only a few lines. >> >> (Apparently this has been tried before, but it was attempting to find the >> *optimal* solution, which turns out to be O(n^2). I believe this solution >> is more than adequate for WebVTT's needs, and good enough to be of general >> use; Ian mentioned headings, which this should work well for too.) > > Sounds good to me! > > I don't have the bandwidth right now to do this, but will put it on my > list for after the current task. > > Cheers, > Silvia. > David Singer Multimedia and Software Standards, Apple Inc.
Received on Wednesday, 18 April 2012 05:37:03 UTC