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 ke...@apache.org on 2002/01/09 12:32:57 UTC

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

keiron      02/01/09 03:32:57

  Modified:    docs/examples/fo Tag: fop-0_20_2-maintain textdeko.fo
               src/org/apache/fop/fo Tag: fop-0_20_2-maintain
                        FObjMixed.java PropertyManager.java
               src/org/apache/fop/fo/flow Tag: fop-0_20_2-maintain
                        Block.java Inline.java
               src/org/apache/fop/render Tag: fop-0_20_2-maintain
                        PrintRenderer.java
  Log:
  adds inheritance for the text-decoration property from parent inline or
  block elements and fixes a bug with non-breaking spaces (but not all)
  Submitted by:	Christian Geisert <Ch...@isu-gmbh.de>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.4.3   +29 -3     xml-fop/docs/examples/fo/textdeko.fo
  
  Index: textdeko.fo
  ===================================================================
  RCS file: /home/cvs/xml-fop/docs/examples/fo/textdeko.fo,v
  retrieving revision 1.3.4.2
  retrieving revision 1.3.4.3
  diff -u -r1.3.4.2 -r1.3.4.3
  --- textdeko.fo	13 Dec 2001 09:25:21 -0000	1.3.4.2
  +++ textdeko.fo	9 Jan 2002 11:32:57 -0000	1.3.4.3
  @@ -59,7 +59,7 @@
         <fo:block font-size="12pt" font-family="sans-serif" line-height="15pt" text-align="justify" space-after.optimum="10pt">
         The "text-decoration"-property describes decorations that are added to the text of an element.
         If the property is specified for a block-level element, it should affect all inline-level descendants
  -      of the element (does not work yet!).
  +      of the element.
         If it is specified for (or affects) an inline-level
         element, it affects all boxes generated by the element.
         </fo:block>
  @@ -246,12 +246,38 @@
           What about underlining of whitespace only<fo:inline text-decoration="underline"> </fo:inline>?
         </fo:block>
   
  -
         <fo:block space-after.optimum="13pt" font-size="14pt" text-decoration="underline">
         A whole block should work now.
  -      And again some more Text to get at least two lines.
  +      And again some more text to get at least two lines.
  +      </fo:block>
  +
  +      <fo:block space-after.optimum="13pt" font-size="14pt" >
  +
  +      <fo:inline text-decoration="underline">
  +      <fo:block>
  +      Let's see if all inline-areas are <fo:inline>affected</fo:inline> ...
  +      </fo:block>
  +      </fo:inline>
  +
         </fo:block>
   
  +      <fo:block space-after.optimum="13pt" font-size="14pt" >
  +      <fo:inline text-decoration="underline">
  +      This is a workaround for
  +      <fo:inline text-decoration="overline">
  +      the combination of
  +      <fo:inline text-decoration="line-through">different text-decoration values...
  +      </fo:inline>
  +      </fo:inline>
  +      </fo:inline>
  +      </fo:block>
  +
  +      <fo:block space-after.optimum="13pt" font-size="14pt" >
  +      Enter your name here:
  +      <fo:inline text-decoration="underline">_&#160;&#160;&#160;&#160;&#160;&#160;&#160;
  +      &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
  +      &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</fo:inline>
  +      </fo:block>
   
       </fo:flow>
     </fo:page-sequence>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.12.2.2  +5 -1      xml-fop/src/org/apache/fop/fo/FObjMixed.java
  
  Index: FObjMixed.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FObjMixed.java,v
  retrieving revision 1.12.2.1
  retrieving revision 1.12.2.2
  diff -u -r1.12.2.1 -r1.12.2.2
  --- FObjMixed.java	13 Dec 2001 09:25:21 -0000	1.12.2.1
  +++ FObjMixed.java	9 Jan 2002 11:32:57 -0000	1.12.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: FObjMixed.java,v 1.12.2.1 2001/12/13 09:25:21 keiron Exp $
  + * $Id: FObjMixed.java,v 1.12.2.2 2002/01/09 11:32:57 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -34,6 +34,10 @@
   
       protected FObjMixed(FObj parent, PropertyList propertyList) {
           super(parent, propertyList);
  +    }
  +
  +    public TextState getTextState() {
  +        return ts;
       }
   
       protected void addCharacters(char data[], int start, int length) {
  
  
  
  1.7.2.2   +36 -10    xml-fop/src/org/apache/fop/fo/PropertyManager.java
  
  Index: PropertyManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyManager.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- PropertyManager.java	13 Dec 2001 09:25:22 -0000	1.7.2.1
  +++ PropertyManager.java	9 Jan 2002 11:32:57 -0000	1.7.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PropertyManager.java,v 1.7.2.1 2001/12/13 09:25:22 keiron Exp $
  + * $Id: PropertyManager.java,v 1.7.2.2 2002/01/09 11:32:57 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -250,24 +250,50 @@
           return props;
       }
   
  -    public TextState getTextDecoration() throws FOPException {
  +    public TextState getTextDecoration(FObj parent) throws FOPException {
  +
  +        // TextState from parent Block/Inline
  +        TextState tsp = null;
  +        boolean found = false;
  +
  +        do {
  +            String fname = parent.getName();
  +            if (fname.equals("fo:flow") || fname.equals("fo:static-content")) {
  +                found = true;
  +            } else if (fname.equals("fo:block") || fname.equals("fo:inline")) {
  +                FObjMixed fom = (FObjMixed) parent;
  +                tsp = fom.getTextState();
  +                found = true;
  +            }
  +            parent = parent.getParent();
  +        } while (!found);
  +
           TextState ts = new TextState();
   
  +        if (tsp != null) {
  +            ts.setUnderlined(tsp.getUnderlined());
  +            ts.setOverlined(tsp.getOverlined());
  +            ts.setLineThrough(tsp.getLineThrough());
  +        }
  +
           int textDecoration = this.properties.get("text-decoration").getEnum();
   
  -        switch (textDecoration) {
  -        case TextDecoration.UNDERLINE:
  +        if (textDecoration == TextDecoration.UNDERLINE) {
               ts.setUnderlined(true);
  -            break;
  -        case TextDecoration.OVERLINE:
  +        }
  +        if (textDecoration == TextDecoration.OVERLINE) {
               ts.setOverlined(true);
  -            break;
  -        case TextDecoration.LINE_THROUGH:
  +        }
  +        if (textDecoration == TextDecoration.LINE_THROUGH) {
               ts.setLineThrough(true);
  -            break;
  -        case TextDecoration.NONE:
  +        }
  +        if (textDecoration == TextDecoration.NO_UNDERLINE) {
               ts.setUnderlined(false);
  +        }
  +        if (textDecoration == TextDecoration.NO_OVERLINE) {
               ts.setOverlined(false);
  +        }
  +        if (textDecoration == TextDecoration.NO_LINE_THROUGH) {
               ts.setLineThrough(false);
           }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.41.2.3  +2 -2      xml-fop/src/org/apache/fop/fo/flow/Block.java
  
  Index: Block.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Block.java,v
  retrieving revision 1.41.2.2
  retrieving revision 1.41.2.3
  diff -u -r1.41.2.2 -r1.41.2.3
  --- Block.java	13 Dec 2001 09:25:22 -0000	1.41.2.2
  +++ Block.java	9 Jan 2002 11:32:57 -0000	1.41.2.3
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Block.java,v 1.41.2.2 2001/12/13 09:25:22 keiron Exp $
  + * $Id: Block.java,v 1.41.2.3 2002/01/09 11:32:57 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -72,7 +72,7 @@
           super(parent, propertyList);
           this.name = "fo:block";
           this.span = this.properties.get("span").getEnum();
  -        ts = propMgr.getTextDecoration();
  +        ts = propMgr.getTextDecoration(parent);
       }
   
       public Status layout(Area area) throws FOPException {
  
  
  
  1.8.2.2   +2 -2      xml-fop/src/org/apache/fop/fo/flow/Inline.java
  
  Index: Inline.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Inline.java,v
  retrieving revision 1.8.2.1
  retrieving revision 1.8.2.2
  diff -u -r1.8.2.1 -r1.8.2.2
  --- Inline.java	13 Dec 2001 09:25:22 -0000	1.8.2.1
  +++ Inline.java	9 Jan 2002 11:32:57 -0000	1.8.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Inline.java,v 1.8.2.1 2001/12/13 09:25:22 keiron Exp $
  + * $Id: Inline.java,v 1.8.2.2 2002/01/09 11:32:57 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -74,7 +74,7 @@
           // this.properties.get("z-index");
   
           // Text Decoration Properties
  -        ts = propMgr.getTextDecoration();
  +        ts = propMgr.getTextDecoration(parent);
   
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.14.2.1  +5 -1      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
  retrieving revision 1.14.2.1
  diff -u -r1.14 -r1.14.2.1
  --- PrintRenderer.java	18 Sep 2001 13:06:07 -0000	1.14
  +++ PrintRenderer.java	9 Jan 2002 11:32:57 -0000	1.14.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PrintRenderer.java,v 1.14 2001/09/18 13:06:07 keiron Exp $
  + * $Id: PrintRenderer.java,v 1.14.2.1 2002/01/09 11:32:57 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources."
  @@ -332,6 +332,8 @@
                           prevUnderlineXEndPos + space.getSize(),
                           prevUnderlineYEndPos, prevUnderlineSize,
                           prevUnderlineColor);
  +                // save position for a following InlineSpace
  +                prevUnderlineXEndPos = prevUnderlineXEndPos + space.getSize();
               }
           }
           if (space.getOverlined()) {
  @@ -340,6 +342,7 @@
                           prevOverlineXEndPos + space.getSize(),
                           prevOverlineYEndPos, prevOverlineSize,
                           prevOverlineColor);
  +                prevOverlineXEndPos = prevOverlineXEndPos + space.getSize();
               }
           }
           if (space.getLineThrough()) {
  @@ -348,6 +351,7 @@
                           prevLineThroughXEndPos + space.getSize(),
                           prevLineThroughYEndPos, prevLineThroughSize,
                           prevLineThroughColor);
  +                prevLineThroughXEndPos = prevLineThroughXEndPos + space.getSize();
               }
           }
       }
  
  
  

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