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.