Re: Re: Suggestion: Adding fmt like linebreak algorithm
| From: | Yasuo Ohgaki | Date: | Wed, 26 Dec 2001 02:35:27 +0000 |
| Subject: | Re: Re: Suggestion: Adding fmt like linebreak algorithm | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-74996@lists.php.net to get a copy of this message | ||
Dominik Roettsches wrote:
elixer@erols.com (Sean R. Bright) schrieb in news:001301c18daf$df79f6f0 $e18e0418@cc230545b: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 OhgakiDoesn't wordwrap() already handle this? Or am i missing something? Seanwordwrap() 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