[ 
https://issues.apache.org/jira/browse/FOP-2972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Petter Reinholdtsen updated FOP-2972:
-------------------------------------
    Description: 
When using docbook to create a document with a SVG figure, the figure left and 
right edges are clipped.  The following script demonstrate the problem.  This 
problem was first reported to the docbook xslt project as issue #212.

 ```
 #!/bin/sh

cat > circles.svg <<EOF
 <?xml version="1.0"?>
 <!-- from [http://www.sagehill.net/docbookxsl/SVGimages.html] -->
 <svg xmlns="http://www.w3.org/2000/svg"; width="12cm" height="12cm">
 <g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
 <circle cx="6cm" cy="2cm" r="100" style="fill:red;"
 transform="translate(0,50)" />
 <circle cx="6cm" cy="2cm" r="100" style="fill:blue;"
 transform="translate(70,150)" />
 <circle cx="6cm" cy="2cm" r="100" style="fill:green;"
 transform="translate(-70,150)"/>
 </g>
 </svg>
 EOF

cat > test.xml <<EOF
 <?xml version='1.0' encoding='UTF-8' ?>
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
 <book lang="en">
 <title>...</title>
 <chapter>
 <title>...</title>
 <para>...</para>
 <figure id="figure">
 <title>A set of circles, should be perfectly round</title>
 <mediaobject>
 <imageobject>
 <imagedata fileref="circles.svg"/>
 </imageobject>
 <textobject>
 <phrase>With fop the left and right edges are flat</phrase>
 </textobject>
 </mediaobject>
 </figure>
 </chapter>
 </book>
 EOF

xsltproc --output test.fo 
/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl test.xml
 fop -fo test.fo -pdf test.pdf
 ```
  

See the docbook bug report above for an example rendering with the flat edges 
of the circles.

The relevant FO output look like this:

 ```
<fo:block id="d0e12">
  <fo:external-graphic src="url(circles.svg)"
      width="auto" 
      height="auto"
      content-width="auto"
      content-height="auto" />
</fo:block>
```

  was:
When using docbook to create a document with a SVG figure, the figure left and 
right edges are clipped.  The following script demonstrate the problem.  This 
problem was first reported to the docbook xslt project as issue #212.

 ```
 #!/bin/sh

cat > circles.svg <<EOF
 <?xml version="1.0"?>
 <!-- from [http://www.sagehill.net/docbookxsl/SVGimages.html] -->
 <svg xmlns="http://www.w3.org/2000/svg"; width="12cm" height="12cm">
 <g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
 <circle cx="6cm" cy="2cm" r="100" style="fill:red;"
 transform="translate(0,50)" />
 <circle cx="6cm" cy="2cm" r="100" style="fill:blue;"
 transform="translate(70,150)" />
 <circle cx="6cm" cy="2cm" r="100" style="fill:green;"
 transform="translate(-70,150)"/>
 </g>
 </svg>
 EOF

cat > test.xml <<EOF
 <?xml version='1.0' encoding='UTF-8' ?>
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
 <book lang="en">
 <title>...</title>
 <chapter>
 <title>...</title>
 <para>...</para>
 <figure id="figure">
 <title>A set of circles, should be perfectly round</title>
 <mediaobject>
 <imageobject>
 <imagedata fileref="circles.svg"/>
 </imageobject>
 <textobject>
 <phrase>With fop the left and right edges are flat</phrase>
 </textobject>
 </mediaobject>
 </figure>
 </chapter>
 </book>
 EOF

xsltproc --output test.fo 
/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl test.xml
 fop -fo test.fo -pdf test.pdf
 ```
  

See the docbook bug report above for an example rendering with the flat edges 
of the circles.


> Incorrectly trim edges of svg figure when using 'auto'
> ------------------------------------------------------
>
>                 Key: FOP-2972
>                 URL: https://issues.apache.org/jira/browse/FOP-2972
>             Project: FOP
>          Issue Type: Bug
>          Components: image/svg
>    Affects Versions: 2.3
>         Environment: Debian Buster
>            Reporter: Petter Reinholdtsen
>            Priority: Major
>              Labels: Debian
>
> When using docbook to create a document with a SVG figure, the figure left 
> and right edges are clipped.  The following script demonstrate the problem.  
> This problem was first reported to the docbook xslt project as issue #212.
>  ```
>  #!/bin/sh
> cat > circles.svg <<EOF
>  <?xml version="1.0"?>
>  <!-- from [http://www.sagehill.net/docbookxsl/SVGimages.html] -->
>  <svg xmlns="http://www.w3.org/2000/svg"; width="12cm" height="12cm">
>  <g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
>  <circle cx="6cm" cy="2cm" r="100" style="fill:red;"
>  transform="translate(0,50)" />
>  <circle cx="6cm" cy="2cm" r="100" style="fill:blue;"
>  transform="translate(70,150)" />
>  <circle cx="6cm" cy="2cm" r="100" style="fill:green;"
>  transform="translate(-70,150)"/>
>  </g>
>  </svg>
>  EOF
> cat > test.xml <<EOF
>  <?xml version='1.0' encoding='UTF-8' ?>
>  <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
>  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
>  <book lang="en">
>  <title>...</title>
>  <chapter>
>  <title>...</title>
>  <para>...</para>
>  <figure id="figure">
>  <title>A set of circles, should be perfectly round</title>
>  <mediaobject>
>  <imageobject>
>  <imagedata fileref="circles.svg"/>
>  </imageobject>
>  <textobject>
>  <phrase>With fop the left and right edges are flat</phrase>
>  </textobject>
>  </mediaobject>
>  </figure>
>  </chapter>
>  </book>
>  EOF
> xsltproc --output test.fo 
> /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl test.xml
>  fop -fo test.fo -pdf test.pdf
>  ```
>   
> See the docbook bug report above for an example rendering with the flat edges 
> of the circles.
> The relevant FO output look like this:
>  ```
> <fo:block id="d0e12">
>   <fo:external-graphic src="url(circles.svg)"
>       width="auto" 
>       height="auto"
>       content-width="auto"
>       content-height="auto" />
> </fo:block>
> ```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to