Hacker News new | past | comments | ask | show | jobs | submit login

This is great news. However, having a Knuth & Plass line breaking algorithm without hyphenation is like sex without a partner. Pretty much useless. The good points you get from using a total fit algorithm is much less then you lose from lack of hyphenation. If hyphenation is implemented, this will be very great!



Well, hyphenation isn’t too hard, since there are reasonable solutions that can be used directly or easily ported. (There are existing javascript hyphenation libraries floating around.)

The real problem with all of this is that everything is being done in a canvas element, which means no text selection, no searching, etc. etc.


Hyphenation is definitively on my to-do list. As you said, it will improve the output of the canvas tremendously.

The canvas is just a way to show the output of the line breaking algorithm. Earlier I had an example on my website of a dynamically created DOM paragraph using the Knuth & Plass algorithm. That way, the rendering was done by your browser (i.e. select, searching, etc. was possible) while the line breaks were handled by the algorithm. Unfortunately I haven't been able to get it reliable on all browsers, so I took it out before I posted this item. It's still on my Github repository: http://github.com/bramstein/javascript/tree/master/src/types...


I'm definitely following this and waiting for when you get the browser rendering complete. The could be really great.


Now that Firefox 2.0 is history, you can reliably use soft hyphens to hyphenate HTML text, and there are JavaScript libraries to do the hyphenation on the client:

http://www.mnn.ch/hyph/hyphenation1.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: