Hi Cameron, Thanks for the example. I have used that already. The problem i have been facing is that I use Adobe illustrator to create an SVG. Actually a graphic designer would create it for me. And i provide this SVG to my jsp and extract all the text fields and display it in a html form for the user to change the text.
When the SVG is exported from Adobe Illustrator, it puts its own <foreignObject> tags in which it uses a <flow> tag with alignment information(for eg: text-align: center). But the <text> svg tag just has the x and y info. so if the user types a smaller text compared to the original text, the text seems to be shifted left ie it doesnt appear to be aligned like the original text.. Should i be parsing the svg xml for adobe specific information to see if there is a text-align and then insert text-anchor tags in my DOM, or is there a export mechanism is adobe ills so that i can ask it to put these tags for me. thanks for all your input, I really appreciate it. Ananth On Sat, 14 Feb 2004, Cameron McCormack wrote: > Hi Ananth. > > ananth balasubramanyam: > > I am new to batik and I have been struggling to get a grasp of the SVG DOM > > Implementation. I went through the batik website and looked at the > > examples of creating a Document from a SVG file. I am trying to parse the > > SVG DOM tree and identify all the text nodes. > > > > When i create an SVG from adobe illustrator and have a text that is > > aligned center, the resulting svg has the text with the x and y > > co-ordinates, but no information about the alignment. so if i replace this > > text programmatically in java, then the text is no longer aligned center > > if it is shorter than the original text. Can somebody please suggest a way > > i do this. please provide some example code if possible. Thanks in > > advance. > > Ananth > > If you are just worried about horizontal centering, you can use the > text-anchor property to horizontally center it over the x coordinate you > specify. > > <text x="100" y="100" text-anchor="middle"> > Some text > </text> > > Even if you change the text, it will still be centered over x="100". > There is no equivalent vertical centering, however. > > Cameron > > -- > Cameron McCormack > | Web: http://mcc.id.au/ > | ICQ: 26955922 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
