DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23709>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23709

Height of table cells negative when rendering SVG

           Summary: Height of table cells negative when rendering SVG
           Product: Fop
           Version: 0.20.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: Other
         Component: svg
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hi, 

I'm currently using the FOP library to build a Java print engine which
transforms Java AWT/Swing screens into HTML, SVG, PDF, etc... (see
http://javauitransform.sf.net)

When I render the following Fo input into SVG, I always get negative rect
heights for fo:table-cells containing the fo:block element.

I am relative new to this, but to what I've found, negative rect heights are to
be reported as an error (see SVG specs v1.0 page 196). Batik squiggle correctly
reports this error as : "The attribute 'height' of the element <rect> can not be
negative"

I've temporarily fixed this issue by using my own SVGRenderer and subclassing
the SVGUtilities class. I've replaced the SVGUtilities.createRect(...) method by
SVGUtilities.createAbsoluteRect(...) which creates a rectangle with an absolute
value for the height.

The following is an example input FO tree :

--------------------------------------------------------------

<?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="0.5cm" margin-left="0.5cm"
margin-bottom="0.5cm" margin-top="1cm" master-name="page" page-width="400pt">
<fo:region-body margin-bottom="1cm" margin-top="1cm"/>
<fo:region-before extent="1cm"/>
<fo:region-after extent="1cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page">
<fo:flow flow-name="xsl-region-body">
<fo:block background-color="#ffffff">
<fo:table table-layout="fixed" text-align="left" border="0pt">
<fo:table-column column-number="1" column-width="15pt"/>
<fo:table-column column-number="2" column-width="15pt"/>
<fo:table-column column-number="3" column-width="15pt"/>
<fo:table-column column-number="4" column-width="15pt"/>
<fo:table-column column-number="5" column-width="15pt"/>
<fo:table-column column-number="6" column-width="15pt"/>
<fo:table-column column-number="7" column-width="15pt"/>
<fo:table-column column-number="8" column-width="15pt"/>
<fo:table-column column-number="9" column-width="15pt"/>
<fo:table-column column-number="10" column-width="15pt"/>
<fo:table-column column-number="11" column-width="15pt"/>
<fo:table-column column-number="12" column-width="15pt"/>
<fo:table-column column-number="13" column-width="15pt"/>
<fo:table-column column-number="14" column-width="15pt"/>
<fo:table-column column-number="15" column-width="15pt"/>
<fo:table-column column-number="16" column-width="15pt"/>
<fo:table-column column-number="17" column-width="15pt"/>
<fo:table-column column-number="18" column-width="15pt"/>
<fo:table-column column-number="19" column-width="15pt"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell height="20pt" border="0pt" column-number="1"
number-columns-spanned="18">
<fo:block background-color="#6464dc">
<fo:table table-layout="fixed" text-align="left" border="0pt">
<fo:table-column column-number="1" column-width="15pt"/>
<fo:table-column column-number="2" column-width="15pt"/>
<fo:table-column column-number="3" column-width="15pt"/>
<fo:table-column column-number="4" column-width="15pt"/>
<fo:table-column column-number="5" column-width="15pt"/>
<fo:table-column column-number="6" column-width="15pt"/>
<fo:table-column column-number="7" column-width="15pt"/>
<fo:table-column column-number="8" column-width="15pt"/>
<fo:table-column column-number="9" column-width="15pt"/>
<fo:table-column column-number="10" column-width="15pt"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell height="15pt" border="0pt" column-number="1"/>
<fo:table-cell height="15pt" border="0pt" column-number="2"/>
<fo:table-cell height="15pt" border="0pt" column-number="3"/>
<fo:table-cell height="15pt" border="0pt" column-number="4"/>
<fo:table-cell height="15pt" border="0pt" column-number="5"/>
<fo:table-cell height="15pt" border="0pt" column-number="6"/>
<fo:table-cell height="15pt" border="0pt" column-number="7"/>
<fo:table-cell height="29pt" border="0pt" column-number="8"
number-columns-spanned="2">
<fo:block>07</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>

--------------------------------------------------------------

SVG output :

--------------------------------------------------------------

?xml version="1.0" encoding="ISO-8859-1"?>
<svg contentScriptType="text/ecmascript" width="400.0"
     xmlns:xlink="http://www.w3.org/1999/xlink"; zoomAndPan="magnify"
     contentStyleType="text/css" height="792.0"
     preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg";
     version="1.0">
    <g id="Page-1" style="font-family:sanserif;font-size:12"
       transform="translate(0,0.0)">
        <rect width="400.0" x="0.0" height="792.0" y="0.0"
              style="fill:none;stroke:black"/>
        <rect width="371.654" x="14.173" height="-239.0" y="56.692017"
              style="stroke:rgb(255,255,255);fill:rgb(255,255,255)"/>
        <rect width="270.0" x="14.173" height="-29.0" y="266.69202"
              style="stroke:rgb(100,100,220);fill:rgb(100,100,220)"/>
        <text x="119.173" y="276.89203">
            07
        </text>
        <a xlink:href="#svgView(viewBox(0, 0.0, 400, 792))" xlink:type="simple"
           xlink:actuate="onRequest" xlink:show="replace"
           xmlns:xlink="http://www.w3.org/1999/xlink";>
            <rect width="200.0" x="0.0" height="792.0" y="0.0"
                  style="fill:blue;visibility:hidden"/>
        </a>
    </g>
</svg>

--------------------------------------------------------------


Many thanks for your support.

Kindest regards,
Mario Van Steenberghe ([EMAIL PROTECTED])

Reply via email to