You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Frédéric Lanic <fr...@syselog.com> on 2005/03/07 16:15:24 UTC

End of arrow in tranformation Svg to Jpeg

Hello,

I have not a correct view in a jpeg file from a svg file.

When I do the exemple script in 

   public static void main(String [] args) throws Exception 
    {
        args = new String[2];
        args[0] = "D:\\Partage\\imagesvgpetite\\svg\\";
        args[1] = "une_fleche.svg";
        
        String fileName =  Test.getFileName(args[0], args[1]);
        
        // create a JPEG transcoder
        JPEGTranscoder t = new JPEGTranscoder();
        // set the transcoding hints
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,  new Float(1));
        // create the transcoder input
        String svgURI = new File(fileName).toURL().toString();
        TranscoderInput input = new TranscoderInput(svgURI);
        // create the transcoder output
        OutputStream ostream = new FileOutputStream(args[0] + "out.jpg");
        TranscoderOutput output = new TranscoderOutput(ostream);
        // save the image
        t.transcode(input, output);
        // flush and close the stream then exit
        ostream.flush();
        ostream.close();
        System.exit(0);
    }

the "end of arrow" are not viewed.

I'd like to be helped !

Thank you.



Re: Parsing svg file

Posted by Frédéric Lanic <fr...@syselog.com>.
Hi Thomas,
Thank you for your help. It's work.
Regards,
Frederic

----- Original Message ----- 
From: "Thomas DeWeese" <Th...@Kodak.com>
To: <ba...@xmlgraphics.apache.org>
Cc: <ba...@xml.apache.org>
Sent: Tuesday, March 15, 2005 1:27 AM
Subject: Re: Parsing svg file


> Hi Frédéric,
>
> Frédéric Lanic wrote:
>
> > I'm parsing a svg file to complete it. My parser is jdom.
> > But, my problem is the encoding.
> > The svg file is utf-8 encoding. There are some accents inside.
> > When I save it, all the utf-8 characters loaded are not utf-8 saved.
> > I do not see where is the mistake.
> > Here's my little code :
>
> >     XMLOutputter outputter = new XMLOutputter("", false, "UTF-8");
> >     FileWriter writer = new FileWriter(sFileName);
>
>     This uses "the default character encoding"  I don't know what
> that is for your platform.  I would suggest that you create
> a FileOutputStream and wrap it with an OutputStreamWriter which
> allows you to specify the encoding to be used.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: Parsing svg file

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Frédéric,

Frédéric Lanic wrote:

> I'm parsing a svg file to complete it. My parser is jdom.
> But, my problem is the encoding.
> The svg file is utf-8 encoding. There are some accents inside.
> When I save it, all the utf-8 characters loaded are not utf-8 saved.
> I do not see where is the mistake.
> Here's my little code :

>     XMLOutputter outputter = new XMLOutputter("", false, "UTF-8");
>     FileWriter writer = new FileWriter(sFileName);

    This uses "the default character encoding"  I don't know what
that is for your platform.  I would suggest that you create
a FileOutputStream and wrap it with an OutputStreamWriter which
allows you to specify the encoding to be used.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Parsing svg file

Posted by Frédéric Lanic <fr...@syselog.com>.
Hello,

I'm parsing a svg file to complete it. My parser is jdom.
But, my problem is the encoding.
The svg file is utf-8 encoding. There are some accents inside.
When I save it, all the utf-8 characters loaded are not utf-8 saved.
I do not see where is the mistake.
Here's my little code :
Loading :
     // Build the document with SAX and Xerces, no validation
     SAXBuilder builder = new SAXBuilder();
      // Create the document
      File inputFile = new File(pathName + fileName); // rajout 040105
      FileInputStream fileInputStream = new FileInputStream(pathName +
fileName);
      InputStreamReader inputStreamReader = new
InputStreamReader(fileInputStream, "UTF-8");

      //File fFile = new File(new String(pathName + fileName));
      Document doc = builder.build(inputStreamReader, "UTF-8");
      Element nRoot = doc.getRootElement();
Parsing (not viewed)
Saving:
    XMLOutputter outputter = new XMLOutputter("", false, "UTF-8");
    FileWriter writer = new FileWriter(sFileName);
    outputter.setEncoding("UTF-8");
    outputter.output(doc, writer);
    writer.close();

If any one has got an idea, thank you.

Best regards,

Frederic Lanic


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: End of arrow in tranformation Svg to Jpeg

Posted by Frédéric Lanic <fr...@syselog.com>.
Thank you Thomas, it seems to work well adding overflow="visible".

Fred
----- Original Message ----- 
From: "Thomas DeWeese" <Th...@Kodak.com>
To: <ba...@xml.apache.org>
Sent: Wednesday, March 09, 2005 9:50 PM
Subject: Re: End of arrow in tranformation Svg to Jpeg


> Hi Frédéric,
>
> Frédéric Lanic wrote:
>
> > I have not a correct view in a jpeg file from a svg file.
>
>     Actually I think you do have the correct view in the jpeg file.
> The Adobe SVG viewer does not properly handle markers according
> to the SVG specification.  In particular your markers do not
> specify any of markerWidth/Height, viewbox or overflow this means
> that your markers will be clipped to the box (0,0) to (3,3).
>
>      <g id="lend1">
>        <!-- NOTE: this is draw so only 1/2 of it is in the
>             range: (0,0) to (1,1) -->
>        <path d="M 1 -1 L 0 0 L 1 1 "
> style="stroke-linecap:round;stroke-linejoin:round;fill:none"/>
>      </g>
>      <marker id="mrkr1-7" class="st2" v:arrowType="1" v:arrowSize="2"
>              orient="auto" markerUnits="strokeWidth">
> <use xlink:href="#lend1" transform="scale(3.1) "/>
>      </marker>
>
>
>     The simplest fix is to turn off overflow clipping by adding:
>
> marker { overflow:visible; } to your stylesheet.
>
>    The correct thing to do is to specify an appropriate
> markerWidth/Height and viewbox so that the marker does not overflow
> it's viewport.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: End of arrow in tranformation Svg to Jpeg

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Frédéric,

Frédéric Lanic wrote:

> I have not a correct view in a jpeg file from a svg file.

    Actually I think you do have the correct view in the jpeg file.
The Adobe SVG viewer does not properly handle markers according
to the SVG specification.  In particular your markers do not
specify any of markerWidth/Height, viewbox or overflow this means
that your markers will be clipped to the box (0,0) to (3,3).

     <g id="lend1">
       <!-- NOTE: this is draw so only 1/2 of it is in the
            range: (0,0) to (1,1) -->
       <path d="M 1 -1 L 0 0 L 1 1 "
style="stroke-linecap:round;stroke-linejoin:round;fill:none"/>
     </g>
     <marker id="mrkr1-7" class="st2" v:arrowType="1" v:arrowSize="2"
             orient="auto" markerUnits="strokeWidth">
	<use xlink:href="#lend1" transform="scale(3.1) "/>
     </marker>


    The simplest fix is to turn off overflow clipping by adding:

	marker { overflow:visible; } to your stylesheet.

   The correct thing to do is to specify an appropriate
markerWidth/Height and viewbox so that the marker does not overflow
it's viewport.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org