holographix
holographix

Reputation: 2557

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

enter image description here

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

Answers (1)

Rudie
Rudie

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

Related Questions