xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <...@mcc.id.au>
Subject Re: Define String Width with bounding box
Date Thu, 30 Oct 2008 02:57:27 GMT
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 (&#x160;) doesn’t seem to help
either, unfortunately.

-- 
Cameron McCormack ≝ http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message