Re: size of text box

Hi Immanuel,


Welcome to the community! :-)


> is there a js method to calculate the size of a text box?
> The scenario I have in mind: I want to render text in a speech bubble and of
> cause the speach bubble size should be adjusted to the text.
> (what I am looking for is something like the contentBox  in the dojo
> framework).

First of all, note that "[t]his mailing list is for technical
discussion on Scalable Vector Graphics (SVG) and its specifications"
so I'd recommend redirecting future threads to authoring/development
related channels such as SVG Developers [2]. ;-)

For calculating the size of any locatable element you may use its
"getBBox" [3] DOM method. This is generic (not specific to text) and
works quite well for most use-cases. :-)

There are also related, text-specific methods/properties for
determining string and/or character dimensions which one may be
interested in.


> regards,
> Immanuel

Hope this helps,
 Helder


[1] http://lists.w3.org/Archives/Public/www-svg/
[2] http://tech.groups.yahoo.com/group/svg-developers/
[3] http://www.w3.org/TR/SVG/ecmascript-binding.html

Received on Wednesday, 24 February 2010 13:38:29 UTC