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/14 17:57:26 UTC

svn commit: r356804 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/inline/ test/layoutengine/ test/layoutengine/hyphenation-testcases/

Author: jeremias
Date: Wed Dec 14 08:57:16 2005
New Revision: 356804

URL: http://svn.apache.org/viewcvs?rev=356804&view=rev
Log:
Don't hyphenate when wrap is set to "no-wrap".
Hack: Work around an NPE in hyphenation when preserved line feeds are found.
Documenting a bug where linefeeds are painted as "#" and content is painted multiple times when hyphenation is on and linefeed-treatment="preserve".

Added:
    xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml   (with props)
    xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_no-wrap.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
    xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=356804&r1=356803&r2=356804&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Wed Dec 14 08:57:16 2005
@@ -1064,7 +1064,8 @@
                                                 0 : hyphenationLadderCount.getValue(),
                                         this);
    
-        if (hyphenationProperties.hyphenate == EN_TRUE) {
+        if (hyphenationProperties.hyphenate == EN_TRUE 
+                && fobj.getWrapOption() != EN_NO_WRAP) {
             findHyphenationPoints(currPar);
         }
    
@@ -1487,7 +1488,10 @@
                 } else {
                     break;
                 }
+            } else if (currLM == null) {
+                break;
             }
+            //TODO Something's not right here. See block_hyphenation_linefeed_preserve.xml
             
             // collect word fragments, ignoring auxiliary elements;
             // each word fragment was created by a different TextLM

Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml?rev=356804&r1=356803&r2=356804&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Wed Dec 14 08:57:16 2005
@@ -37,6 +37,12 @@
     <description>Font-stretch is not implemented, yet.</description>
   </testcase>
   <testcase>
+    <name>Hyphenation with preserved linefeeds</name>
+    <file>block_hyphenation_linefeed_preserve.xml</file>
+    <description>When hyphenation is enabled and linefeeds are preserved linefeeds 
+    are painted as '#' and the text is output multiple times.</description>
+  </testcase>
+  <testcase>
     <name>linefeed-treatment</name>
     <file>block_linefeed-treatment.xml</file>
     <description>Preserved linefeeds in a fo:character are not handled

Added: xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml?rev=356804&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_linefeed_preserve.xml Wed Dec 14 08:57:16 2005
@@ -0,0 +1,50 @@
+<?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>
+      Regression check for an NPE in a block with no-wrap and hyphenation enabled.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" language="en" hyphenate="true">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="simple" page-height="5in" page-width="1in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="simple">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block line-height="10pt" background-color="orange"
+            white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas semper. Proin at.</fo:block>
+          <fo:block line-height="10pt" background-color="orange"
+            white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve">
+line1
+line2
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas semper. Proin at1.
+</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <!-- Dummy check. We don't want an NPE. -->
+    <eval expected="2" xpath="count(//*[contains(text(), 'adipiscing')])"/>
+  </checks>
+</testcase>

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

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

Added: xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_no-wrap.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_no-wrap.xml?rev=356804&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_no-wrap.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_no-wrap.xml Wed Dec 14 08:57:16 2005
@@ -0,0 +1,48 @@
+<?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>
+      Regression check for an NPE in a block with no-wrap and hyphenation enabled.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" language="en" hyphenate="true">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="simple" page-height="5in" page-width="5in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="simple">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block line-height="10pt" background-color="orange"
+            white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve" wrap-option="no-wrap">
+line1
+line2
+
+line3
+</fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <!-- Dummy check. We don't want an NPE. -->
+    <eval expected="1" xpath="count(//pageViewport)"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_no-wrap.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/layoutengine/hyphenation-testcases/block_hyphenation_no-wrap.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