Knuth and Plass line breaking algorithm in JavaScript
1–10 of 44 posts
Re: Knuth and Plass line breaking algorithm in JavaScript
#2Also, the computation takes a while. Is this a dynamic programming algorithm? Maybe browsers should support this natively.
Re: Knuth and Plass line breaking algorithm in JavaScript
#3edit: wait, they're there when I zoom out a couple levels. Weird.
Re: Knuth and Plass line breaking algorithm in JavaScript
#4I see no hyphens... breaks (eg: lines 3-4), but no markers for them. edit: wait, they're there when I zoom out a couple levels. Weird.
Re: Knuth and Plass line breaking algorithm in JavaScript
#5I must say this is a very pretty render for a web-based text. Too bad the justification breaks when zooming in/out. Also, the computation takes a while. Is this a dynamic programming algorithm? Maybe browsers should support this natively.
Re: Knuth and Plass line breaking algorithm in JavaScript
#6Re: Knuth and Plass line breaking algorithm in JavaScript
#7Re: Knuth and Plass line breaking algorithm in JavaScript
#8I must say this is a very pretty render for a web-based text. Too bad the justification breaks when zooming in/out. Also, the computation takes a while. Is this a dynamic programming algorithm? Maybe browsers should support this natively.
Yes, this is an application of dynamic programming. The computation is actually quite fast, most of the time is spent in retrieving the text metrics (put each word in a span, retrieve width and move on to the next word.) If that can somehow be alleviated it would become a feasible solution.
I agree with you that browsers should support this natively (Internet Explorer actually does.) If you are interested, I've written a bit on this subject in this Typophile thread: http://typophile.com/node/71247
Re: Knuth and Plass line breaking algorithm in JavaScript
#9Re: Knuth and Plass line breaking algorithm in JavaScript
#10It looks really good in Firefox! However, I just tried printing the page and though it still looks decent, the justification is a lot worse than when rendered on-screen.