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 pi...@apache.org on 2003/03/02 17:55:19 UTC

cvs commit: xml-fop/src/org/apache/fop/render/xml XMLRenderer.java

pietsch     2003/03/02 08:55:19

  Modified:    .        Tag: fop-0_20_2-maintain CHANGES
               src/org/apache/fop/layout Tag: fop-0_20_2-maintain
                        FontState.java LineArea.java
               src/org/apache/fop/layout/inline Tag: fop-0_20_2-maintain
                        InlineArea.java PageNumberInlineArea.java
                        WordArea.java
               src/org/apache/fop/render Tag: fop-0_20_2-maintain
                        AbstractRenderer.java PrintRenderer.java
                        Renderer.java
               src/org/apache/fop/render/awt Tag: fop-0_20_2-maintain
                        AWTRenderer.java
               src/org/apache/fop/render/pcl Tag: fop-0_20_2-maintain
                        PCLRenderer.java
               src/org/apache/fop/render/pdf Tag: fop-0_20_2-maintain
                        PDFRenderer.java
               src/org/apache/fop/render/ps Tag: fop-0_20_2-maintain
                        PSRenderer.java
               src/org/apache/fop/render/svg Tag: fop-0_20_2-maintain
                        SVGRenderer.java
               src/org/apache/fop/render/txt Tag: fop-0_20_2-maintain
                        TXTRenderer.java
               src/org/apache/fop/render/xml Tag: fop-0_20_2-maintain
                        XMLRenderer.java
  Log:
  Do text align before the line is rendered, not when the line is closed.
  Moved page number resolving to just before text align. Removed page
  number resolving from renderers.
  Also, fix leader expansion in case page number resolving has eaten up
  too much space for the page number, resolving in a possible area overflow.
  Leaders may now be shortened down to leader-length.minimum if necessary.
  PR: 1130, 17194
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.52 +2 -0      xml-fop/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/xml-fop/CHANGES,v
  retrieving revision 1.10.2.51
  retrieving revision 1.10.2.52
  diff -u -r1.10.2.51 -r1.10.2.52
  --- CHANGES	2 Mar 2003 13:06:23 -0000	1.10.2.51
  +++ CHANGES	2 Mar 2003 16:55:15 -0000	1.10.2.52
  @@ -1,5 +1,7 @@
   ==============================================================================
   Done since 0.20.4 release
  +- Fixed text alingment for lines containing forward pointing page number
  +  citations. This should greatly improve TOC layout. (J.Pietschmann)
   - Fixed repeatedly laid out small caps text (for example in static
     content or due ot keeps). (J.Pietschmann)
   - Fixed marker handling thouroughly. All retrieving boundaries and
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.14.2.8  +111 -7    xml-fop/src/org/apache/fop/layout/FontState.java
  
  Index: FontState.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/FontState.java,v
  retrieving revision 1.14.2.7
  retrieving revision 1.14.2.8
  diff -u -r1.14.2.7 -r1.14.2.8
  --- FontState.java	25 Feb 2003 14:07:03 -0000	1.14.2.7
  +++ FontState.java	2 Mar 2003 16:55:15 -0000	1.14.2.8
  @@ -215,14 +215,118 @@
           }
   
           // Use default CodePointMapping
  -    char d = CodePointMapping.getMapping("WinAnsiEncoding").mapChar(c);
  -    if (d != 0) {
  -        c = d;
  -    } else {
  -        c = '#';
  +        char d = CodePointMapping.getMapping("WinAnsiEncoding").mapChar(c);
  +        if (d != 0) {
  +            c = d;
  +        } else {
  +            c = '#';
  +        }
  +        return c;
       }
   
  -        return c;
  +    private int enWidth=-1;
  +    private int emWidth=-1;
  +
  +    private final int getEmWidth() {
  +        if (emWidth<0) {
  +            char mappedChar = mapChar('m');
  +            // The mapping returns '#' for unmapped characters in
  +            // standard fonts.  What happens for other fonts?
  +            if (mappedChar == '#') {
  +                emWidth = 500 * getFontSize();
  +            } else {
  +                emWidth = width(mappedChar);
  +            }
  +        }
  +        return emWidth;
  +    }
  +
  +    private final int getEnWidth() {
  +        if (enWidth<0) {
  +            char mappedChar = mapChar('n');
  +            // The mapping returns '#' for unmapped characters in
  +            // standard fonts.  What happens for other fonts?
  +            if (mappedChar != '#') {
  +                // Should do something to discover non-proportional fonts.
  +                enWidth = (getEmWidth()*9)/10;
  +            } else {
  +                enWidth = width(mappedChar);
  +            }
  +        }
  +        return enWidth;
  +    }
  +
  +    /**
  +     * Helper method for getting the width of a unicode char
  +     * from the current fontstate.
  +     * This also performs some guessing on widths on various
  +     * versions of space that might not exists in the font.
  +     */
  +    public int getCharWidth(char c) {
  +        if ((c == '\n') || (c == '\r') || (c == '\t')) {
  +            return getCharWidth(' ');
  +        } else {
  +            char mappedChar = mapChar(c);
  +            if (mappedChar == '#' || mappedChar == 0) {
  +                // Estimate the width of spaces not represented in
  +                // the font
  +                if (c == '#') {
  +                    return width(mappedChar);
  +                } else if (c == ' ') {
  +                    return getEmWidth();
  +                } else if (c == '\u00A0') {
  +                    return getCharWidth(' ');
  +                } else if (c == '\u2000') {
  +                    return getEnWidth();
  +                } else if (c == '\u2001') {
  +                    return getEmWidth();
  +                } else if (c == '\u2002') {
  +                    return getEnWidth();
  +                } else if (c == '\u2003') {
  +                    return getEmWidth();
  +                } else if (c == '\u2004') {
  +                    return getEmWidth() / 3;
  +                } else if (c == '\u2005') {
  +                    return getEmWidth() / 4;
  +                } else if (c == '\u2006') {
  +                    return getEmWidth() / 6;
  +                } else if (c == '\u2007') {
  +                    return getCharWidth(' ');
  +                } else if (c == '\u2008') {
  +                    return getCharWidth('.');
  +                } else if (c == '\u2009') {
  +                    return getEmWidth() / 5;
  +                } else if (c == '\u200A') {
  +                    return getEmWidth() / 10;
  +                } else if (c == '\u200B') {
  +                    return 1;
  +                } else if (c == '\u202F') {
  +                    return getCharWidth(' ') / 2;
  +                } else if (c == '\u3000') {
  +                    return getCharWidth(' ') * 2;
  +                } else {
  +                    return width(mappedChar);
  +                }
  +            } else {
  +                return width(mappedChar);
  +            }
  +        }
  +    }
  +
  +    /**
  +     * Calculates the word width.
  +     */
  +    public int getWordWidth(String word) {
  +        if (word == null)
  +            return 0;
  +        int wordLength = word.length();
  +        int width = 0;
  +        char[] characters = new char[wordLength];
  +        word.getChars(0, wordLength, characters, 0);
  +        for (int i = 0; i < wordLength; i++) {
  +            width += getCharWidth(characters[i]);
  +        }
  +        return width;
       }
   
   }
  
  
  
  1.53.2.16 +260 -277  xml-fop/src/org/apache/fop/layout/Attic/LineArea.java
  
  Index: LineArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/Attic/LineArea.java,v
  retrieving revision 1.53.2.15
  retrieving revision 1.53.2.16
  diff -u -r1.53.2.15 -r1.53.2.16
  --- LineArea.java	25 Feb 2003 14:07:03 -0000	1.53.2.15
  +++ LineArea.java	2 Mar 2003 16:55:15 -0000	1.53.2.16
  @@ -50,24 +50,25 @@
    */ 
   package org.apache.fop.layout;
   
  +// Java
  +import java.util.ArrayList;
  +import java.util.StringTokenizer;
  +import java.awt.Rectangle;
  +
   // FOP
  -import org.apache.fop.render.Renderer;
  -import org.apache.fop.messaging.MessageHandler;
  -import org.apache.fop.layout.inline.*;
  -import org.apache.fop.fo.properties.WrapOption;
  -import org.apache.fop.fo.properties.WhiteSpaceCollapse;
  -import org.apache.fop.fo.properties.TextAlign;
  -import org.apache.fop.fo.properties.LeaderPattern;
  +import org.apache.fop.datatypes.IDReferences;
   import org.apache.fop.fo.properties.Hyphenate;
   import org.apache.fop.fo.properties.LeaderAlignment;
  +import org.apache.fop.fo.properties.LeaderPattern;
  +import org.apache.fop.fo.properties.TextAlign;
   import org.apache.fop.fo.properties.VerticalAlign;
  +import org.apache.fop.fo.properties.WhiteSpaceCollapse;
  +import org.apache.fop.fo.properties.WrapOption;
   import org.apache.fop.layout.hyphenation.Hyphenation;
   import org.apache.fop.layout.hyphenation.Hyphenator;
  -
  -// Java
  -import java.util.ArrayList;
  -import java.util.StringTokenizer;
  -import java.awt.Rectangle;
  +import org.apache.fop.layout.inline.*;
  +import org.apache.fop.messaging.MessageHandler;
  +import org.apache.fop.render.Renderer;
   
   public class LineArea extends Area {
   
  @@ -81,24 +82,27 @@
       protected int endIndent;
   
       private int placementOffset;
  +    private int textAlign;
   
       private FontState currentFontState;    // not the nominal, which is
       // in this.fontState
       private float red, green, blue;
       private int wrapOption;
       private int whiteSpaceCollapse;
  -    int vAlign;
  +    private int vAlign;
   
       /* hyphenation */
  -    HyphenationProps hyphProps;
  +    private HyphenationProps hyphProps;
   
       /*
        * the width of text that has definitely made it into the line
        * area
        */
  -    protected int finalWidth = 0;
  +    private int finalWidth = 0;
   
  -    /* the position to shift a link rectangle in order to compensate for links embedded within a word */
  +    /* the position to shift a link rectangle in order to compensate
  +     * for links embedded within a word
  +     */
       protected int embeddedLinkStart = 0;
   
       /* the width of the current word so far */
  @@ -111,33 +115,31 @@
       protected static final int MULTIBYTECHAR = 3;
   
       /* the character type of the previous character */
  -    protected int prev = NOTHING;
  -
  -    /* the position in data[] of the start of the current word */
  -    // protected int wordStart;
  -
  -    /* the length (in characters) of the current word */
  -    // protected int wordLength = 0;
  +    private int prev = NOTHING;
   
       /* width of spaces before current word */
  -    protected int spaceWidth = 0;
  +    private  int spaceWidth = 0;
   
       /*
        * the inline areas that have not yet been added to the line
        * because subsequent characters to come (in a different addText)
        * may be part of the same word
        */
  -    protected ArrayList pendingAreas = new ArrayList();
  +    private ArrayList pendingAreas = new ArrayList();
   
       /* the width of the pendingAreas */
  -    /* public for problem check in AbstractRenderer */
  -    public int pendingWidth = 0;
  +    private int pendingWidth = 0;
   
       /* text-decoration of the previous text */
       protected boolean prevUlState = false;
       protected boolean prevOlState = false;
       protected boolean prevLTState = false;
   
  +    // Whether the line has already be aligned text and expanded
  +    // leaders.
  +    private boolean aligned = false;
  +    private boolean hasPageNumbers = false;
  +
       public class Leader {
           int leaderPattern;
           int leaderLengthMinimum;
  @@ -177,24 +179,27 @@
               this.placementOffset=placementOffset;
               this.position = position;
           }
  -        void expand(int leaderLength) {
  +        void expand() {
               char dot = '.';
  -            int dotWidth =  getCharWidth(dot);
  +            int dotWidth =  currentFontState.getCharWidth(dot);
               char space = ' ';
  -            int spaceWidth = getCharWidth(space);
  +            int spaceWidth = currentFontState.getCharWidth(space);
               int idx=children.indexOf(this);
               children.remove(this);
               switch (leaderPattern) {
               case LeaderPattern.SPACE:
  -                InlineSpace spaceArea = new InlineSpace(leaderLength,false);
  +                InlineSpace spaceArea = new InlineSpace(leaderLengthOptimum
  +                                                        , false);
                   children.add(idx,spaceArea);
                   break;
               case LeaderPattern.RULE:
  -                LeaderArea leaderArea = new LeaderArea(this.fontState, this.red, this.green,
  -                                                       this.blue, "", leaderLength,
  -                                                       this.leaderPattern,
  -                                                       this.ruleThickness, this.ruleStyle);
  -                leaderArea.setYOffset(this.placementOffset);
  +                LeaderArea leaderArea = new LeaderArea(fontState, red, green,
  +                                                       blue, "",
  +                                                       leaderLengthOptimum,
  +                                                       leaderPattern,
  +                                                       ruleThickness,
  +                                                       ruleStyle);
  +                leaderArea.setYOffset(placementOffset);
                   children.add(idx,leaderArea);
                   break;
               case LeaderPattern.DOTS:
  @@ -229,19 +234,19 @@
                               // shorten leaderLength, otherwise - in
                               // case of leaderLength=remaining length -
                               // it will cut off the end of leaderlength
  -                            leaderLength -= spaceBeforeLeader;
  +                            leaderLengthOptimum -= spaceBeforeLeader;
                           }
                       }
  -                    int factor = (int)Math.floor(leaderLength / dotWidth);
  +                    int factor = (int)Math.floor(leaderLengthOptimum / dotWidth);
                       char[] leaderChars = new char[factor];
                       for (int i = 0; i < factor; i++) {
                           leaderChars[i] = dot;
                       }
                       WordArea leaderPatternArea =
  -                        new WordArea(currentFontState,
  -                                     this.red, this.green, this.blue,
  -                                     new String(leaderChars), leaderLength);
  -                    leaderPatternArea.setYOffset(this.placementOffset);
  +                        new WordArea(currentFontState, red, green, blue,
  +                                     new String(leaderChars),
  +                                     leaderLengthOptimum);
  +                    leaderPatternArea.setYOffset(placementOffset);
                       children.add(idx, leaderPatternArea);
                   } else {
                       // if leader-alignment is used, calculate space to
  @@ -263,33 +268,34 @@
                               // shorten leaderLength, otherwise - in
                               // case of leaderLength=remaining length -
                               // it will cut off the end of leaderlength
  -                            leaderLength -= spaceBeforeLeader;
  +                            leaderLengthOptimum -= spaceBeforeLeader;
                           }
                       }
                       // calculate the space to insert between the dots
                       // and create a inline area with this width
                       int dotsFactor =
  -                        (int)Math.floor(((double)leaderLength)
  -                                        / ((double)this.leaderPatternWidth));
  +                        (int)Math.floor(((double)leaderLengthOptimum)
  +                                        / ((double)leaderPatternWidth));
                       // add combination of dot + space to fill leader
                       // is there a way to do this in a more effective way?
                       for (int i = 0; i < dotsFactor; i++) {
                           InlineSpace spaceBetweenDots =
  -                            new InlineSpace(this.leaderPatternWidth - dotWidth, false);
  +                            new InlineSpace(leaderPatternWidth - dotWidth,
  +                                            false);
                           WordArea leaderPatternArea =
                               new WordArea(this.fontState,
                                            this.red, this.green, this.blue,
                                            new String("."), dotWidth);
  -                        leaderPatternArea.setYOffset(this.placementOffset);
  +                        leaderPatternArea.setYOffset(placementOffset);
                           children.add(idx,leaderPatternArea);
                           idx++;
                           children.add(idx,spaceBetweenDots);
                           idx++;
                       }
                       // append at the end some space to fill up to leader length
  -                    children.add(idx,new InlineSpace(leaderLength
  +                    children.add(idx,new InlineSpace(leaderLengthOptimum
                                                        - dotsFactor
  -                                                     * this.leaderPatternWidth));
  +                                                     * leaderPatternWidth));
                       idx++;
                   }
                   break;
  @@ -355,6 +361,153 @@
       }
   
       public void render(Renderer renderer) {
  +        if (pendingWidth > 0) {
  +            MessageHandler.error("Areas pending, text probably lost in line"
  +                                 + getLineText());
  +        }
  +        if (hasPageNumbers) {
  +            IDReferences idReferences = renderer.getIDReferences();
  +            for (int i = 0; i < children.size(); i++) {
  +                Object o = children.get(i);
  +                if ( o instanceof PageNumberInlineArea) {
  +                    PageNumberInlineArea pia = (PageNumberInlineArea)o;
  +                    FontState piaFontState = pia.getFontState();
  +                    finalWidth-=piaFontState.getWordWidth(pia.getText());
  +                    pia.resolve(idReferences);
  +                    finalWidth+=piaFontState.getWordWidth(pia.getText());
  +                }
  +            }
  +        }
  +        if (!aligned) {
  +            int padding = 0;
  +            switch (textAlign) {
  +            case TextAlign.START:      // left
  +                padding = this.getContentWidth() - finalWidth;
  +                endIndent += padding;
  +                for (int i = 0; i < children.size(); i++) {
  +                    Object o = children.get(i);
  +                    if (o instanceof LineArea.Leader) {
  +                        LineArea.Leader leader = (LineArea.Leader)o;
  +                        leader.expand();
  +                    }
  +                }
  +                break;
  +            case TextAlign.END:        // right
  +                padding = this.getContentWidth() - finalWidth;
  +                startIndent += padding;
  +                for (int i = 0; i < children.size(); i++) {
  +                    Object o = children.get(i);
  +                    if (o instanceof LineArea.Leader) {
  +                        LineArea.Leader leader = (LineArea.Leader)o;
  +                        leader.expand();
  +                    }
  +                }
  +                break;
  +            case TextAlign.CENTER:     // center
  +                padding = (this.getContentWidth() - finalWidth) / 2;
  +                startIndent += padding;
  +                endIndent += padding;
  +                for (int i = 0; i < children.size(); i++) {
  +                    Object o = children.get(i);
  +                    if (o instanceof LineArea.Leader) {
  +                        LineArea.Leader leader = (LineArea.Leader)o;
  +                        leader.expand();
  +                    }
  +                }
  +                break;
  +            case TextAlign.JUSTIFY:    // justify
  +                // first pass - count the spaces
  +                int leaderCount = 0;
  +                int spaceCount = 0;
  +                for (int i = 0; i < children.size(); i++ ) {
  +                    Object o = children.get(i);
  +                    if (o instanceof InlineSpace) {
  +                        InlineSpace space = (InlineSpace)o;
  +                        if (space.getResizeable()) {
  +                            spaceCount++;
  +                        }
  +                    } else if(o instanceof LineArea.Leader) {
  +                        leaderCount++;
  +                    }
  +                }
  +                padding = (this.getContentWidth() - finalWidth);
  +                if (padding!=0) {
  +                    if (leaderCount>0) {
  +                        int offset=0;
  +                        for (int i = 0; i < children.size(); i++) {
  +                            Object o = children.get(i);
  +                            if (o instanceof LineArea.Leader) {
  +                                LineArea.Leader leader = (LineArea.Leader)o;
  +                                int leaderExpansionMaximum=
  +                                    leader.leaderLengthMaximum - leader.leaderLengthOptimum;
  +                                int leaderExpansionMinimum=
  +                                    leader.leaderLengthMinimum - leader.leaderLengthOptimum;
  +                                if (leaderExpansionMaximum < padding) {
  +                                    leader.leaderLengthOptimum =
  +                                        leader.leaderLengthMaximum;
  +                                    leader.expand();
  +                                    padding-=leaderExpansionMaximum;
  +                                    offset+=leaderExpansionMaximum;
  +                                } else if (padding < leaderExpansionMinimum) {
  +                                    leader.leaderLengthOptimum =
  +                                        leader.leaderLengthMinimum;
  +                                    leader.expand();
  +                                    padding-=leaderExpansionMinimum;
  +                                    offset+=leaderExpansionMinimum;
  +                                } else {
  +                                    leader.leaderLengthOptimum += padding;
  +                                    leader.expand();
  +                                    padding=0;
  +                                    offset+=padding;
  +                                }
  +                            } else if (o instanceof InlineArea) {
  +                                ((InlineArea)o).setXOffset(((InlineArea)o).getXOffset() + offset);
  +                            }
  +                        }
  +                    }
  +                    if (padding != 0) {
  +                        if (spaceCount > 0) {
  +                            if (padding > 0) {
  +                                // The line is actually short of
  +                                // padding mod spaceCount
  +                                // millipoints. Should implement
  +                                // Bresenham-like algorithm for
  +                                // compensating, but it's not worth
  +                                // yet.
  +                                // If there are ref-area aligned leaders,
  +                                // they will be no longer aligned.
  +                                padding = padding/spaceCount;
  +                                spaceCount = 0;
  +                                // second pass - add additional space
  +                                for (int i = 0; i < children.size(); i++) {
  +                                    Object o = children.get(i);
  +                                    if (o instanceof InlineSpace) {
  +                                        InlineSpace space = (InlineSpace)o;
  +                                        if (space.getResizeable()) {
  +                                            space.setSize(space.getSize() + padding);
  +                                            spaceCount++;
  +                                        }
  +                                    } else if (o instanceof InlineArea) {
  +                                        ((InlineArea)o).setXOffset(((InlineArea)o).getXOffset() + i * padding);
  +                                    }
  +                                }
  +                            } else {
  +                                MessageHandler.log("Area overflow in line "
  +                                                   + getLineText());
  +                            }
  +                        } else {
  +                            // no spaces
  +                            MessageHandler.log("No spaces to justify text in line "
  +                                               + getLineText());
  +                        }
  +                    }
  +                }
  +                break;
  +            default: 
  +                MessageHandler.errorln("bad align: "+textAlign);
  +            break;
  +            }
  +        }
           renderer.renderLineArea(this);
       }
   
  @@ -368,7 +521,7 @@
           // Space must be allocated for the page number, so currently we
           // give it 3 spaces
   
  -        int width = 3*getCharWidth(' ');
  +        int width = 3*currentFontState.getCharWidth(' ');
   
   
           PageNumberInlineArea pia
  @@ -380,6 +533,7 @@
           pendingAreas.add(pia);
           pendingWidth += width;
           prev = TEXT;
  +        hasPageNumbers = true;
   
           return -1;
       }
  @@ -402,7 +556,7 @@
           int wordLength = 0;
           int wordWidth = 0;
           // With CID fonts, space isn't neccesary currentFontState.width(32)
  -        int whitespaceWidth = getCharWidth(' ');
  +        int whitespaceWidth = currentFontState.getCharWidth(' ');
   
           boolean isText = false;
           boolean isMultiByteChar = false;
  @@ -414,7 +568,7 @@
               char c = data[i];
               if (!(isSpace(c) || (c == '\n') || (c == '\r') || (c == '\t')
                     || (c == '\u2028'))) {
  -                charWidth = getCharWidth(c);
  +                charWidth = currentFontState.getCharWidth(c);
                   isText = true;
                   isMultiByteChar = (c > 127);
                   // Add support for zero-width spaces
  @@ -424,7 +578,7 @@
                   if ((c == '\n') || (c == '\r') || (c == '\t'))
                       charWidth = whitespaceWidth;
                   else
  -                    charWidth = getCharWidth(c);
  +                    charWidth = currentFontState.getCharWidth(c);
   
                   isText = false;
                   isMultiByteChar = false;
  @@ -435,7 +589,7 @@
   
                       if (this.whiteSpaceCollapse == WhiteSpaceCollapse.FALSE) {
                           if (isSpace(c)) {
  -                            spaceWidth += getCharWidth(c);
  +                            spaceWidth += currentFontState.getCharWidth(c);
                           } else if (c == '\n' || c == '\u2028') {
                               // force line break
                               if (spaceWidth > 0) {
  @@ -533,7 +687,7 @@
                       embeddedLinkStart =
                           0;    // reset embeddedLinkStart since a space was encountered
   
  -                    spaceWidth = getCharWidth(c);
  +                    spaceWidth = currentFontState.getCharWidth(c);
   
                       /*
                        * here is the place for white-space-treatment value 'ignore':
  @@ -563,7 +717,7 @@
                       if (this.whiteSpaceCollapse == WhiteSpaceCollapse.FALSE) {
                           if (isSpace(c)) {
                               prev = WHITESPACE;
  -                            spaceWidth = getCharWidth(c);
  +                            spaceWidth = currentFontState.getCharWidth(c);
                           } else if (c == '\n') {
                               // force line break
                               // textdecoration not used because spaceWidth is 0
  @@ -594,7 +748,9 @@
                       if ((finalWidth + spaceWidth + wordWidth)
                           > this.getContentWidth()) {
                           if (overrun)
  -                            MessageHandler.log("area contents overflows area");
  +                            MessageHandler.log("area contents overflows area "
  +                                               + "in line "
  +                                               + getLineText());
                           if (this.wrapOption == WrapOption.WRAP) {
                               return i;
                           }
  @@ -706,7 +862,9 @@
                                   (wordStart == start) &&
                                   (finalWidth == 0)) {
   
  -                                MessageHandler.log("area contents overflows area");
  +                                MessageHandler.log("area contents overflows"
  +                                                   + " area in line "
  +                                                   + getLineText());
                                   addSpacedWord(new String(data, wordStart, wordLength - 1),
                                                 ls,
                                                 embeddedLinkStart,
  @@ -764,7 +922,8 @@
           }
   
           if (overrun)
  -            MessageHandler.log("area contents overflows area");
  +            MessageHandler.log("area contents overflows area in line "
  +                               + getLineText());
           return -1;
       }
   
  @@ -822,111 +981,12 @@
       }
   
       /**
  -     * aligns line area
  -     *
  +     * Store text alignment.
  +     * The line is aligned immediately before rendering, after
  +     * page numbers have been resolved.
        */
       public void align(int type) {
  -        int padding = 0;
  -
  -        switch (type) {
  -        case TextAlign.START:      // left
  -            padding = this.getContentWidth() - finalWidth;
  -            endIndent += padding;
  -            for (int i = 0; i < children.size(); i++) {
  -                Object o = children.get(i);
  -                if (o instanceof LineArea.Leader) {
  -                    LineArea.Leader leader = (LineArea.Leader)o;
  -                    leader.expand(leader.leaderLengthOptimum);
  -                }
  -            }
  -            break;
  -        case TextAlign.END:        // right
  -            padding = this.getContentWidth() - finalWidth;
  -            startIndent += padding;
  -            for (int i = 0; i < children.size(); i++) {
  -                Object o = children.get(i);
  -                if (o instanceof LineArea.Leader) {
  -                    LineArea.Leader leader = (LineArea.Leader)o;
  -                    leader.expand(leader.leaderLengthOptimum);
  -                }
  -            }
  -            break;
  -        case TextAlign.CENTER:     // center
  -            padding = (this.getContentWidth() - finalWidth) / 2;
  -            startIndent += padding;
  -            endIndent += padding;
  -            for (int i = 0; i < children.size(); i++) {
  -                Object o = children.get(i);
  -                if (o instanceof LineArea.Leader) {
  -                    LineArea.Leader leader = (LineArea.Leader)o;
  -                    leader.expand(leader.leaderLengthOptimum);
  -                }
  -            }
  -            break;
  -        case TextAlign.JUSTIFY:    // justify
  -            // first pass - count the spaces
  -            int leaderCount = 0;
  -            int spaceCount = 0;
  -            for (int i = 0; i < children.size(); i++ ) {
  -                Object o = children.get(i);
  -                if (o instanceof InlineSpace) {
  -                    InlineSpace space = (InlineSpace)o;
  -                    if (space.getResizeable()) {
  -                        spaceCount++;
  -                    }
  -                } else if(o instanceof LineArea.Leader) {
  -                    leaderCount++;
  -                }
  -            }
  -            padding = (this.getContentWidth() - finalWidth);
  -            if (padding>0) {
  -                if (leaderCount>0) {
  -                    int offset=0;
  -                    for (int i = 0; i < children.size(); i++) {
  -                        Object o = children.get(i);
  -                        if (o instanceof LineArea.Leader) {
  -                            LineArea.Leader leader = (LineArea.Leader)o;
  -                            int leaderExpansionMaximum=
  -                                leader.leaderLengthMaximum - leader.leaderLengthOptimum;
  -                            if (leaderExpansionMaximum < padding) {
  -                                leader.expand(leader.leaderLengthMaximum);
  -                                padding-=leaderExpansionMaximum;
  -                                offset+=leaderExpansionMaximum;
  -                            } else {
  -                                leader.expand(leader.leaderLengthOptimum + padding);
  -                                padding=0;
  -                                offset+=padding;
  -                            }
  -                        } else if (o instanceof InlineArea) {
  -                            ((InlineArea)o).setXOffset(((InlineArea)o).getXOffset() + offset);
  -                        }
  -                    }
  -                }
  -                if (spaceCount > 0 && padding > 0) {
  -                    padding = padding/spaceCount;
  -                } else {               // no spaces
  -                    padding = 0;
  -                }
  -                spaceCount = 0;
  -                // second pass - add additional space
  -                for (int i = 0; i < children.size(); i++) {
  -                    Object o = children.get(i);
  -                    if (o instanceof InlineSpace) {
  -                        InlineSpace space = (InlineSpace)o;
  -                        if (space.getResizeable()) {
  -                            space.setSize(space.getSize() + padding);
  -                            spaceCount++;
  -                        }
  -                    } else if (o instanceof InlineArea) {
  -                        ((InlineArea)o).setXOffset(((InlineArea)o).getXOffset() + i * padding);
  -                    }
  -                }
  -            }
  -            break;
  -        default: 
  -            MessageHandler.errorln("bad align: "+type);
  -            break;
  -        }
  +        textAlign = type;
       }
   
       /**
  @@ -936,9 +996,9 @@
           int superHeight = -this.placementOffset;
           int maxHeight = this.allocationHeight;
           for (int i = 0; i < children.size(); i++ ) {
  -            Box b = (Box)children.get(i);
  -            if (b instanceof InlineArea) {
  -                InlineArea ia = (InlineArea)b;
  +            Object o = children.get(i);
  +            if (o instanceof InlineArea) {
  +                InlineArea ia = (InlineArea)o;
                   if (ia instanceof WordArea) {
                       ia.setYOffset(placementOffset);
                   }
  @@ -953,7 +1013,7 @@
                       int fh = fontState.getAscender();
                       ia.setYOffset((int)(placementOffset + (2 * fh / 3.0)));
                   }
  -            } else {}
  +            }
           }
           // adjust the height of this line to the
           // resulting alignment height.
  @@ -1018,7 +1078,7 @@
        * and wraps it in an InlineArea which is returned
        */
       private InlineArea buildSimpleLeader(char c, int leaderLength) {
  -        int width = getCharWidth(c);
  +        int width = currentFontState.getCharWidth(c);
           if (width == 0) {
               MessageHandler.errorln("char " + c
                                      + " has width 0. Using width 100 instead.");
  @@ -1075,7 +1135,9 @@
                                TextState textState) {
           // check whether the language property has been set
           if (this.hyphProps.language.equalsIgnoreCase("none")) {
  -            MessageHandler.errorln("if property 'hyphenate' is used, a language must be specified");
  +            MessageHandler.errorln("if property 'hyphenate' is used, a "
  +                                   + "language must be specified in line "
  +                                   + getLineText());
               return wordStart;
           }
   
  @@ -1100,7 +1162,8 @@
           String wordToHyphenate;
   
           // width of hyphenation character
  -        int hyphCharWidth = getCharWidth(this.hyphProps.hyphenationChar);
  +        int hyphCharWidth = currentFontState
  +            .getCharWidth(this.hyphProps.hyphenationChar);
           remainingWidth -= hyphCharWidth;
   
           // handles ' or " at the beginning of the word
  @@ -1115,7 +1178,7 @@
           // if the extracted word is smaller than the remaining width
           // we have a non letter character inside the word. at the moment
           // we will only handle hard hyphens and slashes
  -        if (getWordWidth(wordToHyphenate) < remainingWidth) {
  +        if (currentFontState.getWordWidth(wordToHyphenate) < remainingWidth) {
               inwordPunctuation =
                   characters[wordStart + remainingString.length()
                              + wordToHyphenate.length()];
  @@ -1127,8 +1190,8 @@
                                          wordStart + remainingString.length()
                                          + wordToHyphenate.length() + 1);
                   remainingWidth -=
  -                    (getWordWidth(wordToHyphenate)
  -                     + getCharWidth(inwordPunctuation));
  +                    (currentFontState.getWordWidth(wordToHyphenate)
  +                     + currentFontState.getCharWidth(inwordPunctuation));
               }
           }
   
  @@ -1172,24 +1235,6 @@
           return wordStart;
       }
   
  -
  -    /**
  -     * Calculates the wordWidth using the actual fontstate
  -     */
  -    private int getWordWidth(String word) {
  -        if (word == null)
  -            return 0;
  -        int wordLength = word.length();
  -        int width = 0;
  -        char[] characters = new char[wordLength];
  -        word.getChars(0, wordLength, characters, 0);
  -
  -        for (int i = 0; i < wordLength; i++) {
  -            width += getCharWidth(characters[i]);
  -        }
  -        return width;
  -    }
  -
       public int getRemainingWidth() {
           return this.getContentWidth() + startIndent - this.getCurrentXPosition();
       }
  @@ -1220,7 +1265,7 @@
       public int addCharacter(char data, LinkSet ls, boolean ul) {
           WordArea ia = null;
           int remainingWidth = this.getRemainingWidth();
  -        int width = getCharWidth(data);
  +        int width = currentFontState.getCharWidth(data);
           // if it doesn't fit, return
           if (width > remainingWidth) {
               return org.apache.fop.fo.flow.Character.DOESNOT_FIT;
  @@ -1294,7 +1339,7 @@
           pendingWidth = 0;
           pendingAreas = new ArrayList();
           String word = (wordBuf != null) ? wordBuf.toString() : "";
  -        int wordWidth = this.getWordWidth(word);
  +        int wordWidth = currentFontState.getWordWidth(word);
           WordArea hia = new WordArea(currentFontState,
                                       this.red, this.green, this.blue,
                                       word, wordWidth);
  @@ -1333,7 +1378,7 @@
   
           for (int i = 0; i < numberOfHyphenationPoints; i++) {
               wordBegin = hyph.getPreHyphenText(i);
  -            if (this.getWordWidth(wordBegin) > remainingWidth) {
  +            if (currentFontState.getWordWidth(wordBegin) > remainingWidth) {
                   break;
               }
               index = i;
  @@ -1358,87 +1403,6 @@
           return ret;
       }
   
  -    private final int getEmWidth() {
  -        char mappedChar = currentFontState.mapChar('m');
  -        // the mapping returns '#' for unmapped characters in standard fonts
  -        // what happens for other fonts?
  -        if (mappedChar == '#') {
  -            return 500 * currentFontState.getFontSize();
  -        } else {
  -            return currentFontState.width(mappedChar);
  -        }
  -    }
  -
  -    private final int getEnWidth() {
  -        char mappedChar = currentFontState.mapChar('n');
  -        // the mapping returns '#' for unmapped characters in standard fonts
  -        // what happens for other fonts?
  -        if (mappedChar != '#') {
  -            // should do something to discover non-proportional fonts
  -            return (getEmWidth()*9)/10;
  -        } else {
  -            return currentFontState.width(mappedChar);
  -        }
  -    }
  -
  -    /**
  -     * Helper method for getting the width of a unicode char
  -     * from the current fontstate.
  -     * This also performs some guessing on widths on various
  -     * versions of space that might not exists in the font.
  -     */
  -    private int getCharWidth(char c) {
  -        if ((c == '\n') || (c == '\r') || (c == '\t')) {
  -            return getCharWidth(' ');
  -        } else {
  -            char mappedChar = currentFontState.mapChar(c);
  -            if (mappedChar == '#' || mappedChar == 0) {
  -                // Estimate the width of spaces not represented in
  -                // the font
  -                if (c == '#') {
  -                    return currentFontState.width(mappedChar);
  -                } else if (c == ' ') {
  -                    return getEmWidth();
  -                } else if (c == '\u00A0') {
  -                    return getCharWidth(' ');
  -                } else if (c == '\u2000') {
  -                    return getEnWidth();
  -                } else if (c == '\u2001') {
  -                    return getEmWidth();
  -                } else if (c == '\u2002') {
  -                    return getEnWidth();
  -                } else if (c == '\u2003') {
  -                    return getEmWidth();
  -                } else if (c == '\u2004') {
  -                    return getEmWidth() / 3;
  -                } else if (c == '\u2005') {
  -                    return getEmWidth() / 4;
  -                } else if (c == '\u2006') {
  -                    return getEmWidth() / 6;
  -                } else if (c == '\u2007') {
  -                    return getCharWidth(' ');
  -                } else if (c == '\u2008') {
  -                    return getCharWidth('.');
  -                } else if (c == '\u2009') {
  -                    return getEmWidth() / 5;
  -                } else if (c == '\u200A') {
  -                    return getEmWidth() / 10;
  -                } else if (c == '\u200B') {
  -                    return 1;
  -                } else if (c == '\u202F') {
  -                    return getCharWidth(' ') / 2;
  -                } else if (c == '\u3000') {
  -                    return getCharWidth(' ') * 2;
  -                } else if (c == '\u3000') {
  -                    return getCharWidth(' ') * 2;
  -                } else {
  -                    return currentFontState.width(mappedChar);
  -                }
  -            } else {
  -                return currentFontState.width(mappedChar);
  -            }
  -        }
  -    }
   
   
       /**
  @@ -1501,7 +1465,8 @@
               if (currentWord.length() == 1
                   && (isNBSP(currentWord.charAt(0)))) {
                   // Add an InlineSpace
  -                int spaceWidth = getCharWidth(currentWord.charAt(0));
  +                int spaceWidth = currentFontState
  +                    .getCharWidth(currentWord.charAt(0));
                   if (spaceWidth > 0) {
                       InlineSpace is = new InlineSpace(spaceWidth);
                       startw += spaceWidth;
  @@ -1523,7 +1488,7 @@
                       }
                   }
               } else {
  -                int wordWidth = getWordWidth(currentWord);
  +                int wordWidth = currentFontState.getWordWidth(currentWord);
                   WordArea ia = new WordArea(currentFontState, this.red,
                                              this.green, this.blue,
                                              currentWord,
  @@ -1554,5 +1519,23 @@
           }
       }
   
  +    public String getLineText() {
  +        StringBuffer b = new StringBuffer(120);
  +        for (int i=0;i<children.size();i++) {
  +            Object o = children.get(i);
  +            if (o instanceof WordArea) {
  +                b.append(((WordArea)o).getText());
  +            } else if (o instanceof InlineSpace) {
  +                b.append(' ');
  +            } else if (o instanceof org.apache.fop.image.ImageArea) {
  +                b.append("<img>");
  +            } else {
  +                b.append('<');
  +                b.append(o.getClass().getName());
  +                b.append('>');
  +            }
  +        }
  +        return b.toString();
  +    }
   }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.2   +1 -6      xml-fop/src/org/apache/fop/layout/inline/Attic/InlineArea.java
  
  Index: InlineArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/inline/Attic/InlineArea.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- InlineArea.java	25 Feb 2003 14:07:12 -0000	1.7.2.1
  +++ InlineArea.java	2 Mar 2003 16:55:16 -0000	1.7.2.2
  @@ -63,7 +63,6 @@
       private int xOffset = 0;
       protected int height = 0;
       private int verticalAlign = 0;
  -    protected String pageNumberId = null;
       private float red, green, blue;
   
       // Textdecoration
  @@ -123,10 +122,6 @@
   
       public int getXOffset() {
           return this.xOffset;
  -    }
  -
  -    public String getPageNumberID() {
  -        return pageNumberId;
       }
   
       public void setUnderlined(boolean ul) {
  
  
  
  1.3.2.2   +11 -3     xml-fop/src/org/apache/fop/layout/inline/Attic/PageNumberInlineArea.java
  
  Index: PageNumberInlineArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/inline/Attic/PageNumberInlineArea.java,v
  retrieving revision 1.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- PageNumberInlineArea.java	25 Feb 2003 14:07:12 -0000	1.3.2.1
  +++ PageNumberInlineArea.java	2 Mar 2003 16:55:16 -0000	1.3.2.2
  @@ -50,10 +50,12 @@
    */ 
   package org.apache.fop.layout.inline;
   
  -import org.apache.fop.layout.*;
  +import org.apache.fop.layout.inline.WordArea;
  +import org.apache.fop.layout.FontState;
  +import org.apache.fop.datatypes.IDReferences;
   
   public class PageNumberInlineArea extends WordArea {
  -
  +    private String pageNumberId = null;
   
       public PageNumberInlineArea(FontState fontState, float red, float green,
                                   float blue, String refid, int width) {
  @@ -61,4 +63,10 @@
           this.pageNumberId = refid;
       }
   
  +    public void resolve(IDReferences idReferences) {
  +        text = idReferences.getPageNumber(pageNumberId);
  +        if (text == null) {
  +            text = "";
  +        }
  +    }
   }
  
  
  
  1.3.2.3   +2 -2      xml-fop/src/org/apache/fop/layout/inline/Attic/WordArea.java
  
  Index: WordArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/inline/Attic/WordArea.java,v
  retrieving revision 1.3.2.2
  retrieving revision 1.3.2.3
  diff -u -r1.3.2.2 -r1.3.2.3
  --- WordArea.java	25 Feb 2003 14:07:12 -0000	1.3.2.2
  +++ WordArea.java	2 Mar 2003 16:55:16 -0000	1.3.2.3
  @@ -55,7 +55,7 @@
   
   public class WordArea extends InlineArea {
   
  -    private String text;
  +    protected String text;
   
       public WordArea(FontState fontState, float red, float green, float blue,
                       String text, int width) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.10  +7 -9      xml-fop/src/org/apache/fop/render/AbstractRenderer.java
  
  Index: AbstractRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/AbstractRenderer.java,v
  retrieving revision 1.4.2.9
  retrieving revision 1.4.2.10
  diff -u -r1.4.2.9 -r1.4.2.10
  --- AbstractRenderer.java	25 Feb 2003 14:59:12 -0000	1.4.2.9
  +++ AbstractRenderer.java	2 Mar 2003 16:55:17 -0000	1.4.2.10
  @@ -87,6 +87,8 @@
        */
       protected int currentAreaContainerXPosition = 0;
   
  +    protected IDReferences idReferences;
  +
       public void setLogger(Logger logger) {
           log = logger;
       }
  @@ -492,14 +494,6 @@
        * @param area area to render
        */
       public void renderLineArea(LineArea area) {
  -        if (area.pendingWidth > 0) {
  -            final String pageNumber = (area.getPage() != null 
  -                    ? area.getPage().getFormattedNumber()
  -                    : "<unknown>");
  -            log.error("Areas pending, text probably lost. Check Page " +
  -                      pageNumber +
  -                      " and following page.");
  -        }
           int rx = this.currentAreaContainerXPosition + area.getStartIndent();
           int ry = this.currentYPosition;
           int w = area.getContentWidth();
  @@ -541,5 +535,9 @@
               page.getStart().render(this);
           if (page.getEnd() != null)
               page.getEnd().render(this);
  +    }
  +
  +    public IDReferences getIDReferences() {
  +        return idReferences;
       }
   }
  
  
  
  1.14.2.7  +1 -7      xml-fop/src/org/apache/fop/render/PrintRenderer.java
  
  Index: PrintRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/PrintRenderer.java,v
  retrieving revision 1.14.2.6
  retrieving revision 1.14.2.7
  diff -u -r1.14.2.6 -r1.14.2.7
  --- PrintRenderer.java	25 Feb 2003 14:59:12 -0000	1.14.2.6
  +++ PrintRenderer.java	2 Mar 2003 16:55:17 -0000	1.14.2.7
  @@ -135,11 +135,6 @@
       protected FontInfo fontInfo;
   
       /**
  -     * the IDReferences for this document
  -     */
  -    protected IDReferences idReferences;
  -
  -    /**
        * set the document's producer
        * 
        * @param producer string indicating application producing PDF
  @@ -474,7 +469,6 @@
           prevOverlineColor = null;
           prevLineThroughColor = null;
           fontInfo = null;
  -        this.idReferences = null;
       }
   
   }
  
  
  
  1.19.2.7  +3 -1      xml-fop/src/org/apache/fop/render/Renderer.java
  
  Index: Renderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/Renderer.java,v
  retrieving revision 1.19.2.6
  retrieving revision 1.19.2.7
  diff -u -r1.19.2.6 -r1.19.2.7
  --- Renderer.java	25 Feb 2003 14:59:12 -0000	1.19.2.6
  +++ Renderer.java	2 Mar 2003 16:55:17 -0000	1.19.2.7
  @@ -56,6 +56,7 @@
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.layout.*;
   import org.apache.fop.layout.inline.*;
  +import org.apache.fop.datatypes.IDReferences;
   
   // Avalon
   import org.apache.avalon.framework.logger.Logger;
  @@ -175,4 +176,5 @@
       void stopRenderer(OutputStream outputStream)
           throws IOException;
   
  +    IDReferences getIDReferences();
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.38.2.12 +2 -13     xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java
  
  Index: AWTRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java,v
  retrieving revision 1.38.2.11
  retrieving revision 1.38.2.12
  diff -u -r1.38.2.11 -r1.38.2.12
  --- AWTRenderer.java	25 Feb 2003 14:39:34 -0000	1.38.2.11
  +++ AWTRenderer.java	2 Mar 2003 16:55:17 -0000	1.38.2.12
  @@ -106,8 +106,6 @@
       protected Map fontStyles = new java.util.HashMap();
       protected Color saveColor = null;
   
  -    protected IDReferences idReferences = null;
  -
       /**
        * Image Object and Graphics Object. The Graphics Object is the Graphics
        * object that is contained withing the Image Object.
  @@ -667,16 +665,7 @@
           int bl = this.currentYPosition;
   
   
  -        String s;
  -        if (area.getPageNumberID()
  -                != null) {    // this text is a page number, so resolve it
  -            s = idReferences.getPageNumber(area.getPageNumberID());
  -            if (s == null) {
  -                s = "";
  -            }
  -        } else {
  -            s = area.getText();
  -        }
  +        String s = area.getText();
   
           Color oldColor = graphics.getColor();
           java.awt.Font oldFont = graphics.getFont();
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.13.2.9  +2 -10     xml-fop/src/org/apache/fop/render/pcl/PCLRenderer.java
  
  Index: PCLRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pcl/PCLRenderer.java,v
  retrieving revision 1.13.2.8
  retrieving revision 1.13.2.9
  diff -u -r1.13.2.8 -r1.13.2.9
  --- PCLRenderer.java	25 Feb 2003 14:57:53 -0000	1.13.2.8
  +++ PCLRenderer.java	2 Mar 2003 16:55:17 -0000	1.13.2.9
  @@ -684,15 +684,7 @@
           int rx = this.currentXPosition;
           int bl = this.currentYPosition;
   
  -        String s;
  -        if (area.getPageNumberID() != null) {
  -            // this text is a page number, so resolve it
  -            s = idReferences.getPageNumber(area.getPageNumberID());
  -            if (s == null)
  -                s = "";
  -        } else {
  -            s = area.getText();
  -        }
  +        String s = area.getText();
   
           addWordLines(area, rx, bl, size, theAreaColor);
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.91.2.14 +2 -12     xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.91.2.13
  retrieving revision 1.91.2.14
  diff -u -r1.91.2.13 -r1.91.2.14
  --- PDFRenderer.java	25 Feb 2003 14:58:08 -0000	1.91.2.13
  +++ PDFRenderer.java	2 Mar 2003 16:55:17 -0000	1.91.2.14
  @@ -716,17 +716,7 @@
               prevWordWidth = area.getContentWidth();
               prevWordX = rx;
   
  -            String s;
  -            if (area.getPageNumberID()
  -                    != null) {// this text is a page number, so resolve it
  -                s = idReferences.getPageNumber(area.getPageNumberID());
  -                if (s == null) {
  -                    s = "";
  -                }
  -            } else {
  -                s = area.getText();
  -            }
  -
  +            String s = area.getText();
               int l = s.length();
   
               for (int i = 0; i < l; i++) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.15.2.15 +2 -13     xml-fop/src/org/apache/fop/render/ps/PSRenderer.java
  
  Index: PSRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/ps/PSRenderer.java,v
  retrieving revision 1.15.2.14
  retrieving revision 1.15.2.15
  diff -u -r1.15.2.14 -r1.15.2.15
  --- PSRenderer.java	25 Feb 2003 14:58:23 -0000	1.15.2.14
  +++ PSRenderer.java	2 Mar 2003 16:55:18 -0000	1.15.2.15
  @@ -149,8 +149,6 @@
   
       private int psLevel = 3;
   
  -    protected IDReferences idReferences;
  -
       protected java.util.Map options;
   
   
  @@ -720,16 +718,7 @@
           FontState fs = area.getFontState();
           String fontWeight = fs.getFontWeight();
           StringBuffer sb = new StringBuffer();
  -        String s;
  -        if (area.getPageNumberID()
  -                != null) {    // this text is a page number, so resolve it
  -            s = idReferences.getPageNumber(area.getPageNumberID());
  -            if (s == null) {
  -                s = "";
  -            }
  -        } else {
  -            s = area.getText();
  -        }
  +        String s = area.getText();
           int l = s.length();
   
           for (int i = 0; i < l; i++) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.8   +2 -13     xml-fop/src/org/apache/fop/render/svg/SVGRenderer.java
  
  Index: SVGRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/svg/SVGRenderer.java,v
  retrieving revision 1.3.2.7
  retrieving revision 1.3.2.8
  diff -u -r1.3.2.7 -r1.3.2.8
  --- SVGRenderer.java	25 Feb 2003 14:58:32 -0000	1.3.2.7
  +++ SVGRenderer.java	2 Mar 2003 16:55:18 -0000	1.3.2.8
  @@ -106,8 +106,6 @@
       protected Map fontStyles = new java.util.HashMap();
       protected Color saveColor = null;
   
  -    protected IDReferences idReferences = null;
  -
       /**
        * The current (internal) font name
        */
  @@ -503,16 +501,7 @@
           int rx = this.currentXPosition;
           int bl = this.currentYPosition;
   
  -        String s;    // = area.getText();
  -        if (area.getPageNumberID()
  -                != null) {    // this text is a page number, so resolve it
  -            s = idReferences.getPageNumber(area.getPageNumberID());
  -            if (s == null) {
  -                s = "";
  -            }
  -        } else {
  -            s = area.getText();
  -        }
  +        String s = area.getText();
   
           if (saveColor != null) {
               if (saveColor.getRed() != red || saveColor.getGreen() != green
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.12.2.11 +2 -10     xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java
  
  Index: TXTRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/txt/TXTRenderer.java,v
  retrieving revision 1.12.2.10
  retrieving revision 1.12.2.11
  diff -u -r1.12.2.10 -r1.12.2.11
  --- TXTRenderer.java	25 Feb 2003 14:58:42 -0000	1.12.2.10
  +++ TXTRenderer.java	2 Mar 2003 16:55:18 -0000	1.12.2.11
  @@ -1608,15 +1608,7 @@
           int rx = this.currentXPosition;
           int bl = this.currentYPosition;
   
  -        String s;
  -        if (area.getPageNumberID() != null) {
  -            // this text is a page number, so resolve it
  -            s = idReferences.getPageNumber(area.getPageNumberID());
  -            if (s == null)
  -                s = "";
  -        } else {
  -            s = area.getText();
  -        }
  +        String s = area.getText();
   
           if (debug)
               System.out.println("TXTRenderer.renderInlineArea: rx=" + rx
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.27.2.12 +9 -1      xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java
  
  Index: XMLRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java,v
  retrieving revision 1.27.2.11
  retrieving revision 1.27.2.12
  diff -u -r1.27.2.11 -r1.27.2.12
  --- XMLRenderer.java	25 Feb 2003 14:58:50 -0000	1.27.2.11
  +++ XMLRenderer.java	2 Mar 2003 16:55:18 -0000	1.27.2.12
  @@ -59,6 +59,7 @@
   import org.apache.fop.layout.inline.*;
   import org.apache.fop.fo.properties.LeaderPattern;
   import org.apache.fop.apps.FOPException;
  +import org.apache.fop.datatypes.IDReferences;
   
   // Avalon
   import org.apache.avalon.framework.logger.Logger;
  @@ -104,6 +105,8 @@
       protected java.util.Map options;
       private boolean consistentOutput = false;
   
  +    protected IDReferences idReferences;
  +
       public XMLRenderer() {}
   
       /**
  @@ -129,6 +132,7 @@
   
       public void render(Page page, OutputStream outputStream)
       throws IOException {
  +        idReferences = page.getIDReferences();
           this.renderPage(page);
       }
   
  @@ -576,5 +580,9 @@
           writeEndTag("</AreaTree>");
           this.writer.flush();
           log.debug("written out XML");
  +    }
  +
  +    public IDReferences getIDReferences() {
  +        return idReferences;
       }
   }
  
  
  

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