Bounding Box accuracy for text containing ISO (Æ) characters

Charles Seelig <[email protected]>
Newsgroups gmane.text.xml.batik.user
Message-ID <CAGhGAhqDO_NwU_FHH6XRJOpv3CuBPpgQQS07M4dkt_4u7PxfoQ@mail.gmail.com>
Hello, all.

I'm wondering if anyone could point me in the right direction re: coaxing
an SVGTextElement to return a correct bounding box when the text contains
ISO encoded characters.

SVGDocument doc = makeSvgDocument(svgString);

SVGTextElement svgTextElement = (SVGTextElement) doc.getElementById("textID"
);

svgTextElement.getFirstChild().setNodeValue("&#913;&#937;");

float width = svgTextElement.getBBox().getWidth();


My document is created as follows -

protected SVGDocument makeSvgDocument(String svgString) {

SVGDocument svgDoc = null;

@SuppressWarnings("unused")

GraphicsNode rootGN;

UserAgent userAgent    = new UserAgentAdapter();

DocumentLoader loader  = new DocumentLoader(userAgent);

BridgeContext ctx      = new BridgeContext(userAgent, loader);

GVTBuilder builder     = new GVTBuilder();

SAXSVGDocumentFactory factory = new
SAXSVGDocumentFactory(SAXParser.class.getCanonicalName(),
true);

try {

svgDoc = (SVGDocument) factory.createDocument("file:///dummy/dummy/file.svg",
new StringReader(svgString));

ctx.setDynamicState(BridgeContext.DYNAMIC);

rootGN = builder.build(ctx, svgDoc);

} catch (IOException e) {

e.printStackTrace();

}

return svgDoc;

}

It appears to me that the result (especially evident for width) is
calculated as if the 1 character is actually 6 characters.

Thank you.

Best regards,

Charles Seelig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.