You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by gm...@apache.org on 2004/03/07 18:52:43 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Block.java
gmazza 2004/03/07 09:52:43
Modified: src/java/org/apache/fop/fo FOText.java
src/java/org/apache/fop/fo/flow Block.java
Log:
Fix of leading-space problem in HEAD. (A single leading space of the first
inline child of the block object was being incorrectly retained.)
Revision Changes Path
1.16 +0 -4 xml-fop/src/java/org/apache/fop/fo/FOText.java
Index: FOText.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOText.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FOText.java 1 Mar 2004 23:50:26 -0000 1.15
+++ FOText.java 7 Mar 2004 17:52:43 -0000 1.16
@@ -168,10 +168,6 @@
} else if (curIndex == length) {
curIndex = --length;
}
-// Temporary until leading space problem in 1.0 fixed
-// System.out.println("\n\nremove called: ca = \"" +
-// new String(ca) + "\", length/node length: " + length
-// + ", " + ca.length);
}
1.13 +17 -0 xml-fop/src/java/org/apache/fop/fo/flow/Block.java
Index: Block.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Block.java 27 Feb 2004 17:44:23 -0000 1.12
+++ Block.java 7 Mar 2004 17:52:43 -0000 1.13
@@ -246,6 +246,11 @@
if (firstInlineChild != null) {
boolean bInWS = false;
boolean bPrevWasLF = false;
+
+ /* bSeenNonWSYet is an indicator used for trimming all leading
+ whitespace for the first inline child of the block
+ */
+ boolean bSeenNonWSYet = false;
RecursiveCharIterator charIter =
new RecursiveCharIterator(this, firstInlineChild);
LFchecker lfCheck = new LFchecker(charIter);
@@ -279,7 +284,13 @@
&& (bPrevWasLF || lfCheck.nextIsLF()))) {
charIter.remove();
} else {
+ // this is to retain a single space between words
bInWS = true;
+ // remove the space if no word in block
+ // encountered yet
+ if (!bSeenNonWSYet) {
+ charIter.remove();
+ }
}
}
break;
@@ -300,6 +311,11 @@
} else {
if (bWScollapse) {
bInWS = true;
+ // remove the linefeed if no word in block
+ // encountered yet
+ if (!bSeenNonWSYet) {
+ charIter.remove();
+ }
}
charIter.replaceChar('\u0020');
}
@@ -323,6 +339,7 @@
case CharUtilities.NONWHITESPACE:
/* Any other character */
bInWS = bPrevWasLF = false;
+ bSeenNonWSYet = true;
lfCheck.reset();
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org