cvs commit: xml-fop/src/java/org/apache/fop/fo FOText.java
gmazza 2004/04/06 15:50:44 Modified:src/java/org/apache/fop/fo FOText.java Log: Comments added. Revision ChangesPath 1.19 +10 -1 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.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- FOText.java 4 Apr 2004 06:29:44 - 1.18 +++ FOText.java 6 Apr 2004 22:50:44 - 1.19 @@ -443,6 +443,14 @@ private class TextCharIterator extends AbstractCharIterator { private int curIndex = 0; + +/* Current space removal process: just increment the startIndex + to remove leading spaces from ca, until an unremoved character + is found. Then perform arraycopy's to remove extra spaces + between words. nextCharCalled is used to determine if an + unremoved character has already been found--if its value 2 + than it means that has occurred (it is reset to zero each time we + remove a space via incrementing the startIndex.) */ private int nextCharCalled = 0; public boolean hasNext() { @@ -476,7 +484,8 @@ // System.out.println(removeB: + new String(ca, startIndex, endIndex - startIndex)); } else if (curIndex == endIndex) { // System.out.println(removeC: + new String(ca, startIndex, endIndex - startIndex)); -curIndex = --endIndex; +endIndex--; +curIndex--; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo FOText.java FObjMixed.java
gmazza 2004/02/26 19:21:59 Modified:src/java/org/apache/fop/fo FOText.java FObjMixed.java Log: Some simplification of FOText object. Revision ChangesPath 1.13 +7 -9 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.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- FOText.java 17 Jan 2004 19:29:46 - 1.12 +++ FOText.java 27 Feb 2004 03:21:59 - 1.13 @@ -74,7 +74,6 @@ * the character array containing the text */ public char[] ca; -public int start; /** * the length of the character array containing the text @@ -121,17 +120,16 @@ * * @param chars array of chars which contains the text in this object (may * be a superset of the text in this object - * @param s starting index into char[] for the text in this object - * @param e ending index into char[] for the text in this object + * @param start starting index into char[] for the text in this object + * @param end ending index into char[] for the text in this object * @param ti TextInfo object for the text in this object * @param parent FONode that is the parent of this object */ -public FOText(char[] chars, int s, int e, TextInfo ti, FONode parent) { +public FOText(char[] chars, int start, int end, TextInfo ti, FONode parent) { super(parent); -this.start = 0; -this.ca = new char[e - s]; -System.arraycopy(chars, s, ca, 0, e - s); -this.length = e - s; +length = end - start; +this.ca = new char[length]; +System.arraycopy(chars, start, ca, 0, length); textInfo = ti; createBlockPointers(); textTransform(); @@ -152,7 +150,7 @@ return true; } -for (int i = start; i start + length; i++) { +for (int i = 0; i length; i++) { char ch = ca[i]; if (!((ch == ' ') || (ch == '\n') 1.19 +1 -1 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java Index: FObjMixed.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- FObjMixed.java26 Dec 2003 22:11:17 - 1.18 +++ FObjMixed.java27 Feb 2004 03:21:59 - 1.19 @@ -87,7 +87,7 @@ ft.setName(text); /* characters() processing empty for FOTreeHandler, not empty for RTF MIFHandlers */ -getFOTreeControl().getFOInputHandler().characters(ft.ca, ft.start, ft.length); +getFOTreeControl().getFOInputHandler().characters(ft.ca, 0, ft.length); addChild(ft); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo FOText.java
vmote 2003/08/21 22:43:27 Modified:src/java/org/apache/fop/fo FOText.java Log: 1. remove unused field 2. some checkstyle/javadoc changes Revision ChangesPath 1.9 +17 -5 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- FOText.java 19 Aug 2003 00:53:52 - 1.8 +++ FOText.java 22 Aug 2003 05:43:27 - 1.9 @@ -52,12 +52,8 @@ // Java import java.util.NoSuchElementException; -import java.util.List; // FOP -import org.apache.fop.layout.TextState; -import org.apache.fop.layoutmgr.LayoutManager; -import org.apache.fop.layoutmgr.TextLayoutManager; import org.apache.fop.fo.properties.WhiteSpaceCollapse; import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.pagination.Root; @@ -76,11 +72,21 @@ */ public class FOText extends FObj { +/** + * the character array containing the text + */ public char[] ca; private int start; + +/** + * the length of the character array containing the text + */ public int length; + +/** + * The TextInfo object attached to the text + */ public TextInfo textInfo; -private TextState ts; /** * Keeps track of the last FOText object created within the current @@ -487,6 +493,12 @@ } } +/** + * This is a hook for an FOTreeVisitor subclass to be able to access + * this object. + * @param fotv the FOTreeVisitor subclass that can access this object. + * @see org.apache.fop.fo.FOTreeVisitor + */ public void acceptVisitor(FOTreeVisitor fotv) { fotv.serveVisitor(this); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo FOText.java InlineCharIterator.java KeepProperty.java
vmote 2003/07/17 09:38:17 Modified:src/java/org/apache/fop/fo FOText.java InlineCharIterator.java KeepProperty.java Log: style changes only Revision ChangesPath 1.6 +49 -31xml-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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- FOText.java 29 Jun 2003 19:34:33 - 1.5 +++ FOText.java 17 Jul 2003 16:38:17 - 1.6 @@ -76,15 +76,18 @@ */ public class FOText extends FObj { -protected char[] ca; -protected int start; -protected int length; -TextInfo textInfo; -TextState ts; +private char[] ca; +private int start; +private int length; +private TextInfo textInfo; +private TextState ts; /** * Keeps track of the last FOText object created within the current * block. This is used to create pointers between such objects. + * TODO: As soon as the control hierarchy is straightened out, this static + * variable needs to become an instance variable in some parent object, + * probably the page-sequence. */ private static FOText lastFOTextProcessed = null; @@ -106,10 +109,19 @@ */ private Block ancestorBlock = null; -public static final int IS_WORD_CHAR_FALSE = 0; -public static final int IS_WORD_CHAR_TRUE = 1; -public static final int IS_WORD_CHAR_MAYBE = 2; +private static final int IS_WORD_CHAR_FALSE = 0; +private static final int IS_WORD_CHAR_TRUE = 1; +private static final int IS_WORD_CHAR_MAYBE = 2; +/** + * + * @param chars array of chars which contains the text in this object (may + * be a superset of the text in this object + * @param s starting index into char[] for the text in this object + * @param e ending index into char[] for the text in this object + * @param ti TextInfo object for the text in this object + * @param parent FONode that is the parent of this object + */ public FOText(char[] chars, int s, int e, TextInfo ti, FONode parent) { super(parent); this.start = 0; @@ -169,6 +181,9 @@ list.add(lm); } +/** + * @return a new TextCharIterator + */ public CharIterator charIterator() { return new TextCharIterator(); } @@ -231,12 +246,11 @@ } } // if the last FOText is a sibling, point to it, and have it point here -if ( lastFOTextProcessed != null) { +if (lastFOTextProcessed != null) { if (lastFOTextProcessed.ancestorBlock == this.ancestorBlock) { prevFOTextThisBlock = lastFOTextProcessed; prevFOTextThisBlock.nextFOTextThisBlock = this; -} -else { +} else { prevFOTextThisBlock = null; } } @@ -266,7 +280,7 @@ * well, such as word-spacing. The definition of word is somewhat ambiguous * and appears to be definable by the user agent. * - * @param (int i) with index to ca[] + * @param i index into ca[] * * @return True if the character at this location is the start of a new * word. @@ -309,13 +323,13 @@ * block as one unit, allowing text in adjoining FOText objects to be * returned if the parameters are outside of the current object. * - * @param (int i) with the index for ca[] - * @param (int offset) signed integer with relative position within the + * @param i index into ca[] + * @param offset signed integer with relative position within the * block of the character to return. To return the character immediately * preceding i, pass -1. To return the character immediately after i, * pass 1. - * @return char the character in the offset position within the block. - * @return \u if the offset points to an area outside of the block. + * @return the character in the offset position within the block; \u if + * the offset points to an area outside of the block. */ public char getRelativeCharInBlock(int i, int offset) { // The easy case is where the desired character is in the same FOText @@ -331,7 +345,7 @@ char charToReturn = '\u'; FOText nodeToTest = this; int remainingOffset = offset + i; -while (! foundChar) { +while (!foundChar) { if (nodeToTest.prevFOTextThisBlock == null) { foundChar = true; break; @@ -340,8 +354,7 @@ if
cvs commit: xml-fop/src/java/org/apache/fop/fo FOText.java
vmote 2003/03/25 16:00:17 Modified:src/java/org/apache/fop/fo FOText.java Log: Eliminate array looping if text-transform is NONE for a probable performance benefit. Revision ChangesPath 1.3 +3 -0 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FOText.java 25 Mar 2003 23:34:11 - 1.2 +++ FOText.java 26 Mar 2003 00:00:16 - 1.3 @@ -252,6 +252,9 @@ * text-transform property. */ private void textTransform() { +if (textInfo.textTransform == TextTransform.NONE) { +return; +} for (int i = 0; i ca.length; i++) { ca[i] = charTransform(i); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]