Dmitrij Sakara wrote:

I have some SVG document and would like to insert some text element and rectangle as a border of the text. The problem is that I can’t define the size of the text (bounding box) before it is to the document and rendered. Is there some method to obtain height and width of the text element before it is rendered and even inserted into a document? I have the filling that this should be a frequent problem.

As soon as the text is inserted into a 'Dynamic' document you can use the getBBox call to get it's x,y,width & height. You can't get this information before it is in the rendered portion of the document because there is not 'graphics peer'. Also before it is in the document you couldn't do this since you can't do the CSS cascade and percentage units wouldn't have a viewport to reference.

   If you run your code in the update manager you can be sure
that there will not be a rendering until your runnable completes.
So you can append the text, get it's BBox, create your rect and
position it in the document and the complete change will be
rendered atomically.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to