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 je...@apache.org on 2005/05/27 21:05:53 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fo FOText.java

jeremias    2005/05/27 12:05:53

  Modified:    src/java/org/apache/fop/fo FOText.java
  Log:
  Obsolete code removed and text-transform behaviour changed based on input from Victor Mote: http://marc.theaimsgroup.com/?t=111718934800001&r=1&w=2
  
  Revision  Changes    Path
  1.39      +2 -112    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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- FOText.java	26 Jan 2005 14:54:52 -0000	1.38
  +++ FOText.java	27 May 2005 19:05:53 -0000	1.39
  @@ -24,8 +24,6 @@
   // FOP
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.datatypes.ColorType;
  -import org.apache.fop.fo.flow.Block;
  -import org.apache.fop.fo.pagination.Root;
   import org.apache.fop.fo.properties.CommonFont;
   import org.apache.fop.fo.properties.CommonHyphenation;
   import org.apache.fop.fo.properties.CommonTextDecoration;
  @@ -82,33 +80,6 @@
       private int wrapOption;
       // End of property values
   
  -    /**
  -     * 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;
  -
  -    /**
  -     * Points to the previous FOText object created within the current
  -     * block. If this is "null", this is the first such object.
  -     */
  -    private FOText prevFOTextThisBlock = null;
  -
  -    /**
  -     * Points to the next FOText object created within the current
  -     * block. If this is "null", this is the last such object.
  -     */
  -    private FOText nextFOTextThisBlock = null;
  -
  -    /**
  -     * Points to the ancestor Block object. This is used to keep track of
  -     * which FOText nodes are descendants of the same block.
  -     */
  -    private Block ancestorBlock = null;
  -
       /** Holds the text decoration values. May be null */
       private CommonTextDecoration textDecoration;
       
  @@ -150,7 +121,6 @@
       }
   
       protected void startOfNode() {
  -        createBlockPointers();
           textTransform();
       }
   
  @@ -188,42 +158,6 @@
           return new TextCharIterator();
       }
   
  -     /**
  -     * This method is run as part of the Constructor, to create xref pointers to
  -     * the previous FOText objects within the same Block
  -     */
  -    private void createBlockPointers() {
  -        // build pointers between the FOText objects withing the same Block
  -        //
  -        // find the ancestorBlock of the current node
  -        FONode ancestorFONode = this;
  -        while (this.ancestorBlock == null) {
  -            ancestorFONode = ancestorFONode.parent;
  -            Class myclass = ancestorFONode.getClass();
  -            if (ancestorFONode instanceof org.apache.fop.fo.pagination.Title) {
  -                return;
  -            } else if (ancestorFONode instanceof Root) {
  -                getLogger().warn("Unexpected: fo:text with no fo:block ancestor");
  -                return;
  -            } else if (ancestorFONode instanceof Block) {
  -                this.ancestorBlock = (Block)ancestorFONode;
  -            }
  -        }
  -        // if the last FOText is a sibling, point to it, and have it point here
  -        if (lastFOTextProcessed != null) {
  -            if (lastFOTextProcessed.ancestorBlock == this.ancestorBlock) {
  -                prevFOTextThisBlock = lastFOTextProcessed;
  -                prevFOTextThisBlock.nextFOTextThisBlock = this;
  -            } else {
  -                prevFOTextThisBlock = null;
  -            }
  -        }
  -        // save the current node in static field so the next guy knows where
  -        // to look
  -        lastFOTextProcessed = this;
  -        return;
  -    }
  -
       /**
        * This method is run as part of the Constructor, to handle the
        * text-transform property.
  @@ -299,54 +233,9 @@
           // The easy case is where the desired character is in the same FOText
           if (((i + offset) >= 0) && ((i + offset) <= this.endIndex)) {
               return ca[i + offset];
  -        }
  -        // For now, we can't look at following FOText nodes
  -        if (offset > 0) {
  +        } else {
               return '\u0000';
           }
  -        // Remaining case has the text in some previous FOText node
  -        boolean foundChar = false;
  -        char charToReturn = '\u0000';
  -        FOText nodeToTest = this;
  -        int remainingOffset = offset + i;
  -        while (!foundChar) {
  -            if (nodeToTest.prevFOTextThisBlock == null) {
  -                foundChar = true;
  -                break;
  -            }
  -            nodeToTest = nodeToTest.prevFOTextThisBlock;
  -            if ((nodeToTest.endIndex + remainingOffset) >= 0) {
  -                charToReturn = nodeToTest.ca[nodeToTest.endIndex + remainingOffset];
  -                foundChar = true;
  -            } else {
  -                remainingOffset = remainingOffset + nodeToTest.endIndex;
  -            }
  -        }
  -        return charToReturn;
  -    }
  -
  -    /**
  -     * @return The previous FOText node in this Block; null, if this is the
  -     * first FOText in this Block.
  -     */
  -    public FOText getPrevFOTextThisBlock () {
  -        return prevFOTextThisBlock;
  -    }
  -
  -    /**
  -     * @return The next FOText node in this Block; null if this is the last
  -     * FOText in this Block; null if subsequent FOText nodes have not yet been
  -     * processed.
  -     */
  -    public FOText getNextFOTextThisBlock () {
  -        return nextFOTextThisBlock;
  -    }
  -
  -    /**
  -     * @return The nearest ancestor block object which contains this FOText.
  -     */
  -    public Block getAncestorBlock () {
  -        return ancestorBlock;
       }
   
       /**
  @@ -576,6 +465,7 @@
           return textDecoration; 
       }
   
  +    /** @see java.lang.Object#toString() */
       public String toString() {
           StringBuffer sb = new StringBuffer(super.toString());
           sb.append(" (").append(ca).append(")");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org