Hi Cameron, thanks for your reply.
Cameron McCormack a écrit :
Hi Thomas.
Thomas Palfray:
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.
If you want it to consider all spaces in the <text> element literally,
then you should set xml:space="preserve" on the element:
tmpText.setAttributeNS
("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
However, it seems that spaces at the start and end of the element don’t
contribute to the bounding box, even if xml:space="preserve". That
seems to be a bug, so I’ve filed this:
https://issues.apache.org/bugzilla/show_bug.cgi?id=46127
Replacing it with a non-breaking space (Š) doesn’t seem to help
either, unfortunately.
So it's a bug of Batik ... So bad. I need this feature because i use
BBox for doing diplomatic text rendering.
Maybe i can substitute the blankspace caracter with another one which
have the same size. Any idea of which caracter could be use for that ?