Author: cbowditch
Date: Wed Dec 23 13:37:05 2020
New Revision: 1884753

URL: http://svn.apache.org/viewvc?rev=1884753&view=rev
Log:
FOP-2960; fix + test

Modified:
    
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
    xmlgraphics/fop/trunk/fop/test/layoutengine/disabled-testcases.xml

Modified: 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=1884753&r1=1884752&r2=1884753&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
 Wed Dec 23 13:37:05 2020
@@ -1018,12 +1018,20 @@ public class TextLayoutManager extends L
 
     /** {@inheritDoc} */
     public void hyphenate(Position pos, HyphContext hyphContext) {
-        GlyphMapping mapping = getGlyphMapping(((LeafPosition) 
pos).getLeafPos() + changeOffset);
+        int glyphIndex = ((LeafPosition) pos).getLeafPos() + changeOffset;
+        GlyphMapping mapping = getGlyphMapping(glyphIndex);
         int startIndex = mapping.startIndex;
         int stopIndex;
         boolean nothingChanged = true;
         Font font = mapping.font;
 
+        // skip hyphenation if previously hyphenated using soft hyphen
+        if (mapping.isHyphenated || (glyphIndex > 0 && 
getGlyphMapping(glyphIndex - 1).isHyphenated)) {
+            stopIndex = mapping.endIndex;
+            hyphContext.updateOffset(stopIndex - startIndex);
+            startIndex = stopIndex;
+        }
+
         while (startIndex < mapping.endIndex) {
             MinOptMax newIPD = MinOptMax.ZERO;
             boolean hyphenFollows;
@@ -1078,7 +1086,7 @@ public class TextLayoutManager extends L
                       new GlyphMapping(startIndex, stopIndex, 0,
                                      letterSpaceCount, newIPD, hyphenFollows,
                                      false, false, font, -1, null),
-                        ((LeafPosition) pos).getLeafPos() + changeOffset));
+                            glyphIndex));
                 nothingChanged = false;
             }
             startIndex = stopIndex;

Modified: xmlgraphics/fop/trunk/fop/test/layoutengine/disabled-testcases.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/test/layoutengine/disabled-testcases.xml?rev=1884753&r1=1884752&r2=1884753&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop/test/layoutengine/disabled-testcases.xml 
(original)
+++ xmlgraphics/fop/trunk/fop/test/layoutengine/disabled-testcases.xml Wed Dec 
23 13:37:05 2020
@@ -87,13 +87,13 @@
   <testcase>
     <name>NPE for table inside an inline</name>
     <file>inline_block_nested_3.xml</file>
-    <description>Placing a table as a child of an fo:inline produces a 
+    <description>Placing a table as a child of an fo:inline produces a
     NullPointerException.</description>
   </testcase>
   <testcase>
     <name>Keeps on inline-container are not implemented, yet.</name>
     <file>inline-container_keeps.xml</file>
-    <description>The keep-with-previous and keep-with-next properties have not 
been implemented on 
+    <description>The keep-with-previous and keep-with-next properties have not 
been implemented on
       inline-container yet. They will be treated as if they had the value 
"auto".</description>
   </testcase>
   <testcase>
@@ -135,14 +135,14 @@
   <testcase>
     <name>Page breaking doesn't deal with IPD changes</name>
     <file>page-breaking_4.xml</file>
-    <description>Page breaking currently doesn't support changing available 
IPD 
+    <description>Page breaking currently doesn't support changing available IPD
     between pages of a single page-sequence. Element list generation has to be 
reset to
     redetermine line breaks in this case.</description>
   </testcase>
   <testcase>
     <name>Overflow handing is incomplete</name>
     <file>page-breaking_6.xml</file>
-    <description>Line breaking is not 100% correct when there's too little 
space. 
+    <description>Line breaking is not 100% correct when there's too little 
space.
     Overflows are not detected and warned.</description>
   </testcase>
   <testcase>
@@ -186,7 +186,7 @@
   <testcase>
     <name>table-cell empty area with marker.xml</name>
     <file>table-cell_empty_area_with_marker.xml</file>
-    <description>A table-cell producing an empty area does currently not add 
any markers to a page. 
+    <description>A table-cell producing an empty area does currently not add 
any markers to a page.
       See TODO entry in AreaAdditionUtil.</description>
   </testcase>
   <testcase>
@@ -197,12 +197,6 @@
     case should be revisited.</description>
   </testcase>
   <testcase>
-    <name>Soft hyphen with normal hyphenation enabled</name>
-    <file>block_shy_linebreaking_hyph.xml</file>
-    <description>A soft hyphen should be a preferred as break compared to a
-    normal hyphenation point but is not. Background info: see JIRA 
FOP-2466.</description>
-  </testcase>
-  <testcase>
     <name>Page-keep not respected in multi-column layout</name>
     <file>keep_within-page_multi-column_overflow.xml</file>
     <description>The block should cause overflow in the



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

Reply via email to