Open frivoal opened 7 years ago
Agree 100% with doing this. Just need @liamquin to give me a reference I can point at...
An algorithm i've used in the past is
The Knuth-Plass algorithm tends to have some nasty edge cases (e.g. when TeX says "overfull hbox" at you) making it less than ideal for formatting where the author isn't reviewing the results. E.g. sometimes it decides to put only two words or word fragments on a line, one at each end with a huge gap, rather than have several hyphens in a row. It's also NP-complete in performance (on the number of potential word fragements after hyphenation in th paragraph). where the "move lumps back" compromise is either linear or at worst n^2 if you do it recursively, with n being the number of lines.
css-text-4 introduces
text-wrap: multi-line
As discussed in https://github.com/w3c/csswg-drafts/issues/672#issuecomment-264016117, It could be useful to give a suggestion as to one possible algorithm. This would not prevent implementors from trying to come up with something better, but for those who are willing to go ahead an implement this without themselves being experts at line breaking algos, giving a reasonably non controversial baseline approach would be useful.