3 ms·
> `text-transform: newspaper` is nothing like Knuth-Plass According to Bramstein, who seems to be the source for this claim, after he implemented K-P in browse
by gwern 5y ago
> `text-transform: newspaper` is nothing like Knuth-Plass
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 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.
- chrismorgan 5y agoAh hah, good to know; I didn’t find that comment in my search. Seems odd to me because the main screenshot I’ve seen <https://www.mediumwell.com/wp-content/uploads/newsprint-justify-example.gif https://www.mediumwell.com/wp-content/uploads/newsprint-just...> exhibits identical line-breaking to greedy, just with inter-character spacing being done. On reflection, the narrow width combined with lack of hyphenation does make that a rather pathological case where there’s not much for Knuth-Plass to work with, beyond perhaps lines 14–16. (I haven’t actually tried Knuth-Plass on it.) Well, even if it did activate Knuth-Plass, it also enabled inter-character spacing which is rather bad for English and a most curious combination. 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.