]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Hyphenation problem in Bug 23985 (http://nagoya.apache.org/bugzilla/show_bug.cgi...
authorGlen Mazza <gmazza@apache.org>
Fri, 7 Nov 2003 05:09:51 +0000 (05:09 +0000)
committerGlen Mazza <gmazza@apache.org>
Fri, 7 Nov 2003 05:09:51 +0000 (05:09 +0000)
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

src/java/org/apache/fop/layoutmgr/TextLayoutManager.java

index 7b36f3b3bf222747db13c53e3172f0519951e100..fec1958e12fe6e768a34f0f2996474c6bbb3a39a 100644 (file)
@@ -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;