Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2972

Incorrectly trim edges of svg figure when using 'auto'

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: image/svg
    • Labels:
    • Environment:
      Debian Buster

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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pere@hungry.com Petter Reinholdtsen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: