Hi Andy. Andy Hall: > I'm currently writing a small Java tool for generating SVG files from > a set of data. At the moment I have am generating the SVG in a > rather naive way, by sticking data values into a SVG template, which > works well enough for the structures I'm generating. However I will > need to add text to the images, more specifically variable length > lines of text. I require this text to be word wrapped within a > defined area and for separate blocks of text to be stacked on top of > each other. > > I've been planning on using Batik's swing component for the purpose > of previewing these images, but I was wondering if I would be able to > solve my text problem with Batik's other components. > > I'd be really grateful if someone could point me in the right direction.
You have two choices for laying out text in SVG. The first is to write some script that will determine the linebreaks and lay out the text manually. For a greedy text layout (try to put the next word on the line, and if it overflows the desired maximum line width, put a line break there) this is not too hard. This will be compatible with other SVG 1.1 implementations. Alternatively, you can use Batik’s flowText support. Here’s an example: http://svn.apache.org/repos/asf/xmlgraphics/batik/trunk/samples/tests/spec12/text/flowText.svg Note that this syntax for flowing text comes from a draft of SVG 1.2 Full, which will likely change at some point. Cameron -- Cameron McCormack, http://mcc.id.au/ xmpp:[EMAIL PROTECTED] ▪ ICQ 26955922 ▪ MSN [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
