diff options
author | Chris Bowditch <cbowditch@apache.org> | 2004-04-02 13:50:52 +0000 |
---|---|---|
committer | Chris Bowditch <cbowditch@apache.org> | 2004-04-02 13:50:52 +0000 |
commit | 5475caa5fbb32036822090f6776a147d7adcd9f0 (patch) | |
tree | ee5c778ee6edbd28b43e5aa283fed23ca16e311e /src/java/org/apache/fop/fo/flow/Block.java | |
parent | ad12e060c43b8ffb4b71af18f28f07a5a81c7ebb (diff) | |
download | xmlgraphics-fop-5475caa5fbb32036822090f6776a147d7adcd9f0.tar.gz xmlgraphics-fop-5475caa5fbb32036822090f6776a147d7adcd9f0.zip |
Applied Luca Furini's patch from bugzilla entry 28021.
Corrections to behaviour of whitespace-treatment property
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197483 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/flow/Block.java')
-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; |