xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bibek Sahu <scor...@dodds.net>
Subject Re: editing text (via. Java) in Batik
Date Tue, 30 Dec 2003 22:10:52 GMT

True, but with respect to text nodes, that mapping is a little different:

Suppose I have the SVG code:

	<text>
		blahblahblah
		<tspan style="font-size:20">BIG!</tspan>
		blahblah
	</text>


In the DOM, then, you have an SVGTextElement node, along with a #text
node, the tspan (with its child #text), and another #text.

But when Batik bridges that to GVT, it creates a single TextNode for the
whole <text> element, with an AttributedCharacterIterator which keeps
track of the font size et. al.  It also keeps a list of TextRuns, which
correspond (essentially) to the three chunks of text.

If I'm starting with the SVGElement and trying to trace that to the
appropriate TextNode, this isn't a big problem.  But if I'm starting with
the TextNode and trying to trace it to the Element for the inner "Big!", I
get stuck.  If there is a way to follow the TextNode or TextRuns to the
appropriate tspan, tpath, etc., I haven't found it (if you know, I'd love
to hear of it :-).


Thank you for your help.  I do appreciate it.

Sincerely,
Bob


On Tue, 30 Dec 2003, Guillaume Pothier wrote:

> The mapping between nodes and elements is maintained in the
> BridgeContext. (BridgeContext.getElement (GraphicNode aNode).
>
> Bibek Sahu wrote:
> > Howdy all,
> >
> > I'm currently working on an SVG editor based on Batik, as part of some
> > educational software.  Currently, I'm trying to figure out some stuff about
> > editing text.
> >
> > What I'm wondering is: how do I modify formatted text inside an SVG, from
> > Java code?
> >
> > The reason I'm stuck is because when working with GraphicsNodes (TextNodes,
> > specifically), only one is accessible for an entire text element, even when
> > that text element contains sub-elements (textPath, tspan, tref, etc.).  I
> > can use TextNode.getTextRuns() to get the list broken down as a list of
> > StrokedTextPainter.TextRun objects, which is sufficient for displaying them,
> > but as near as I can tell there's no way to get the SVGElements which
> > they're tied to (which is necessary to manipulate them).
> >
> > Am I barking up the wrong tree?  Should I be watching for DOM events
> > instead?
> >
> > Any help would be greatly appreciated.
> >
> > Thanks!
> >
> > - Bibek
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>


---------------------------------------------------------------------
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