List Info

Thread: using SVG 1.2 implementation




using SVG 1.2 implementation
user name
2007-09-26 19:53:14
What is the recommended way of telling JSVGCanvas to use SVG
1.2 implementation?
I notice that there is SVG12DOMImplementation class, but
SVGDomImplementation is used by default (it is hardwired in
SAXSVGDocumentFactory constructor, which is called from
DocumentLoader
constructor when JSVGComponent.loadSVGDocument is called)

Yaroslav

On 9/26/07, Heiska Anssi <Anssi.Heiskainsta.fi> wrote:
>
> Hi
>
> I have a problem that seems to be quite simple, but I
have had quite a
> headache trying to solve it.
>
> I have an external library that produces SVG-images
(pretty simple,
> lines, paths, rectangles, circles, polygons, and text,
nothing fancy). I
> also have an external component where I need to draw
these images (this
> I can't change, so using JSVGCanvas is not possible).
Everything else
> works just fine, but I am having trouble with texts. In
certain
> circumstances texts need to be drawn upside down. Ascii
is an bit bad
> format to present what I mean, but hopefully next image
helps to
> understand:
>
> Library produces:
> +--------+
> |   AW   |
> |        |
> +--------+
>
> And it needs to be converted to:
> +--------+
> |   VM   |    // V is A upside down and M is W upside
down
> |        |    // note that this is not rotated string,
only each letter
> +--------+    // is rotated
>
> I've figured out that the AffineTransformation I need
to use is simple
> scale(1.0, -1,0), but the problem is that the TextNodes
do not seem to
> do transformation at all. Here is how I have tried to
solve the
> situation:
>
> First I naturally build a GVT-tree from a generated
SVG-document. When
> encountering a TextNode I've tried following:
>
> AttributedCharacterIterator iter =
> textnode.getAttributedCharacterIterator();
>
> if (iter == null) {
>    return;
> }
>
> AttributedString text = new AttributedString(iter);
>
> // I doesn't matter if rotate_letters is concatenated
with orig or not
> AffineTransform orig = textnode.getTransform();
> AffineTransform rotate_letters =
AffineTransform.getScaleInstance(1.0,
> -1.0);
> rotate_letters.concatenate(orig);
>
> TransformAttribute tranformAttribute = new
> TransformAttribute(rotate_letters);
>
text.addAttribute(java.awt.font.TextAttribute.TRANSFORM,
> tranformAttribute);
>
> // this doen't seem to have effect
>
textnode.setAttributedCharacterIterator(text.getIterator());

>
> textnode.paint(g2d);
>
>
> Also following does not work
>
> // I doesn't matter if rotate_letters is concatenated
with orig or not
> AffineTransform orig = textnode.getTransform();
> AffineTransform rotate_letters =
AffineTransform.getScaleInstance(1.0,
> -1.0);
> rotate_letters.concatenate(orig);
>
> textnode.setTransform(rotate_letters);
>
>
> These and all other solutions I've tried do not seem to
work at all
> (text doesn't change). Can anyone point me to right
direction or tell
> what I am doing wrong? Thanks in advance.
>
>
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
> For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org


Re: using SVG 1.2 implementation
country flaguser name
United States
2007-10-04 07:04:49

Hi Yaroslav,

"Yaroslav Bulatov&quot; <yaroslavvbgmail.com&gt; wrote on 09/26/2007 08:53:14 PM:

&gt; What is the recommended way of telling JSVGCanvas to use SVG 1.2
> implementation?

   Add 'version=&quot;1.2&quot;' to the root SVG Element.

> I notice that there is SVG12DOMImplementation class, but
> SVGDomImplementation is used by default (it is hardwired in
> SAXSVGDocumentFactory constructor, which is called from DocumentLoader
> constructor when JSVGComponent.loadSVGDocument is called)
>
> Yaroslav
>
> On 9/26/07, Heiska Anssi <Anssi.Heiskainsta.fi&gt; wrote:
&gt; >
>; > Hi
> >
>; > I have a problem that seems to be quite simple, but I have had quite a
> > headache trying to solve it.
> >
>; > I have an external library that produces SVG-images (pretty simple,
> > lines, paths, rectangles, circles, polygons, and text, nothing fancy). I
> > also have an external component where I need to draw these images (this
> > I can't change, so using JSVGCanvas is not possible). Everything else
&gt; > works just fine, but I am having trouble with texts. In certain
> > circumstances texts need to be drawn upside down. Ascii is an bit bad
> > format to present what I mean, but hopefully next image helps to
> > understand:
> >
>; > Library produces:
> > +--------+
> > |   AW   |
> > |        |
> > +--------+
> >
>; > And it needs to be converted to:
> > +--------+
> > |   VM   |    // V is A upside down and M is W upside down
>; > |        |    // note that this is not rotated string, only each letter
&gt; > +--------+    // is rotated
> >
>; > I've figured out that the AffineTransformation I need to use is simple
&gt; > scale(1.0, -1,0), but the problem is that the TextNodes do not seem to
> > do transformation at all. Here is how I have tried to solve the
> > situation:
> >
>; > First I naturally build a GVT-tree from a generated SVG-document. When
> > encountering a TextNode I've tried following:
> >
>; > AttributedCharacterIterator iter =
> > textnode.getAttributedCharacterIterator();
> >
>; > if (iter == null) {
> >    return;
> > }
> >
>; > AttributedString text = new AttributedString(iter);
> >
>; > // I doesn't matter if rotate_letters is concatenated with orig or not
> > AffineTransform orig = textnode.getTransform();
> > AffineTransform rotate_letters = AffineTransform.getScaleInstance(1.0,
>; > -1.0);
&gt; > rotate_letters.concatenate(orig);
> >
>; > TransformAttribute tranformAttribute = new
> > TransformAttribute(rotate_letters);
> > text.addAttribute(java.awt.font.TextAttribute.TRANSFORM,
> > tranformAttribute);
> >
>; > // this doen't seem to have effect
&gt; > textnode.setAttributedCharacterIterator(text.getIterator());
&gt; >
>; > textnode.paint(g2d);
> >
>; >
>; > Also following does not work
>; >
>; > // I doesn't matter if rotate_letters is concatenated with orig or not
> > AffineTransform orig = textnode.getTransform();
> > AffineTransform rotate_letters = AffineTransform.getScaleInstance(1.0,
>; > -1.0);
&gt; > rotate_letters.concatenate(orig);
> >
>; > textnode.setTransform(rotate_letters);
&gt; >
>; >
>; > These and all other solutions I've tried do not seem to work at all
> > (text doesn't change). Can anyone point me to right direction or tell
>; > what I am doing wrong? Thanks in advance.
> >
>; >
>; >
>; >
>; > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
> > For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org
> >
>; >
>;
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribexmlgraphics.apache.org
> For additional commands, e-mail: batik-users-helpxmlgraphics.apache.org
>
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )