Reputation: 2557
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, if 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
k
Upvotes: 0
Views: 699
Reputation: 53890
If 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.
Upvotes: 1