Talk:Word wrap
From Wikipedia, the free encyclopedia
That naive algorithm is indeed naive, it doesn't work properly.
Assume the line width to be 6 and that you have two words three letters long.
It seems to ignore the space between them and will output 7 letters on one line even though it can break the word.
[edit] Insert line breaks where?
While it's nice to calculate the optimal cost, that's not what we're really interested in. It isn't clear how one can use this algorithm to determine where to insert line breaks. Can I get a hint? — indil 01:02, 15 September 2006 (UTC)
[edit] Where is the "optimal" algorithm used?
I initially implemented the "optimal" algorithm for wrapping a small amount of text in a bitmap image. The article seemed to suggest that the greedy algorithm yielded word wrapping inferior to the recursive algorithm, so I decided to use the recursive one. Unfortunately, the article failed to mention that the word wrapping you get with most word processors uses the greedy algorithm. I added a line to mention this fact and hopefully save everyone else working with this stuff some time.
My question is: Where is the recursive algorithm used?
—indil 09:23, 22 September 2006 (UTC)