Thanks for the response Peter. You've nicely condensed what I have learned from this thread but failed to state as eloquently.
I like your suggestion of using bounding box calculations to avoid labeling conflicts. I think I can handle a lot of this in the Java program. But I'll save that for a subsequent release. Right now I just want to get something simple working. :]
Landon
On Thu, Mar 18, 2010 at 5:12 AM, Peter Moulder <Peter.Moulder@...38...> wrote:
As Alex indicated, you don't necessarily need to know the bounding box if using just a <text> element: the SVG only needs to know the position (and you can set text alignment according to whether it's most convenient to specify start, middle or end of the text).
If writing multiple lines, then you need to know a reasonable line height, though this is an aesthetic/typographical decision as much as anything; without checking what I've used myself, a reasonable starting point might be 1.2 * font-size.
The main reason to ask Inkscape for a bounding box (as Bulia describes in the previous message) would be if you need to make decisions based on avoiding overlap between text and other things.
Re getting this information from a Java program: without having looked for very long, I don't see a popen-like method in Java. The closest I found was http://www.devdaily.com/java/java-exec-system-command-pipeline-pipe (which mentions the Apache exec project as another implementation).
If all else fails, you can no doubt get an approximate answer from Java's text-formatting stuff, e.g. see http://java.sun.com/docs/books/tutorial/2d/text/measuringtext.html
pjrm.