jeremias    2005/02/16 02:15:45

  Modified:    src/java/org/apache/fop/traits BorderProps.java
               src/java/org/apache/fop/layoutmgr TraitSetter.java
               src/java/org/apache/fop/layoutmgr/table Cell.java
               src/java/org/apache/fop/render/pdf PDFRenderer.java
  Log:
  First step towards collapsing table borders:
  - Mode on BorderProps controls painting behaviour.
  - Extended toString() on BorderProps
  - Painting the borders already works for all three modes (separate, 
collapsing-inner and collapsing-outer)
  - ATM only inner borders are painted.
  
  Revision  Changes    Path
  1.3       +64 -6     xml-fop/src/java/org/apache/fop/traits/BorderProps.java
  
  Index: BorderProps.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/traits/BorderProps.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BorderProps.java  27 Feb 2004 17:56:25 -0000      1.2
  +++ BorderProps.java  16 Feb 2005 10:15:45 -0000      1.3
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 1999-2004 The Apache Software Foundation.
  + * Copyright 1999-2005 The Apache Software Foundation.
    * 
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -19,6 +19,7 @@
   package org.apache.fop.traits;
   
   import org.apache.fop.datatypes.ColorType;
  +import org.apache.fop.fo.Constants;
   
   import java.io.Serializable;
   
  @@ -28,24 +29,81 @@
    */
   public class BorderProps implements Serializable {
       
  +    /** Separate border model */
  +    public static final int SEPARATE = 0;
  +    /** Collapsing border model, for borders inside a table */
  +    public static final int COLLAPSE_INNER = 1;
  +    /** Collapsing border model, for borders at the table's outer border */
  +    public static final int COLLAPSE_OUTER = 2;
  +    
  +    /** Border style (one of EN_*) */
       public int style; // Enum for border style
  -    public ColorType color; // Border color
  -    public int width; // Border width
  -
  -    public BorderProps(int style, int width, ColorType color) {
  +    /** Border color */
  +    public ColorType color;
  +    /** Border width */
  +    public int width;
  +    /** Border mode (one of SEPARATE, COLLAPSE_INNER and COLLAPSE_OUTER) */
  +    public int mode;
  +
  +    /**
  +     * Constructs a new BorderProps instance.
  +     * @param style border style (one of EN_*)
  +     * @param width border width
  +     * @param color border color
  +     * @param mode border mode ((one of SEPARATE, COLLAPSE_INNER and 
COLLAPSE_OUTER)
  +     */
  +    public BorderProps(int style, int width, ColorType color, int mode) {
           this.style = style;
           this.width = width;
           this.color = color;
  +        this.mode = mode;
       }
   
  +    /**
  +     * @param bp the border properties or null
  +     * @return the effective width of the clipped part of the border
  +     */
  +    public static int getClippedWidth(BorderProps bp) {
  +        if ((bp != null) && (bp.mode != SEPARATE)) {
  +            return bp.width / 2;
  +        } else {
  +            return 0;
  +        }
  +    }
  +    
  +    private String getStyleString() {
  +        switch (style) {
  +        case Constants.EN_NONE: return "none";
  +        case Constants.EN_HIDDEN: return "hidden";
  +        case Constants.EN_DOTTED: return "dotted";
  +        case Constants.EN_DASHED: return "dashed";
  +        case Constants.EN_SOLID: return "solid";
  +        case Constants.EN_DOUBLE: return "double";
  +        case Constants.EN_GROOVE: return "groove";
  +        case Constants.EN_RIDGE: return "ridge";
  +        case Constants.EN_INSET: return "inset";
  +        case Constants.EN_OUTSET: return "outset";
  +        default: throw new IllegalStateException("Illegal border style: " + 
style);
  +        }
  +    }
  +    
  +    /** @see java.lang.Object#toString() */
       public String toString() {
           StringBuffer sbuf = new StringBuffer();
           sbuf.append('(');
  -        sbuf.append(style); // Should get a String value for this enum 
constant
  +        sbuf.append(getStyleString());
           sbuf.append(',');
           sbuf.append(color);
           sbuf.append(',');
           sbuf.append(width);
  +        if (mode != SEPARATE) {
  +            sbuf.append(',');
  +            if (mode == COLLAPSE_INNER) {
  +                sbuf.append("collapse-inner");
  +            } else {
  +                sbuf.append("collapse-outer");
  +            }
  +        }
           sbuf.append(')');
           return sbuf.toString();
       }
  
  
  
  1.18      +87 -29    
xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java
  
  Index: TraitSetter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TraitSetter.java  7 Feb 2005 10:59:25 -0000       1.17
  +++ TraitSetter.java  16 Feb 2005 10:15:45 -0000      1.18
  @@ -49,56 +49,54 @@
           int iBP;
           iBP = bpProps.getPadding(CommonBorderPaddingBackground.START, 
bNotFirst);
           if (iBP > 0) {
  -            //area.addTrait(new Trait(Trait.PADDING_START, new 
Integer(iBP)));
               area.addTrait(Trait.PADDING_START, new Integer(iBP));
           }
           iBP = bpProps.getPadding(CommonBorderPaddingBackground.END, 
bNotLast);
           if (iBP > 0) {
  -            //area.addTrait(new Trait(Trait.PADDING_END, new Integer(iBP)));
               area.addTrait(Trait.PADDING_END, new Integer(iBP));
           }
           iBP = bpProps.getPadding(CommonBorderPaddingBackground.BEFORE, 
false);
           if (iBP > 0) {
  -            // area.addTrait(new Trait(Trait.PADDING_BEFORE, new 
Integer(iBP)));
               area.addTrait(Trait.PADDING_BEFORE, new Integer(iBP));
           }
           iBP = bpProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
           if (iBP > 0) {
  -            //area.addTrait(new Trait(Trait.PADDING_AFTER, new 
Integer(iBP)));
               area.addTrait(Trait.PADDING_AFTER, new Integer(iBP));
           }
   
           addBorderTrait(area, bpProps, bNotFirst,
  -                       CommonBorderPaddingBackground.START, 
Trait.BORDER_START);
  +                       CommonBorderPaddingBackground.START, 
  +                       BorderProps.SEPARATE, Trait.BORDER_START);
   
  -        addBorderTrait(area, bpProps, bNotLast, 
CommonBorderPaddingBackground.END,
  -                       Trait.BORDER_END);
  -
  -        addBorderTrait(area, bpProps, false, 
CommonBorderPaddingBackground.BEFORE,
  -                       Trait.BORDER_BEFORE);
  -
  -        addBorderTrait(area, bpProps, false, 
CommonBorderPaddingBackground.AFTER,
  -                       Trait.BORDER_AFTER);
  +        addBorderTrait(area, bpProps, bNotLast, 
  +                       CommonBorderPaddingBackground.END,
  +                       BorderProps.SEPARATE, Trait.BORDER_END);
  +
  +        addBorderTrait(area, bpProps, false, 
  +                       CommonBorderPaddingBackground.BEFORE,
  +                       BorderProps.SEPARATE, Trait.BORDER_BEFORE);
  +
  +        addBorderTrait(area, bpProps, false, 
  +                       CommonBorderPaddingBackground.AFTER,
  +                       BorderProps.SEPARATE, Trait.BORDER_AFTER);
       }
   
       /**
        * Sets border traits on an area.
        * @param area area to set the traits on
        * @param bpProps border and padding properties
  +     * @param mode the border paint mode (see BorderProps)
        */
       private static void addBorderTrait(Area area,
                                          CommonBorderPaddingBackground bpProps,
  -                                       boolean bDiscard, int iSide,
  +                                       boolean bDiscard, int iSide, int mode,
                                          Object oTrait) {
           int iBP = bpProps.getBorderWidth(iSide, bDiscard);
           if (iBP > 0) {
  -            //     area.addTrait(new Trait(oTrait,
  -            //     new BorderProps(bpProps.getBorderStyle(iSide),
  -            //     iBP,
  -            //     bpProps.getBorderColor(iSide))));
               area.addTrait(oTrait,
                             new BorderProps(bpProps.getBorderStyle(iSide),
  -                                          iBP, 
bpProps.getBorderColor(iSide)));
  +                                          iBP, bpProps.getBorderColor(iSide),
  +                                          mode));
           }
       }
   
  @@ -111,22 +109,62 @@
        */
       public static void addBorders(Area area, CommonBorderPaddingBackground 
bordProps) {
           BorderProps bps = getBorderProps(bordProps, 
CommonBorderPaddingBackground.BEFORE);
  -        if (bps.width != 0) {
  +        if (bps != null) {
               area.addTrait(Trait.BORDER_BEFORE, bps);
           }
           bps = getBorderProps(bordProps, CommonBorderPaddingBackground.AFTER);
  -        if (bps.width != 0) {
  +        if (bps != null) {
               area.addTrait(Trait.BORDER_AFTER, bps);
           }
           bps = getBorderProps(bordProps, CommonBorderPaddingBackground.START);
  -        if (bps.width != 0) {
  +        if (bps != null) {
               area.addTrait(Trait.BORDER_START, bps);
           }
           bps = getBorderProps(bordProps, CommonBorderPaddingBackground.END);
  -        if (bps.width != 0) {
  +        if (bps != null) {
               area.addTrait(Trait.BORDER_END, bps);
           }
   
  +        addPadding(area, bordProps);
  +    }
  +
  +    /**
  +     * Add borders to an area for the collapsing border model in tables.
  +     * Layout managers that create areas with borders can use this to
  +     * add the borders to the area.
  +     * @param area the area to set the traits on.
  +     * @param bordProps border properties
  +     * @param outer 4 boolean values indicating if the side represents the 
  +     *     table's outer border. Order: before, after, start, end
  +     */
  +    public static void addCollapsingBorders(Area area, 
  +            CommonBorderPaddingBackground bordProps,
  +            boolean[] outer) {
  +        BorderProps bps = getCollapsingBorderProps(bordProps, 
  +                CommonBorderPaddingBackground.BEFORE, outer[0]);
  +        if (bps != null) {
  +            area.addTrait(Trait.BORDER_BEFORE, bps);
  +        }
  +        bps = getCollapsingBorderProps(bordProps, 
  +                CommonBorderPaddingBackground.AFTER, outer[1]);
  +        if (bps != null) {
  +            area.addTrait(Trait.BORDER_AFTER, bps);
  +        }
  +        bps = getCollapsingBorderProps(bordProps, 
  +                CommonBorderPaddingBackground.START, outer[2]);
  +        if (bps != null) {
  +            area.addTrait(Trait.BORDER_START, bps);
  +        }
  +        bps = getCollapsingBorderProps(bordProps, 
  +                CommonBorderPaddingBackground.END, outer[3]);
  +        if (bps != null) {
  +            area.addTrait(Trait.BORDER_END, bps);
  +        }
  +
  +        addPadding(area, bordProps);
  +    }
  +
  +    private static void addPadding(Area area, CommonBorderPaddingBackground 
bordProps) {
           int padding = 
bordProps.getPadding(CommonBorderPaddingBackground.START, false);
           if (padding != 0) {
               area.addTrait(Trait.PADDING_START, new 
java.lang.Integer(padding));
  @@ -147,13 +185,33 @@
               area.addTrait(Trait.PADDING_AFTER, new 
java.lang.Integer(padding));
           }
       }
  -
  +    
       private static BorderProps getBorderProps(CommonBorderPaddingBackground 
bordProps, int side) {
  -        BorderProps bps;
  -        bps = new BorderProps(bordProps.getBorderStyle(side),
  -                              bordProps.getBorderWidth(side, false),
  -                              bordProps.getBorderColor(side));
  -        return bps;
  +        int width = bordProps.getBorderWidth(side, false);
  +        if (width != 0) {
  +            BorderProps bps;
  +            bps = new BorderProps(bordProps.getBorderStyle(side),
  +                                  width,
  +                                  bordProps.getBorderColor(side),
  +                                  BorderProps.SEPARATE);
  +            return bps;
  +        } else {
  +            return null;
  +        }
  +    }
  +
  +    private static BorderProps getCollapsingBorderProps(
  +            CommonBorderPaddingBackground bordProps, int side, boolean 
outer) {
  +        int width = bordProps.getBorderWidth(side, false);
  +        if (width != 0) {
  +            BorderProps bps;
  +            bps = new BorderProps(bordProps.getBorderStyle(side),
  +                    width, bordProps.getBorderColor(side),
  +                    (outer ? BorderProps.COLLAPSE_OUTER : 
BorderProps.COLLAPSE_INNER));
  +            return bps;
  +        } else {
  +            return null;
  +        }
       }
   
       /**
  
  
  
  1.22      +41 -10    xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java
  
  Index: Cell.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Cell.java 15 Feb 2005 19:30:51 -0000      1.21
  +++ Cell.java 16 Feb 2005 10:15:45 -0000      1.22
  @@ -77,6 +77,21 @@
       }
       
       /**
  +     * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
  +     */
  +    protected void initProperties() {
  +        super.initProperties();
  +        borderAndPaddingBPD = 0;
  +        borderAndPaddingBPD += 
fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
  +        borderAndPaddingBPD += 
fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false);
  +        if (!fobj.isSeparateBorderModel()) {
  +            borderAndPaddingBPD /= 2;
  +        }
  +        borderAndPaddingBPD += 
fobj.getCommonBorderPaddingBackground().getPaddingBefore(false);
  +        borderAndPaddingBPD += 
fobj.getCommonBorderPaddingBackground().getPaddingAfter(false);
  +    }
  +    
  +    /**
        * @return the table owning this cell
        */
       public Table getTable() {
  @@ -89,7 +104,13 @@
       
       private int getIPIndents() {
           int iIndents = 0;
  -        iIndents += 
fobj.getCommonBorderPaddingBackground().getIPPaddingAndBorder(false);
  +        iIndents += 
fobj.getCommonBorderPaddingBackground().getBorderStartWidth(false);
  +        iIndents += 
fobj.getCommonBorderPaddingBackground().getBorderEndWidth(false);
  +        if (!fobj.isSeparateBorderModel()) {
  +            iIndents /= 2;
  +        }
  +        iIndents += 
fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
  +        iIndents += 
fobj.getCommonBorderPaddingBackground().getPaddingEnd(false);
           return iIndents;
       }
       
  @@ -104,12 +125,7 @@
       public BreakPoss getNextBreakPoss(LayoutContext context) {
           LayoutManager curLM; // currently active LM
   
  -        borderAndPaddingBPD = fobj.getCommonBorderPaddingBackground()
  -                .getBPPaddingAndBorder(false);
  -        
           MinOptMax stackSize = new MinOptMax();
  -        // if starting add space before
  -        // stackSize.add(spaceBefore);
           BreakPoss lastPos = null;
   
           referenceIPD = context.getRefIPD(); 
  @@ -252,10 +268,17 @@
               addID(fobj.getId());
           }
   
  -        if (!emptyCell 
  -                || (fobj.isSeparateBorderModel() && fobj.showEmptyCells())) {
  -            TraitSetter.addBorders(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +        if (fobj.isSeparateBorderModel()) {
  +            if (!emptyCell || fobj.showEmptyCells()) {
  +                TraitSetter.addBorders(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +                TraitSetter.addBackground(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +            }
  +        } else {
               TraitSetter.addBackground(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +            //TODO Set these booleans right
  +            boolean[] outer = new boolean[] {false, false, false, false};
  +            TraitSetter.addCollapsingBorders(curBlockArea, 
  +                    fobj.getCommonBorderPaddingBackground(), outer);
           }
   
           //Handle display-align
  @@ -317,6 +340,9 @@
               curBlockArea.setPositioning(Block.ABSOLUTE);
               int indent = 0;
               indent += 
fobj.getCommonBorderPaddingBackground().getBorderStartWidth(false);
  +            if (!fobj.isSeparateBorderModel()) {
  +                indent /= 2;
  +            }
               indent += 
fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
               // set position
               int halfBorderSep = 0;
  @@ -324,8 +350,13 @@
                   halfBorderSep = fobj.getBorderSeparation().getLengthPair()
                           .getIPD().getLength().getValue() / 2;
               }
  +            int halfCollapsingBorderHeight = 0;
  +            if (!fobj.isSeparateBorderModel()) {
  +                halfCollapsingBorderHeight += 
  +                    
fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false) / 2;
  +            }
               curBlockArea.setXOffset(xoffset + inRowIPDOffset + halfBorderSep 
+ indent);
  -            curBlockArea.setYOffset(yoffset);
  +            curBlockArea.setYOffset(yoffset - halfCollapsingBorderHeight);
               curBlockArea.setIPD(cellIPD);
               //curBlockArea.setHeight();
   
  
  
  
  1.81      +91 -24    
xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- PDFRenderer.java  12 Feb 2005 15:33:08 -0000      1.80
  +++ PDFRenderer.java  16 Feb 2005 10:15:45 -0000      1.81
  @@ -658,91 +658,158 @@
           boolean b[] = new boolean[] {
               (bpsBefore != null), (bpsEnd != null), 
               (bpsAfter != null), (bpsStart != null)};
  +        if (!b[0] && !b[1] && !b[2] && !b[3]) {
  +            return;
  +        }
           float bw[] = new float[] {
               (b[0] ? bpsBefore.width / 1000f : 0.0f),
               (b[1] ? bpsEnd.width / 1000f : 0.0f),
               (b[2] ? bpsAfter.width / 1000f : 0.0f),
               (b[3] ? bpsStart.width / 1000f : 0.0f)};
  +        float clipw[] = new float[] {
  +            BorderProps.getClippedWidth(bpsBefore) / 1000f,    
  +            BorderProps.getClippedWidth(bpsEnd) / 1000f,    
  +            BorderProps.getClippedWidth(bpsAfter) / 1000f,    
  +            BorderProps.getClippedWidth(bpsStart) / 1000f};
  +        starty += clipw[0];
  +        height -= clipw[0];
  +        height -= clipw[2];
  +        startx += clipw[3];
  +        width -= clipw[3];
  +        width -= clipw[1];
  +        
           boolean slant[] = new boolean[] {
               (b[3] && b[0]), (b[0] && b[1]), (b[1] && b[2]), (b[2] && b[3])};
           if (bpsBefore != null) {
               endTextObject();
   
               float sx1 = startx;
  -            float sx2 = (slant[0] ? sx1 + bw[3] : sx1);
  +            float sx2 = (slant[0] ? sx1 + bw[3] - clipw[3] : sx1);
               float ex1 = startx + width;
  -            float ex2 = (slant[1] ? ex1 - bw[1] : ex1);
  -            float outery = starty;
  +            float ex2 = (slant[1] ? ex1 - bw[1] + clipw[1] : ex1);
  +            float outery = starty - clipw[0];
  +            float clipy = outery + clipw[0];
               float innery = outery + bw[0];
   
               saveGraphicsState();
  -            moveTo(sx1, outery);
  -            lineTo(ex1, outery);
  +            moveTo(sx1, clipy);
  +            float sx1a = sx1;
  +            float ex1a = ex1;
  +            if (bpsBefore.mode == BorderProps.COLLAPSE_OUTER) {
  +                if (bpsStart != null && bpsStart.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    sx1a -= clipw[3];
  +                }
  +                if (bpsEnd != null && bpsEnd.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    ex1a += clipw[1];
  +                }
  +                lineTo(sx1a, outery);
  +                lineTo(ex1a, outery);
  +            }
  +            lineTo(ex1, clipy);
               lineTo(ex2, innery);
               lineTo(sx2, innery);
               closePath();
               clip();
  -            drawBorderLine(sx1, outery, ex1, innery, true, true, 
bpsBefore.style, bpsBefore.color);
  +            drawBorderLine(sx1a, outery, ex1a, innery, true, true, 
bpsBefore.style, bpsBefore.color);
               restoreGraphicsState();
           }
           if (bpsEnd != null) {
               endTextObject();
   
               float sy1 = starty;
  -            float sy2 = (slant[1] ? sy1 + bw[0] : sy1);
  +            float sy2 = (slant[1] ? sy1 + bw[0] - clipw[0] : sy1);
               float ey1 = starty + height;
  -            float ey2 = (slant[2] ? ey1 - bw[2] : ey1);
  -            float outerx = startx + width;
  +            float ey2 = (slant[2] ? ey1 - bw[2] + clipw[2] : ey1);
  +            float outerx = startx + width + clipw[1];
  +            float clipx = outerx - clipw[1];
               float innerx = outerx - bw[1];
               
               saveGraphicsState();
  -            moveTo(outerx, sy1);
  -            lineTo(outerx, ey1);
  +            moveTo(clipx, sy1);
  +            float sy1a = sy1;
  +            float ey1a = ey1;
  +            if (bpsEnd.mode == BorderProps.COLLAPSE_OUTER) {
  +                if (bpsBefore != null && bpsBefore.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    sy1a -= clipw[0];
  +                }
  +                if (bpsAfter != null && bpsAfter.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    ey1a += clipw[2];
  +                }
  +                lineTo(outerx, sy1a);
  +                lineTo(outerx, ey1a);
  +            }
  +            lineTo(clipx, ey1);
               lineTo(innerx, ey2);
               lineTo(innerx, sy2);
               closePath();
               clip();
  -            drawBorderLine(innerx, sy1, outerx, ey1, false, false, 
bpsEnd.style, bpsEnd.color);
  +            drawBorderLine(innerx, sy1a, outerx, ey1a, false, false, 
bpsEnd.style, bpsEnd.color);
               restoreGraphicsState();
           }
           if (bpsAfter != null) {
               endTextObject();
   
               float sx1 = startx;
  -            float sx2 = (slant[3] ? sx1 + bw[3] : sx1);
  +            float sx2 = (slant[3] ? sx1 + bw[3] - clipw[3] : sx1);
               float ex1 = startx + width;
  -            float ex2 = (slant[2] ? ex1 - bw[1] : ex1);
  -            float outery = starty + height;
  +            float ex2 = (slant[2] ? ex1 - bw[1] + clipw[1] : ex1);
  +            float outery = starty + height + clipw[2];
  +            float clipy = outery - clipw[2];
               float innery = outery - bw[2];
   
               saveGraphicsState();
  -            moveTo(ex1, outery);
  -            lineTo(sx1, outery);
  +            moveTo(ex1, clipy);
  +            float sx1a = sx1;
  +            float ex1a = ex1;
  +            if (bpsAfter.mode == BorderProps.COLLAPSE_OUTER) {
  +                if (bpsStart != null && bpsStart.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    sx1a -= clipw[3];
  +                }
  +                if (bpsStart != null && bpsStart.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    ex1a += clipw[1];
  +                }
  +                lineTo(ex1a, outery);
  +                lineTo(sx1a, outery);
  +            }
  +            lineTo(sx1, clipy);
               lineTo(sx2, innery);
               lineTo(ex2, innery);
               closePath();
               clip();
  -            drawBorderLine(sx1, innery, ex1, outery, true, false, 
bpsAfter.style, bpsAfter.color);
  +            drawBorderLine(sx1a, innery, ex1a, outery, true, false, 
bpsAfter.style, bpsAfter.color);
               restoreGraphicsState();
           }
           if (bpsStart != null) {
               endTextObject();
   
               float sy1 = starty;
  -            float sy2 = (slant[0] ? sy1 + bw[0] : sy1);
  +            float sy2 = (slant[0] ? sy1 + bw[0] - clipw[0] : sy1);
               float ey1 = sy1 + height;
  -            float ey2 = (slant[3] ? ey1 - bw[2] : ey1);
  -            float outerx = startx;
  +            float ey2 = (slant[3] ? ey1 - bw[2] + clipw[2]: ey1);
  +            float outerx = startx - clipw[3];
  +            float clipx = outerx + clipw[3];
               float innerx = outerx + bw[3];
   
               saveGraphicsState();
  -            moveTo(outerx, ey1);
  -            lineTo(outerx, sy1);
  +            moveTo(clipx, ey1);
  +            float sy1a = sy1;
  +            float ey1a = ey1;
  +            if (bpsStart.mode == BorderProps.COLLAPSE_OUTER) {
  +                if (bpsBefore != null && bpsBefore.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    sy1a -= clipw[0];
  +                }
  +                if (bpsAfter != null && bpsAfter.mode == 
BorderProps.COLLAPSE_OUTER) {
  +                    ey1a += clipw[2];
  +                }
  +                lineTo(outerx, sy1a);
  +                lineTo(outerx, ey1a);
  +            }
  +            lineTo(clipx, sy1);
               lineTo(innerx, sy2);
               lineTo(innerx, ey2);
               closePath();
               clip();
  -            drawBorderLine(outerx, sy1, innerx, ey1, false, true, 
bpsStart.style, bpsStart.color);
  +            drawBorderLine(outerx, sy1a, innerx, ey1a, false, true, 
bpsStart.style, bpsStart.color);
               restoreGraphicsState();
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to