
Thanks for the comments Bulia. You've helped me appreciate all of the complexities that could factor into calculating the bounding box for text elements. I should have known it wouldn't be that easy, as I've got some knowledge of graphics rendering in Java.
I'm writing a plug-in for an open source Java applicaiton, so I don't know that I can tightly couple to Inkscape as you suggest (although it sounds very interesting).
I think my best option at this point may be guestimating the bounding box size. This make take some trial and error, but I can probably get something to work with a default font, font size, stroke, fill, etc.
I appreciate everyone's comments. I will make sure I post my source code (GPL) and some of the results of my work when I get the kinks worked out.
Landon
2010/3/17 bulia byak <buliabyak@...400...>:
2010/3/15 Krzysztof KosiĆski <tweenk.pl@...400...>:
Please don't do this... Our flowed text is not compatible with SVG 1.1. It might be compatible with SVG 1.2, but that specification is not yet finalized. Moreover the SVG version attribute on Inkscape SVGs is 1.1, which is clearly wrong. It's actually the worst SVG incompatibility in Inkscape.
That is true, but it doesn't address the original question. Whether you use flowed or regular text, the problem of finding its bbox from a script is the same.
And the solution is also the same: you should run Inkscape with --query-id or --query-all command line parameters and parse the output. In most cases this is infinitely easier than writing your own SVG processor that would correctly take into account chained transforms, font metrics, stroke and filters, etc. etc.
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org