3 ms·
Do HTML and CSS rendering engines implement Knuth paragraph layout yet? AIUI, they still use greedy line layout and justification, which can produce various art
by quotemstr 8y ago
Do HTML and CSS rendering engines implement Knuth paragraph layout yet? AIUI, they still use greedy line layout and justification, which can produce various artifacts (like whitespace rivers and orphan lines) that the Knuth-style linebreaking in TeX avoids. Right now, I still don't think I'd consider using anything but TeX or some heavyweight DTP package for printed material.
- sanxiyn 8y agoAs I understand, Prince XML, which is a CSS rendering engine, uses variant of Knuth-Plass line breaking. They have samples on homepage, so judge for yourself. It's most certainly not greedy. No CSS implementation "for the web" does. Implementing CSS justification for printing as Knuth-Plass and implementing so in a web-compatible manner is somewhat very different task. I think the algorithm's interaction with CSS floats is unclear. As always, it's in the Firefox's bug tracker, no, it's not because browser vendors don't want to or are lazy. https://bugzilla.mozilla.org/show_bug.cgi?id=630181 https://bugzilla.mozilla.org/show_bug.cgi?id=630181
- trynewideas 8y agoApache FOP[1] does[2] if you're willing to jump back in time to XHTML or use an HTML2FO converter. As always, Unicode is a problem. 1: https://xmlgraphics.apache.org/fop/ https://xmlgraphics.apache.org/fop/ 2: https://xmlgraphics.apache.org/fop/0.95/hyphenation.html https://xmlgraphics.apache.org/fop/0.95/hyphenation.html cf. https://wiki.apache.org/xmlgraphics-fop/HowTo/HtmlToPdf https://wiki.apache.org/xmlgraphics-fop/HowTo/HtmlToPdf
- sanxiyn 8y agoThat's Knuth-Liang hyphenation, which is something different from Knuth-Plass line breaking.
- trynewideas 8y agoOh, good catch, sorry about that. Simon Pepping did some work done on Knuth-Plass in FO, but it's old and probably not quite as relevant now: - https://web.archive.org/web/20070114211331/http://www.leverkruid.eu:80/GKPLinebreaking/elements-xhtml.xml https://web.archive.org/web/20070114211331/http://www.leverk... - https://web.archive.org/web/20070128145517/http://www.leverkruid.eu/GKPLinebreaking/index.html https://web.archive.org/web/20070128145517/http://www.leverk...