Hi all,
I'm trying to find the width of a String, but i've a little problem.
in fact, i use getBBox() to find it, and it works ... but not in one case.
I have two test String :
"blabla bla"
"blabla bla "
getBBox() gives me the same length for the two String. It seems that it
doesn't take the last blankspace.
Here is my method :
private int getSVGStringWidth(String string, int fontSize){
Element retourLigne = (Element)docCalcul.createElementNS(svgNS,
"text");
retourLigne.setAttributeNS(null,"x", "0");
retourLigne.setAttributeNS(null,"y", "0");
retourLigne.setAttributeNS(null,"font-family", "Verdana");
retourLigne.setAttributeNS(null,"font-size",String.valueOf(fontSize));
Text tmpText = docCalcul.createTextNode(string);
retourLigne.appendChild(tmpText);
docCalcul.getDocumentElement().appendChild(retourLigne);
int retour = (int)((SVGLocatable)retourLigne).getBBox().getWidth();
docCalcul.getDocumentElement().removeChild(retourLigne);
return retour;
}
.
If someone have some advice, it could help me :)
Cheers,
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]