You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Joao Goncalves (Jira)" <ji...@apache.org> on 2025/01/27 17:59:00 UTC

[jira] [Commented] (FOP-3058) AFP-Renderer does not honour fill-rule 'nonzero' of SVG path.

    [ https://issues.apache.org/jira/browse/FOP-3058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17921476#comment-17921476 ] 

Joao Goncalves commented on FOP-3058:
-------------------------------------

While one is able to add SVG images to AFP, AFP doesn't really support svg. The fill-rule is not being respected because it's never taken into consideration.

> AFP-Renderer does not honour fill-rule 'nonzero' of SVG path.
> -------------------------------------------------------------
>
>                 Key: FOP-3058
>                 URL: https://issues.apache.org/jira/browse/FOP-3058
>             Project: FOP
>          Issue Type: Bug
>          Components: image/svg, renderer/afp
>    Affects Versions: 0.95, 2.7
>            Reporter: JYR
>            Priority: Major
>         Attachments: GreenCrossAsAFP.png, GreenCrossAsPDF.png, TestWithSVGPath-1.7z
>
>
> 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
> !GreenCrossAsPDF.png!
> This is the output of the AFP renderer.
> !GreenCrossAsAFP.png!
> 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
> {code:xml}
> <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>
> {code}
> We spotted this bug with FOP version 0.95, but it still occurs with FOP 2.7.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)