diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/fo/flow/Block.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index 63f694b36..159a67784 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -256,7 +256,8 @@ public class Block extends FObjMixed { LFchecker lfCheck = new LFchecker(charIter); while (charIter.hasNext()) { - switch (CharUtilities.classOf(charIter.nextChar())) { + char currentChar = charIter.nextChar(); + switch (CharUtilities.classOf(currentChar)) { case CharUtilities.XMLWHITESPACE: /* Some kind of whitespace character, except linefeed. */ boolean bIgnore = false; @@ -275,8 +276,11 @@ public class Block extends FObjMixed { case Constants.IGNORE_IF_AFTER_LINEFEED: bIgnore = bPrevWasLF; break; + case Constants.PRESERVE: + // nothing to do now, replacement takes place later + break; } - // Handle ignore + // Handle ignore and replacement if (bIgnore) { charIter.remove(); } else if (bWScollapse) { @@ -290,8 +294,17 @@ public class Block extends FObjMixed { // encountered yet if (!bSeenNonWSYet) { charIter.remove(); + } else { + if (currentChar != '\u0020') { + charIter.replaceChar('\u0020'); + } } } + } else { + // !bWScollapse + if (currentChar != '\u0020') { + charIter.replaceChar('\u0020'); + } } break; |