On Wednesday 18 July 2001 15:26, Kiril Sramko wrote:
> Hi, I just started with SVG, cocoon and batik.
>
> I can't find a solution in the docs for the problem I've got to solve. I
> need to know the length of a string I'm getting from a XML-file in px for
> the width of the generated JPG. Im formating this string with different
> CSS-styles, so I have to account the style.
>
> Is there a way to generate just the graphic of the string with  a CSS-file
> in the buffer an the detect the width of the graphic?

There is no way at this time to know the length of a string in batik. Though 
using the SVG DOM you are able know that information - it's a really really 
complicated things to compute (depending of the style of the text element, 
additional tspan, svg font, mixed system and svg font, filter...) and 
the method is not supported yet.

The only thing you can do is dealing with Java2D API to compute the length of 
a string for a particular font and consider that batik will display the 
string using the same metrics (except that our work is done in 96dpi and 
Java2D is in 72dpi).

Hope this helps,
Thierry.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to