Knuth and Plass line-breaking Revisited
defoe.sourceforge.net
defoe.sourceforge.net
Knuth-Plass line-breaking is cool, and it's something I've looked at a fair bit for my own website, because it would likely help with fixing blatant nastiness on mobile browsers (where you get a lot of stretched lines or large gaps, particularly when stuff like blockquotes or lists narrow the width further).
But every HTML/JS version of Knuth-Plass (and/or microtypography adjusting spacing/glyph size) seems to be a performance abomination and fragile†, and web browsers have clearly signaled that they are never going to provide better native typesetting (even as their greedy linebreaking means that it doesn't work as well as you'd assume to insert linebreaking/nobreak character entities to try to control it).
† One person a few years ago did a cool approach where they precomputed every possible screen width to provide the exact layout tailored to a reader's screen width, since there's only a few thousand reasonable screen widths & K-P screams... And their demo is already broken in browsers. Bleh.
Adobe even created a streaming version of the algorithm. It's mind-boggling that e-readers don't implement it.
Hell, even Internet Explorer used Knuth-Plass to justify text.
I haven’t heard of this before, and I don’t believe it’s at all correct.
Searching, I’m finding only https://elliotjaystocks.com/blog/justification-hyphenation/ to be relevant: “Internet Explorer, which seems to use the Knuth / Plass algorithm, or an approximation of it, enabled through the text-justify: newspaper CSS property.” `text-transform: newspaper` is nothing like Knuth-Plass: rather, it was what is currently spelled `text-transform: inter-character`, which is a terrible idea for English.
According to Bramstein, who seems to be the source for this claim, after he implemented K-P in browsers, he checked IE's 'newspaper' against his own implementation, and it delivered almost identical results: https://news.ycombinator.com/item?id=5189258
>> I could be mistaken, but I'm fairly certain Internet Explorer implements the Knuth and Plass algorithm when using `text-justify: newspaper`. Unfortunately, I can't check because it isn't open source. The output however is pretty much identical to what my JavaScript version generates, so I'm inclined to believe it is the Knuth and Plass algorithm.
I’m almost tempted to get out a VM with old IE (I’m guessing it was removed by IE9, though I suppose I could check it on IE11 first which I do have ready access to) and compare it more.
I realize if you remembered a link or name you'd probably have mentioned it, but just in case, do you...?
https://github.com/jaroslov/knuth-plass-thoughts/blob/master...
I don’t think that’s accurate. There’s enough interest that the CSS Text Module Level 4 draft expands the white-space CSS property to cover more line-breaking stuff, including a text-wrap property that lets you control the line-breaking algorithm <https://drafts.csswg.org/css-text-4/#text-wrap>; to be sure, no browser has implemented it yet, and not everything that’s in such drafts ever gets implemented, but it shows interest at the least. Firefox also has a long-standing bug for it, https://bugzilla.mozilla.org/show_bug.cgi?id=630181, where you can see definite interest from key Firefox developers (so long as the performance hazards are managed), though they personally are unlikely to implement it, so it’s most likely to happen if someone external decides to put effort into it.