09 6 / 2010
TypeSet: An implementation of the TEX Line Breaking Algorithm in JavaScript
Bram Stein has written an implementation of the Knuth and Plass line breaking algorithm using the HTML5 canvas element. The algorithm takes care of all aspects of laying out text in an aesthetically pleasing way, including justified text, centered text, text wrapping around shapes such as images, and even creating non-rectangular shapes from the text itself. Because it is written using the canvas element, complete control over the layout is possible, but the text is not yet selectable.
Very cool. Sounds like it could be used to implement a decent word processor with actual text layout capabilities on the web! You can check out the post and demo here, and see the source code at the bottom of that page.