Bug 4767 - SVG text is distored in PDF output
Summary: SVG text is distored in PDF output
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: 0.15
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-09 06:31 UTC by Phil Endecott
Modified: 2012-04-01 06:27 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Endecott 2001-11-09 06:31:27 UTC
This example shows strangely distored text in the PDF output, but
works correctly for -awt.  Works when scaled, suggesting weird
rounding-to-integer problem?

FOP 0.20.2-RC.

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master margin-right="25mm" margin-left="25mm"
                           margin-bottom="20mm" margin-top="15mm"
                           page-height="297mm" page-width="210mm"
                           master-name="a4">
      <fo:region-before extent="10mm"/>
      <fo:region-after extent="10mm"/>
      <fo:region-body margin-bottom="15mm" margin-top="15mm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-name="a4">
    <fo:flow flow-name="xsl-region-body">

    <fo:block>
      <fo:instream-foreign-object>
        <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
                 fill="none" width="5cm" height="1cm"
                 viewBox="0 0 5.0 1.0"
                 preserveAspectRatio="xMidYMid meet"
                 contentScriptType="text/ecmascript"
                 contentStyleType="text/css">
            <svg:text fill="#000000" text-anchor="start" font-size="0.3"
                      x="0.1" y="0.2">x1: Hello World</svg:text>
        </svg:svg>
      </fo:instream-foreign-object>
    </fo:block>

    <fo:block>
      <fo:instream-foreign-object>
        <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
                 fill="none" width="5cm" height="1cm"
                 viewBox="0 0 50.0 10.0"
                 preserveAspectRatio="xMidYMid meet"
                 contentScriptType="text/ecmascript"
                 contentStyleType="text/css">
          <svg:g transform="scale(10.0)">
            <svg:text fill="#000000" text-anchor="start" font-size="0.3"
                      x="0.1" y="0.2">x10: Hello World</svg:text>
          </svg:g>
        </svg:svg>
      </fo:instream-foreign-object>
    </fo:block>

    <fo:block>
      <fo:instream-foreign-object>
        <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
                 fill="none" width="5cm" height="1cm"
                 viewBox="0 0 500 100"
                 preserveAspectRatio="xMidYMid meet"
                 contentScriptType="text/ecmascript"
                 contentStyleType="text/css">
          <svg:g transform="scale(100)">
            <svg:text fill="#000000" text-anchor="start" font-size="0.3"
                      x="0.1" y="0.2">x100: Hello World</svg:text>
          </svg:g>
        </svg:svg>
      </fo:instream-foreign-object>
    </fo:block>

      <fo:instream-foreign-object>
        <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
                 fill="none" width="5cm" height="1cm"
                 viewBox="0 0 5000 1000"
                 preserveAspectRatio="xMidYMid meet"
                 contentScriptType="text/ecmascript"
                 contentStyleType="text/css">
          <svg:g transform="scale(1000)">
            <svg:text fill="#000000" text-anchor="start" font-size="0.3"
                      x="0.1" y="0.2">x1000: Hello World</svg:text>
          </svg:g>
        </svg:svg>
      </fo:instream-foreign-object>

    </fo:flow>
  </fo:page-sequence>
</fo:root>
Comment 1 keiron 2002-11-29 09:45:09 UTC
The numbers being output are rounded to 5 decimal places. This will mean that 
the curves are distorted if the numbers are very close together.
This should be handled better in the future.

For now you can scale the text of draw as normal text without curves.

Comment 2 Pascal Sancho 2007-10-23 07:03:08 UTC
This works for me in latest Trunk (rev 584703), and probably in FOP 0.94
Comment 3 Glenn Adams 2012-04-01 06:27:37 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed