-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyphenation and Justification #44
base: master
Are you sure you want to change the base?
Conversation
merging own work on hyphenation and justification
I did some coarse benchmarks of the
Lower reflow times represent gains from memoizing calls to |
This breaks the timeline example |
Thanks for bringing that to my attention; I've revised the careless re-ordering of parameters that lead to this problem. |
This pull request rewrites measureText.js to support hyphenation via Bram Stein's hypher.js library, and changes the output format of the
measureText()
function to include fragment widths, whichdrawText()
in CanvasUtils.js can use to set full-justified text blocks.The original version contains an O(n2)
while(words.length) { words.shift() }
construction (measureText.js line 86). I believe this version has O(n) time complexity, but I still need to profile this version against the old one.I've kept an eye toward including Knuth & Plass, high-quality O(n2) linebreaking in the future.