summaryrefslogtreecommitdiffstats
path: root/fop-core
diff options
context:
space:
mode:
authorChris Bowditch <cbowditch@apache.org>2020-12-23 13:37:05 +0000
committerChris Bowditch <cbowditch@apache.org>2020-12-23 13:37:05 +0000
commita4d488287bec502881e58e35fd7e17c1898b4c14 (patch)
treef683c0504095719b1ef0e9e01db0d2d4af7809e1 /fop-core
parent655ac8ba9dd5fe781c2358051694311bbf21092a (diff)
downloadxmlgraphics-fop-a4d488287bec502881e58e35fd7e17c1898b4c14.tar.gz
xmlgraphics-fop-a4d488287bec502881e58e35fd7e17c1898b4c14.zip
FOP-2960; fix + test
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1884753 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'fop-core')
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java12
1 files changed, 10 insertions, 2 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;