xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <cam-batik-us...@aka.mcc.id.au>
Subject Re: example please
Date Sat, 14 Feb 2004 00:55:47 GMT
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: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message