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

AFP-Renderer does not honour fill-rule 'nonzero' of SVG path.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.95, 2.7
    • None
    • image/svg, renderer/afp
    • None

    Description

      Hi there,

      We have just isolated an interesting bug in the AFP renderer.

      We are embedding some SVG graphics in a FO file and the AFP renderer does not seem to take the "fill-rule" attribute into account.
      It seems to ignore the fill-rule 'nonzero' of our path and defaults to 'evenodd'.

      The PDF renderer does honour this fill-rule, but not the AFP renderer.

      We have isolated this issue in a test project. Just unpack TestWithSVGPath-1.7z. All the necessary files are provided.

      This is the correct output of the PDF renderer

      This is the output of the AFP renderer.

      FOP integration:

      • We are calling FOP via java.exe.
      • FOP is configured with an xconf file.

      Expected:

      • The AFP-Renderer shall honour the 'fill-rule' attribute of the SVG path.
      • If the 'fill-rule' attribute is not specified, the AFP-Renderer shall default to 'nonzero'.

      Extract of FO-File

      <fo:instream-foreign-object>
      	<svg width="46mm" height="46mm" version="1.1" viewBox="0 0 130.394 130.394" xmlns="http://www.w3.org/2000/svg">
      		<g font-family="Helvetica,Arial,&quot;Liberation Sans&quot;" transform="translate(0 130.394)">
      			<!-- Red background -->
      			<path fill="red" shape-rendering="crispEdges" d="
      								M56.693,-73.701 
      								h17.008
      								v17.008h
      								-17.008
      								z"/>
      			<!-- Green cross, vertical block first, then horizontal -->
      			<path fill="green" fill-rule="nonzero" shape-rendering="crispEdges" d="
      								M63.543,-70.709
      								h 3.307
      								v 11.024
      								h -3.307
      								z
      								m-3.858,3.858
      								h11.024
      								v3.307
      								h-11.024
      								z
      								"/>
      			<!-- 2 Rectangles as workaround for Bug in AFP-Renderer -->
      			<!-- <rect x="59.685" y="-66.85" width="11.024" height="3.307" fill="powderblue"/> -->
      			<!-- <rect x="63.543" y="-70.709" height="11.024" width="3.307" fill="powderblue"/> -->
      		</g>
      	</svg>
      </fo:instream-foreign-object>
      

      We spotted this bug with FOP version 0.95, but it still occurs with FOP 2.7.

      Attachments

        1. TestWithSVGPath-1.7z
          13.90 MB
          JYR
        2. GreenCrossAsAFP.png
          0.8 kB
          JYR
        3. GreenCrossAsPDF.png
          0.8 kB
          JYR

        Activity

          People

            Unassigned Unassigned
            reureu JYR
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: