html5 text manipulation
I'm trying to write a piece of software to grab strings and pack them in and ordered layout, like in the image below
I think that to achieve that result the first step I'd take would be being able to calculate the size of a single string in the canvas in order to modify the font-size to fit the desired width.
so, i开发者_如何学Pythonf any1's got a solution to some built-in function, or a way to perform it so that I can code it myself that would be nice (very nice).thanks in advance
kIf you decide to do it without CANVAS, this might come in useful: how to calculate a letter's width: http://jsfiddle.net/rudiedirkx/sCUac/ in a specific font with a specific size.
edit
Or a sentence's width.
精彩评论