How can batik be used to work out the bounds of a text element in an SVG doc?

For example return a Rectangle2D object? Or the width and height of the element (a corner x,y co-ordinates are already defined in the element, once I have the width and height to then I know the bounds)

I need the solution to take into account any CSS styling or other styling that the text may have.

I've tried to walkthrough the batik code and the answer is definitely in there somewhere but there are too many classes with similar names and it is not obvious how they interact.

I found the SVGTextElementBridge class which does have a getTextBounds method that returns a Rectangle2D. This is exactly what I'm looking for. HOWEVER, how do I initialise an instance of this class properly? and for it to operate on the SVG text element I'm interested in?

There seems to be all manner of Bridge, BridgeContexts, interfaces to set up. I've then gone on to look at each of these but they themselves require complex setups - or it's not clear which to use.

I've read through the http://xmlgraphics.apache.org/batik/ documentation but there is not enough detail here.



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

Reply via email to