You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/12/13 20:51:16 UTC

svn commit: r356594 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java status.xml test/layoutengine/standard-testcases/footnote_bug37880.xml

Author: jeremias
Date: Tue Dec 13 11:50:59 2005
New Revision: 356594

URL: http://svn.apache.org/viewcvs?rev=356594&view=rev
Log:
Bugzilla #37880:
Bugfix for lost footnotes in centered text.
Skip elements with no Position in TextLayoutManager.

Added:
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/footnote_bug37880.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java?rev=356594&r1=356593&r2=356594&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java Tue Dec 13 11:50:59 2005
@@ -79,7 +79,7 @@
             //Inline part of the footnote is empty. Need to send back an auxiliary
             //zero-width, zero-height inline box so the footnote gets painted.
             KnuthSequence seq = new KnuthSequence(true);
-            seq.add(new KnuthInlineBox(0, null, null, true));
+            seq.add(new KnuthInlineBox(0, null, null, false));
             returnedList.add(seq);
         }
         setFinished(true);
@@ -106,7 +106,7 @@
                 ListIterator nestedIterator = seq.listIterator(seq.size());
                 while (nestedIterator.hasPrevious() && lastBox == null) {
                     KnuthElement element = (KnuthElement)nestedIterator.previous();
-                    if (element instanceof KnuthInlineBox) {
+                    if (element instanceof KnuthInlineBox && !element.isAuxiliary()) {
                         lastBox = (KnuthInlineBox) element;
                     }
                 }
@@ -114,6 +114,8 @@
         }
         if (lastBox != null) {
             lastBox.setFootnoteBodyLM(bodyLM);
+        } else {
+            throw new IllegalStateException("No anchor box was found for a footnote.");
         }
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=356594&r1=356593&r2=356594&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Tue Dec 13 11:50:59 2005
@@ -271,7 +271,9 @@
          */
         while (posIter.hasNext()) {
             LeafPosition tbpNext = (LeafPosition) posIter.next();
-            //
+            if (tbpNext == null) {
+                continue; //Ignore elements without Positions
+            }
             if (tbpNext.getLeafPos() != -1) {
                 ai = (AreaInfo) vecAreaInfo.get(tbpNext.getLeafPos());
                 if (firstAreaInfoIndex == -1) {

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/status.xml?rev=356594&r1=356593&r2=356594&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Tue Dec 13 11:50:59 2005
@@ -27,6 +27,29 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="fix" fixes-bug="37880">
+        Bugfix: Footnotes were lost if the footnote appeared in centered text.
+      </action>
+      <action context="Code" dev="JM" type="update">
+        Improved log and error messages in a number of places by adding additional
+        context information that should make it easier to find the location in the
+        source files.
+      </action>
+      <action context="Code" dev="JM" type="fix">
+        Fix to correct image sizes in RTF output.
+      </action>
+      <action context="Code" dev="JM" type="add">
+        First attempt at SVG support in RTF output. SVG images are converted to 300dpi JPEG
+        images internally.
+      </action>
+      <action context="Code" dev="JM" type="update">
+        Additional checks to detect text overflows. The overflow property is now properly
+        handled where applicable.
+      </action>
+      <action context="Code" dev="JM" type="update">
+        Source location information improved. If location information is not available,
+        the context information is provided based on text content.
+      </action>
       <action context="Code" dev="JM" type="add">
         The command-line now automatically sets two parameters for any XSLT transformation:
         "fop-output-format" contains the MIME type of the currently selected output format,

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/footnote_bug37880.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/footnote_bug37880.xml?rev=356594&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/footnote_bug37880.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/footnote_bug37880.xml Tue Dec 13 11:50:59 2005
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2005 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks footnotes, particularly bug #37880. A footnote in centered text was ignored.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="3in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal" white-space-collapse="true">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block text-align="center">
+            Blah
+            <fo:footnote id="fn1">
+              <fo:inline font-size="6.95pt" vertical-align="super">1) </fo:inline>
+              <fo:footnote-body>
+                <fo:block text-align="left">
+                  <fo:inline font-size="6.95pt" vertical-align="super">1) </fo:inline>http://xmlgrapics.apache.org/fop/</fo:block>
+              </fo:footnote-body>
+            </fo:footnote>
+          </fo:block>
+          <!-- This second block uses an empty inline which will produce an auxiliary box w=0. I wanted to check if maybe this
+               box would be ignored as anchor due to the additional check on auxiliary boxes that was necessary to fix the 
+               above bug. -->
+          <fo:block text-align="center">
+            Blah2
+            <fo:footnote id="fn2">
+              <fo:inline/>
+              <fo:footnote-body>
+                <fo:block text-align="left">
+                  <fo:inline font-size="6.95pt" vertical-align="super">2) </fo:inline>http://www.apache.org</fo:block>
+              </fo:footnote-body>
+            </fo:footnote>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <true xpath="//footnote/block[1]/@bpd &gt; 0"/>
+    <true xpath="//footnote/block[2]/@bpd &gt; 0"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/footnote_bug37880.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/footnote_bug37880.xml
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: svn commit: r356594 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java status.xml test/layoutengine/standard-testcases/footnote_bug37880.xml

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Damn, I broke footnote_footnote-separator with this. I'll look at it
tomorrow. Uh, but that's in ten minutes. In that case, I'll look at it
in about 8 hours. :-) Nightynight.

On 13.12.2005 20:51:16 jeremias wrote:
> Author: jeremias
> Date: Tue Dec 13 11:50:59 2005
> New Revision: 356594
> 
> URL: http://svn.apache.org/viewcvs?rev=356594&view=rev
> Log:
> Bugzilla #37880:
> Bugfix for lost footnotes in centered text.
> Skip elements with no Position in TextLayoutManager.


Jeremias Maerki