You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Sebastian Hagen <Se...@in-gmbh.de> on 2003/01/16 18:59:50 UTC
Bug in PrettyPrinter? (CDATA-Tag)
Hello,
I am using Batik Pretty Printer for formated SVG Output.
First I create a SVGDocument from the following Code:
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="500" height="500">
<line x1="75" y1="285" x2="152" y2="228"
style="fill:none;stroke:rgb(149,91,91);stroke-width:2"/>
<style type="text/css"><![CDATA[path {fill-rule:nonzero;
stroke-linecap:round; stroke-linejoin:round}
rect {stroke-linejoin:miter}]]></style>
</svg>
Note that there is a CDATA Section within the code.
When I now use PrettyPrinter, I get the following result:
Please don´t worry about, if the CDATA section makes sense within this code.
<svg contentScriptType="text/ecmascript" width="500"
xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
contentStyleType="text/css" height="500"
preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
version="1.0">
<style xml:space="preserve" type="text/css"
xml:space="preserve"><![CDATA[path {fill-rule:nonzero; stroke-linecap:round;
stroke-linejoin:round}]]><![CDATA[
]]><![CDATA[ rect {stroke-linejoin:miter}]]></style>
<line y2="228.0"
style="fill: none; stroke: rgb(149, 91, 91); stroke-width: 2; "
x1="75.0" x2="152.0" y1="285.0"/>
</svg>
This code is not well formed anymore. Adobe SVG Viewer says: Double
attribute in line 7
My question now is: where do all those CDATA Tags come from. Below there is
a Java code, that shows how I am using the PrettyPrinter.
Is this a bug of PrettyPrinter, or did I do something wrong in my code.
Thanks,
Sebastian
public static void writeToFile( SVGDocument in_SVGDocument, String fileName
)
{
Reader r;
Writer w = null;
File objFile = new File( fileName );
try
{
w = new FileWriter(objFile.getPath());
}
catch (IOException ex)
{
}
PrettyPrinter objPrettyPrinter = new PrettyPrinter();
objPrettyPrinter.setFormat(true);
StringWriter sw = new StringWriter();
try
{
DOMUtilities.writeDocument(in_SVGDocument, sw);
}
catch (IOException ex)
{
}
r = new StringReader(sw.toString());
try
{
objPrettyPrinter.print(r, w);
}
catch (TranscoderException ex)
{
}catch (IOException ex)
{
}
try
{
w.flush();
w.close();
}
catch (IOException ex)
{
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
RE: ttf2svg
Posted by David Schweinsberg <da...@steadystate.co.uk>.
Hmmm...
Nothing comes to mind as to why you would receive no output whatsoever.
What were the initial error messages? Does the licence of the font allow
you to email a copy to me for testing?
Regards,
David Schweinsberg
-----Original Message-----
From: Jane Singer [mailto:jsinger@cc.huji.ac.il]
Sent: 18 January 2003 21:18
To: Batik Users
Subject: ttf2svg
I'm trying to created some svg fonts from ttf using batik-ttf2svg.jar. After
eliminating some initial error messages (nothing special) it ran fine,
however, I don't see any output file. I've tried changing the various
parameters (all but the first seem to be optional). I tried just the ttf
file name, plus these (Windows 2000):
javaw -jar batik-ttf2svg.jar font.ttf -l 100 -h 120 -id myfont -o
font.svg -testcard;
Thanks as ever for any hints.
Jane
---------------------------------------------------------------------
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
ttf2svg
Posted by Jane Singer <js...@cc.huji.ac.il>.
I'm trying to created some svg fonts from ttf using batik-ttf2svg.jar. After
eliminating some initial error messages (nothing special) it ran fine,
however, I don't see any output file. I've tried changing the various
parameters (all but the first seem to be optional). I tried just the ttf
file name, plus these (Windows 2000):
javaw -jar batik-ttf2svg.jar font.ttf -l 100 -h 120 -id myfont -o
font.svg -testcard;
Thanks as ever for any hints.
Jane
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Bug in PrettyPrinter? (CDATA-Tag)
Posted by Vincent Hardy <vi...@sun.com>.
Hello Sebastian,
The problem you are running into is because the xml:space attribute is
written twice on the <style> element. This is a bug in the PrettyPrinter
but I thought it had been fixed. Are you using 1.5 beta 4b? Did you try
with the current CVS version?
Vincent.
Sebastian Hagen wrote:
> Hello,
>
> I am using Batik Pretty Printer for formated SVG Output.
>
> First I create a SVGDocument from the following Code:
>
>
>
>
> <?xml version="1.0"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> <svg width="500" height="500">
> <line x1="75" y1="285" x2="152" y2="228"
> style="fill:none;stroke:rgb(149,91,91);stroke-width:2"/>
> <style type="text/css"><![CDATA[path {fill-rule:nonzero;
> stroke-linecap:round; stroke-linejoin:round}
> rect {stroke-linejoin:miter}]]></style>
> </svg>
>
>
>
>
>
> Note that there is a CDATA Section within the code.
> When I now use PrettyPrinter, I get the following result:
> Please don´t worry about, if the CDATA section makes sense within this code.
>
>
>
>
>
> <svg contentScriptType="text/ecmascript" width="500"
> xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
> contentStyleType="text/css" height="500"
> preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"
> version="1.0">
> <style xml:space="preserve" type="text/css"
> xml:space="preserve"><![CDATA[path {fill-rule:nonzero; stroke-linecap:round;
> stroke-linejoin:round}]]><![CDATA[
> ]]><![CDATA[ rect {stroke-linejoin:miter}]]></style>
> <line y2="228.0"
> style="fill: none; stroke: rgb(149, 91, 91); stroke-width: 2; "
> x1="75.0" x2="152.0" y1="285.0"/>
> </svg>
>
>
>
>
> This code is not well formed anymore. Adobe SVG Viewer says: Double
> attribute in line 7
> My question now is: where do all those CDATA Tags come from. Below there is
> a Java code, that shows how I am using the PrettyPrinter.
>
> Is this a bug of PrettyPrinter, or did I do something wrong in my code.
>
> Thanks,
> Sebastian
>
>
>
>
> public static void writeToFile( SVGDocument in_SVGDocument, String fileName
> )
> {
> Reader r;
> Writer w = null;
> File objFile = new File( fileName );
>
> try
> {
> w = new FileWriter(objFile.getPath());
> }
> catch (IOException ex)
> {
> }
>
> PrettyPrinter objPrettyPrinter = new PrettyPrinter();
>
> objPrettyPrinter.setFormat(true);
>
> StringWriter sw = new StringWriter();
>
> try
> {
> DOMUtilities.writeDocument(in_SVGDocument, sw);
> }
> catch (IOException ex)
> {
> }
>
> r = new StringReader(sw.toString());
>
> try
> {
> objPrettyPrinter.print(r, w);
> }
> catch (TranscoderException ex)
> {
> }catch (IOException ex)
> {
> }
>
> try
> {
> w.flush();
> w.close();
> }
> catch (IOException ex)
> {
> }
> }
>
> ---------------------------------------------------------------------
> 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