View Single Post
Old 02-08-2018, 04:03 PM   #96
sjfan
Addict
sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.
 
Posts: 281
Karma: 7724454
Join Date: Sep 2017
Location: Bethesda, MD, USA
Device: Kobo Aura H20, Kobo Clara HD
Quote:
Originally Posted by sherman View Post
Note that TeX and it's variants use K&P, and they also support floats, so it's not an insurmountable problem.
As Boris Zbarsky summarizes in the issue I linked above, “In CSS layout, the available width for a line depends on the exact line break positions of all previous lines. It also depends on the height of the line, which depends on the exact items that end on the line and their vertical alignment”.

That causes Knuth-Plass to fail: K-P is trying to use information about the current line to help inform where the line breaks should be on previous lines. But HTML/CSS needs the line break information about previous lines before it can even determine the width and height of the current line.

TeX, on the other hand, places floats before they wrap the surrounding text. That allows them to know the line widths ahead of time.

That issue has further discussion. The Firefox folks are familiar with TeX and would love to have better word wrapping. But it's a lot more complex problem in the case of HTML+CSS than it is in a purpose-designed typography language.

Quote:
(Note, I'm not an expert on these matters, but it is of interest for me. I've long wanted to see K&P or a similar algorithm implemented in an HTML renderer for ebooks.)
Me, too. I implement K-P for a primitive HTML 1.0 engine back in my college days.
sjfan is offline   Reply With Quote