You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/03/08 16:15:20 UTC

C2 and SVG Generation

Does anyone have a good resource for how to generate
SVG files?  I need some input on how to programmatically
determine the width of a text object, how to perform
wrapping, etc.

The reason being that I want to generate graphical buttons
with different text.  The text size has to be relatively the
same between buttons, but the size of the button will change
depending on how much text is there.

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: C2 and SVG Generation

Posted by Conny Krappatsch <co...@smb-tec.com>.
On Thu, 08 Mar 2001 10:15:20 -0500
Berin Loritsch <bl...@apache.org> wrote:
> 
> Does anyone have a good resource for how to generate
> SVG files?  I need some input on how to programmatically
> determine the width of a text object, how to perform
> wrapping, etc.
> 
> The reason being that I want to generate graphical buttons
> with different text.  The text size has to be relatively the
> same between buttons, but the size of the button will change
> depending on how much text is there.

I wanted to do the same but didn't find a solution.

I decided to do the opposite - fix the size of the image and scale the
text.

As far as I know, SVG itself doesn't provide functions for calculating the
size of a text. Thus it has to be done before creating the SVG. (I hope
I'm wrong! ;-)

Conny

-- 
______________________________________________________________________
Conny Krappatsch                              mailto:conny@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: C2 and SVG Generation

Posted by "Bruce G. Robertson" <br...@mta.ca>.
As I've found at http://www.heml.org, the best way to do complex
SVG generation is with the svggen, now Batik, toolkit. 
This allows you to draw your graphic within the Java 2D API and 
export it to svg. Depending on your need, you could implement
this as a cocoon generator or, as in my case, a transformer.

I've just now tackled the issue of wrapped text. If you don't
mind getting glyphs instead of text in the svg, then you can
use the standard Java 2D TextLayout tools. I wish to make my
SVG lightweight and searchable, though, so I did a hack on the 
TextLayout technique. Unfortunately, richly styled text
is not available with this approach.

This code should be available in CVS in the next couple of
weeks. Email me if you need an example right away.

Yrs,
-- 
Bruce Robertson, Dept. of Classics, Mount Allison University
http://www.mta.ca/faculty/humanities/classics/Robertson/ 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>