Dominik Roettsches wrote: > [EMAIL PROTECTED] (Sean R. Bright) schrieb in news:001301c18daf$df79f6f0 > $e18e0418@cc230545b: > > >>Doesn't wordwrap() already handle this? Or am i missing something? >> >>Sean >> > > wordwrap() does just a simple wordwrap searching for the first whitespace > backwards and breaking the line. > > The formatting fmt does is near-optimal line-breaking according to the paper > published by Donald E. Knuth: > "Breaking Paragraphs into Lines", D.E. Knuth and M.F. Plass, > chapter 3 of _Digital Typography_, CSLI Lecture Notes #78. > > It achieves a better result than first fit (backward first fit search) or > other simple search methods by making use of dynamic programming. > > Another suggestion is to replace the wordwrap code by the algorithm of > Knuth. > > I'm looking forward to read your replies, > > Dominik >
I've never take a look at wordwrap code, but Dominik's suggestion sounds nice to me. There are many search & replace algorithms patented, but I don't think any of Knuth's algorithms are patented :) -- Yasuo Ohgaki -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]