Thanks Tonny, that was it exactly. Just for anyone's future reference, the
working code is included below.
Thanks again.
---------------------------------
public BBoxTest() {
DOMImplementation impl =
SVGDOMImplementation.getDOMImplementation();
SVGDocument doc = (SVGDocument)
impl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null);
UserAgent userAgent = new UserAgentAdapter();
DocumentLoader loader = new DocumentLoader(userAgent);
BridgeContext ctx = new BridgeContext(userAgent, loader);
ctx.setDynamicState(BridgeContext.DYNAMIC);
GVTBuilder builder = new GVTBuilder();
builder.build(ctx, doc);
Text header = doc.createTextNode("Hello");
Element text =
doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI,
SVG12Constants.SVG_TEXT_TAG);
text.setAttributeNS(null, "x", "100");
text.setAttributeNS(null, "y", "100");
text.setAttributeNS(null, "fill", "orange");
text.setAttributeNS(null, "font-family", "verdana");
text.setAttributeNS(null, "font-weight", "bold");
text.setAttributeNS(null, "font-size", "20");
text.appendChild(header);
doc.getDocumentElement().appendChild(text);
SVGRect rect = ((SVGLocatable)text).getBBox();
System.out.println("X: " + rect.getX() + "\nY: " + rect.getY() +
"\nHeight: " + rect.getHeight() + "\nWidth: " + rect.getWidth());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]