Forum Bugs

Strange scaling artifacts on SVG image

Johann
We have the following SVG image file updateState.svg:

<svg xmlns="http://www.w3.org/2000/svg"
     version="1.1"
     width="700.8pt"
     height="1386.24pt"
     xml:lang="und"
     viewBox="0 0 700.8 1386.24"
     stroke="none"
     fill="white"
     fill-opacity="1"
     fill-rule="nonzero"
     font-family="Arial"
     stroke-opacity="0">   
      <path fill="#F5EDD8" d="M 410.56 1028.48 L 528.48 1028.48 528.48 1039.04 410.56 1039.04 z"/>
      <text transform="matrix(0.0270066 0 0 0.0269134 0 0)" fill="#595959" font-size="321.1264" x="15202.2" y="38529.6">[operator acknowledgement]</text>
      <path fill="#F5EDD8" d="M 410.56 1039.04 L 598.56 1039.04 598.56 1049.6 410.56 1049.6 z"/>
      <text transform="matrix(0.0270066 0 0 0.0269134 0 0)" fill="#595959" font-size="321.1264" x="15202.2" y="38921.9">/deactivate operator acknowledgement request</text>
      <path fill="#F5EDD8" d="M 410.56 1049.6 L 625.92 1049.6 625.92 1060.16 410.56 1060.16 z"/>
      <text transform="matrix(0.0270066 0 0 0.0269134 0 0)" fill="#595959" font-size="321.1264" x="15202.2" y="39314.2">clear diagnostic event for operator acknowledgement</text>
</svg>


We present the SVG image in the following HTML:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>SVG Test</title>
    </head>
    <body>
        <img src="updateState.svg" style="max-height:693.12pt" />
    </body>
</html>


The style property "max-height" shrinks the SVG image to about half of its original size.

When converted to PDF with Prince, you see three lines of text where the first two lines are cut off at the bottom!
It seems that the <path> elements overlap the preceding <text> elements.

The issue does not occur when the width and height attribute on the <svg> element are set to half of their original value.

PS: I know that the definitions of the <text> elements look a bit weird, but we can not change that (the images are printed to XPS format with the Microsoft XPS Document Writer, and then transformed to SVG).

- - -
Johann

Johann
I have attached some files that should show the bug.

ERROR.svg ist the SVG image printed above, but with narrowed width and height attributes.

The bug is visible when this SVG image is converted to PDF - see ERROR.pdf

Interestingly, the bug is no longer present, when we (partially) multiply out the transformation matrices on the text elements.

For example
<text transform="matrix(0.0270066 0 0 0.0269134 0 0)" fill="#595959" font-size="321.1264" x="15202.2" y="38529.6">[operator acknowledgement]</text>

.. becomes:
<text transform="scale(1 0.996548992)" fill="#595959" font-size="8.67253223424" x="410.55973452" y="1040.55349536">[operator acknowledgement]</text>


The file OK.svg transforms to PDF without problems.

- - -
Johann

  1. ERROR.pdf22.9 kB
  2. ERROR.svg1.1 kB
  3. OK.svg1.1 kB
mikeday
Yes it pertains to matrix precision, we will have a fix available shortly.
mikeday
This issue should be fixed in the latest build, thanks for letting us know!
Johann
That solved our issue - Thanks a lot!

- - -
Johann

mikeday
This fix has also been backported to Prince 15.4.