TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

TeX line breaking algorithm in JavaScript (and HTML5 Canvas)

86 pointsby bramsteinover 15 years ago

5 comments

stralepover 15 years ago
Why current browsers are not using this, or some improved version of this algorithm?
评论 #1134694 未加载
评论 #1134680 未加载
评论 #1134874 未加载
patrickgover 15 years ago
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!
评论 #1134687 未加载
评论 #1134672 未加载
ZeroGravitasover 15 years ago
Does the TeX algorigthm reduce <i>rivers</i> in the text, or is that just a coincidence?<p><a href="http://en.wikipedia.org/wiki/River_(typography)" rel="nofollow">http://en.wikipedia.org/wiki/River_(typography)</a><p>edit: re-reading this seems to follow naturally from reducing the size of the gaps between words, which the algorithm does.
评论 #1134620 未加载
评论 #1134742 未加载
spicyjover 15 years ago
Impressive!<p>Doesn't work in iPhone, sadly. Not sure why not, because Canvas is supported, I think.<p>Might be possible to make text selectable, but looks like a huge chore: <a href="http://stackoverflow.com/questions/1451635/how-to-make-canvas-text-selectable/1457088" rel="nofollow">http://stackoverflow.com/questions/1451635/how-to-make-canva...</a>
评论 #1135371 未加载
grayrestover 15 years ago
Do you have any plans on intra-character spacing as well? I know this is done in print to reduce the word gaps in justified text but I'm not sure if the resolution on screen would allow it.<p>I have a &#38;shy; hyphenator using Liang's algorithm as a YUI3 module if you're interested.
评论 #1134717 未加载
评论 #1135385 未加载
评论 #1134827 未加载