From a4d488287bec502881e58e35fd7e17c1898b4c14 Mon Sep 17 00:00:00 2001 From: Chris Bowditch Date: Wed, 23 Dec 2020 13:37:05 +0000 Subject: [PATCH] FOP-2960; fix + test git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1884753 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/layoutmgr/inline/TextLayoutManager.java | 12 ++++++++++-- fop/test/layoutengine/disabled-testcases.xml | 16 +++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index 8d9e9722c..476860704 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -1018,12 +1018,20 @@ public class TextLayoutManager extends LeafNodeLayoutManager { /** {@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 LeafNodeLayoutManager { new GlyphMapping(startIndex, stopIndex, 0, letterSpaceCount, newIPD, hyphenFollows, false, false, font, -1, null), - ((LeafPosition) pos).getLeafPos() + changeOffset)); + glyphIndex)); nothingChanged = false; } startIndex = stopIndex; diff --git a/fop/test/layoutengine/disabled-testcases.xml b/fop/test/layoutengine/disabled-testcases.xml index b211b5bf5..8138492d5 100644 --- a/fop/test/layoutengine/disabled-testcases.xml +++ b/fop/test/layoutengine/disabled-testcases.xml @@ -87,13 +87,13 @@ NPE for table inside an inline inline_block_nested_3.xml - Placing a table as a child of an fo:inline produces a + Placing a table as a child of an fo:inline produces a NullPointerException. Keeps on inline-container are not implemented, yet. inline-container_keeps.xml - The keep-with-previous and keep-with-next properties have not been implemented on + 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". @@ -135,14 +135,14 @@ Page breaking doesn't deal with IPD changes page-breaking_4.xml - Page breaking currently doesn't support changing available IPD + 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. Overflow handing is incomplete page-breaking_6.xml - Line breaking is not 100% correct when there's too little space. + Line breaking is not 100% correct when there's too little space. Overflows are not detected and warned. @@ -186,7 +186,7 @@ table-cell empty area with marker.xml table-cell_empty_area_with_marker.xml - A table-cell producing an empty area does currently not add any markers to a page. + A table-cell producing an empty area does currently not add any markers to a page. See TODO entry in AreaAdditionUtil. @@ -196,12 +196,6 @@ is probably not expressing the indended outcome according to the spec. The test case should be revisited. - - Soft hyphen with normal hyphenation enabled - block_shy_linebreaking_hyph.xml - A soft hyphen should be a preferred as break compared to a - normal hyphenation point but is not. Background info: see JIRA FOP-2466. - Page-keep not respected in multi-column layout keep_within-page_multi-column_overflow.xml -- 2.39.5