From: Glen Mazza Date: Fri, 7 Nov 2003 05:09:51 +0000 (+0000) Subject: Hyphenation problem in Bug 23985 (http://nagoya.apache.org/bugzilla/show_bug.cgi... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1033 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2695d9ffc228a9670365145c011c332c67188cf8;p=xmlgraphics-fop.git Hyphenation problem in Bug 23985 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23985) fixed in HEAD. (maintenance still to be done.) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196983 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java index 7b36f3b3b..fec1958e1 100644 --- a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java @@ -186,9 +186,10 @@ public class TextLayoutManager extends AbstractLayoutManager { */ public boolean canBreakBefore(LayoutContext context) { char c = chars[iNextStart]; - return ((c == NEWLINE) - || (textInfo.bWrap && (CharUtilities.isBreakableSpace(c) - || BREAK_CHARS.indexOf(c) >= 0))); + return ((c == NEWLINE) || (textInfo.bWrap + && (CharUtilities.isBreakableSpace(c) + || (BREAK_CHARS.indexOf(c) >= 0 && (iNextStart == 0 + || Character.isLetterOrDigit(chars[iNextStart-1])))))); } /** @@ -373,19 +374,20 @@ public class TextLayoutManager extends AbstractLayoutManager { // Don't look for hyphenation points here though for (; iNextStart < chars.length; iNextStart++) { char c = chars[iNextStart]; - if ((c == NEWLINE) || // Include any breakable white-space as break char - // even if fixed width - (textInfo.bWrap && (CharUtilities.isBreakableSpace(c) - || BREAK_CHARS.indexOf(c) >= 0))) { - iFlags |= BreakPoss.CAN_BREAK_AFTER; - if (c != SPACE) { - iNextStart++; - if (c != NEWLINE) { - wordIPD += textInfo.fs.getCharWidth(c); - } else { - iFlags |= BreakPoss.FORCE; - } - } + // Include any breakable white-space as break char + if ((c == NEWLINE) || (textInfo.bWrap + && (CharUtilities.isBreakableSpace(c) + || (BREAK_CHARS.indexOf(c) >= 0 && (iNextStart == 0 + || Character.isLetterOrDigit(chars[iNextStart-1])))))) { + iFlags |= BreakPoss.CAN_BREAK_AFTER; + if (c != SPACE) { + iNextStart++; + if (c != NEWLINE) { + wordIPD += textInfo.fs.getCharWidth(c); + } else { + iFlags |= BreakPoss.FORCE; + } + } // If all remaining characters would be suppressed at // line-end, set a flag for parent LM. int iLastChar;