You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Bertrand Fontaine <fo...@hotmail.com> on 2002/07/23 11:23:39 UTC

How to determine the smaller rectangle containing the info to display?

Hello!

We are using Batik/SVG to dynamically generate images displaying text. We 
are currently creating a SVG template that we load using the appropriate 
Batik API, we replace the text in the template by the text desired, and we 
then use a transcoder to save the result in an image file. What we would 
like to do now is to automatically adjust the width of the image file to the 
width of the text it displays in order to limit as much as possible the 
weight of the image file obtained (i.e., we don't want to have a large white 
region at the right of the text). Is there any way with Batik to know the 
smaller rectangle that would contain the info to display, what would allow 
us adjust the width of the SVG document as required?

Thank you very much,

Bertrand

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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


How to determine the smaller rectangle containing the info to display?

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "BF" == Bertrand Fontaine <fo...@hotmail.com> writes:

BF> Hello!  We are using Batik/SVG to dynamically generate images
BF> displaying text. We are currently creating a SVG template that we
BF> load using the appropriate Batik API, we replace the text in the
BF> template by the text desired, and we then use a transcoder to save
BF> the result in an image file. What we would like to do now is to
BF> automatically adjust the width of the image file to the width of
BF> the text it displays in order to limit as much as possible the
BF> weight of the image file obtained (i.e., we don't want to have a
BF> large white region at the right of the text). Is there any way
BF> with Batik to know the smaller rectangle that would contain the
BF> info to display, what would allow us adjust the width of the SVG
BF> document as required?

    I believe Batik now implements getBBox from SVGElement.  So if you
get the SVGTextElement from the DOM you should be able to call that
method to get the text's bounding box.

BF> Thank you very much,

    Hope that helps.

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