开发者

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

html5 text manipulation

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

k


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜