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 kl...@apache.org on 2001/02/01 22:38:13 UTC

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

klease      01/02/01 13:38:13

  Modified:    docs/examples/fo textdeko.fo
               src/codegen foproperties.xml
               src/org/apache/fop/fo FOText.java
               src/org/apache/fop/fo/flow Inline.java PageNumber.java
                        PageNumberCitation.java
               src/org/apache/fop/layout BlockArea.java LineArea.java
               src/org/apache/fop/layout/inline InlineArea.java
                        InlineSpace.java
               src/org/apache/fop/render/pdf PDFRenderer.java
  Log:
  Commit more text decoration support from Christain Geisert (finally)
  
  Revision  Changes    Path
  1.2       +92 -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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- textdeko.fo	2000/10/26 14:33:28	1.1
  +++ textdeko.fo	2001/02/01 21:37:56	1.2
  @@ -64,7 +64,7 @@
         element, it affects all boxes generated by the element.
         </fo:block>
   
  -      <fo:block font-size="12pt" font-family="sans-serif" line-height="15pt" space-after.optimum="3pt">
  +      <fo:block font-size="12pt" font-family="sans-serif" line-height="15pt" space-after.optimum="13pt">
         Example: <fo:inline text-decoration="underline">underline</fo:inline>
         </fo:block>
   
  @@ -96,10 +96,10 @@
         </fo:block>
   
         <fo:block font-size="12pt" font-family="sans-serif" line-height="15pt" text-align="justify" space-after.optimum="3pt">
  -      The following text decorations are defined in the WD:
  +      The following text decorations are defined in the CR:
         </fo:block>
   
  -      <fo:list-block>
  +      <fo:list-block space-after.optimum="13pt">
   
           <fo:list-item>
             <fo:list-item-label>
  @@ -156,7 +156,96 @@
             </fo:list-item-body>
           </fo:list-item>
   
  +        <fo:list-item>
  +          <fo:list-item-label>
  +            <fo:block>&#x2022;</fo:block>
  +          </fo:list-item-label>
  +          <fo:list-item-body>
  +            <fo:block>
  +              <fo:inline text-decoration="no-underline">no-underline</fo:inline>
  +            </fo:block>
  +          </fo:list-item-body>
  +        </fo:list-item>
  +
  +        <fo:list-item>
  +          <fo:list-item-label>
  +            <fo:block>&#x2022;</fo:block>
  +          </fo:list-item-label>
  +          <fo:list-item-body>
  +            <fo:block>
  +              <fo:inline text-decoration="no-overline">no-overline</fo:inline>
  +            </fo:block>
  +          </fo:list-item-body>
  +        </fo:list-item>
  +
  +        <fo:list-item>
  +          <fo:list-item-label>
  +            <fo:block>&#x2022;</fo:block>
  +          </fo:list-item-label>
  +          <fo:list-item-body>
  +            <fo:block>
  +              <fo:inline text-decoration="no-line-through">no-line-through</fo:inline>
  +            </fo:block>
  +          </fo:list-item-body>
  +        </fo:list-item>
  +
  +        <fo:list-item>
  +          <fo:list-item-label>
  +            <fo:block>&#x2022;</fo:block>
  +          </fo:list-item-label>
  +          <fo:list-item-body>
  +            <fo:block>
  +              <fo:inline text-decoration="no-blink">no-blink</fo:inline>
  +            </fo:block>
  +          </fo:list-item-body>
  +        </fo:list-item>
  +
         </fo:list-block>
  +
  +      <fo:block font-size="12pt" space-after.optimum="3pt">
  +      <fo:inline text-decoration="underline overline">Combination</fo:inline> of property
  +      values should also be possible, but does not work in FOP at the moment.
  +      </fo:block>
  +
  +      <fo:block font-size="12pt" space-after.optimum="13pt">
  +      <fo:inline font-family="monospace"><![CDATA[<fo:inline text-decoration="underline overline">
  +      Combination</fo:inline>]]></fo:inline>
  +      </fo:block>
  +
  +
  +      <fo:block space-after.optimum="13pt">
  +        And now <fo:inline text-decoration="underline">more than a word...</fo:inline>
  +      </fo:block>
  +
  +      <fo:block space-after.optimum="13pt" font-size="14pt" >
  +      <fo:inline text-decoration="underline">
  +      This is a whole block wrapped in fo:inline with the property text-decoration="underline".
  +      Some more Text to get at least two lines.
  +      </fo:inline>
  +      </fo:block>
  +
  +      <fo:block font-size="22pt" 
  +                font-family="sans-serif" 
  +                line-height="22pt"
  +                space-after.optimum="10pt"
  +                text-align="start">
  +        This is simple test with a <fo:inline text-decoration="overline">bigger font-size</fo:inline>.
  +      </fo:block>
  +      <fo:block font-size="15pt" 
  +                font-family="monospace" 
  +                line-height="15pt"
  +                space-after.optimum="10pt"
  +                text-align="start">
  +        This is simple test with a <fo:inline text-decoration="line-through">monospaced font</fo:inline>.
  +      </fo:block>
  +
  +      <fo:block font-size="15pt" 
  +                line-height="15pt"
  +                space-after.optimum="10pt"
  +                text-align="start">
  +        What about underlining of whitespace only<fo:inline text-decoration="underline"> </fo:inline>?
  +      </fo:block>
  +
   
       </fo:flow>
     </fo:page-sequence>
  
  
  
  1.13      +5 -0      xml-fop/src/codegen/foproperties.xml
  
  Index: foproperties.xml
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/codegen/foproperties.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- foproperties.xml	2001/01/23 15:58:42	1.12
  +++ foproperties.xml	2001/02/01 21:37:58	1.13
  @@ -1069,6 +1069,11 @@
   				<value const="UNDERLINE">underline</value>
   				<value const="OVERLINE">overline</value>
   				<value const="LINE_THROUGH">line-through</value>
  +				<value const="BLINK">blink</value>
  +				<value const="NO_UNDERLINE">no-underline</value>
  +				<value const="NO_OVERLINE">no-overline</value>
  +				<value const="NO_LINE_THROUGH">no-line-through</value>
  +				<value const="NO_BLINK">no-blink</value>
   			</enumeration>
   		<default>none</default>
   	</property>
  
  
  
  1.16      +19 -3     xml-fop/src/org/apache/fop/fo/FOText.java
  
  Index: FOText.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOText.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FOText.java	2001/01/23 15:59:57	1.15
  +++ FOText.java	2001/02/01 21:37:59	1.16
  @@ -1,4 +1,4 @@
  -/*-- $Id: FOText.java,v 1.15 2001/01/23 15:59:57 eschaeffer Exp $ --
  +/*-- $Id: FOText.java,v 1.16 2001/02/01 21:37:59 klease Exp $ --
   
    ============================================================================
   									 The Apache Software License, Version 1.1
  @@ -56,6 +56,7 @@
   import org.apache.fop.messaging.MessageHandler;
   import org.apache.fop.layout.BlockArea;
   import org.apache.fop.layout.FontState;
  +import org.apache.fop.layout.TextState;
   import org.apache.fop.datatypes.*;
   import org.apache.fop.fo.properties.*;
   import org.apache.fop.apps.FOPException;
  @@ -81,7 +82,9 @@
   		protected boolean overlined = false;
   		protected boolean lineThrough = false;
   
  +                TextState ts;
   
  +
   		public FOText(char[] chars, int s, int e, FObj parent) {
   				super(parent);
   				this.start = 0;
  @@ -95,6 +98,15 @@
   				this.underlined = ul;
   		}
   
  +    public void setOverlined(boolean ol) {
  +        this.overlined = ol;
  +    }
  +
  +    public void setLineThrough(boolean lt) {
  +        this.lineThrough = lt;
  +    }
  +
  +
   		public boolean willCreateArea()
   		{
   				this.whiteSpaceCollapse = this.parent.properties.get(
  @@ -143,14 +155,18 @@
   						this.wrapOption =
   							this.parent.properties.get("wrap-option").getEnum();
   						this.whiteSpaceCollapse = this.parent.properties.get(
  -																				"white-space-collapse").getEnum();
  +																				"white-space-collapse").getEnum(); 
  +						this.ts = new TextState();
  +						ts.setUnderlined(underlined);            
  +						ts.setOverlined(overlined);            
  +						ts.setLineThrough(lineThrough);            
   
   						this.marker = this.start;
   				}
   				int orig_start = this.marker;
   				this.marker = ((BlockArea) area).addText(fs, red, green, blue,
   											wrapOption, this.getLinkSet(), whiteSpaceCollapse, ca,
  -											this.marker, length, underlined);
  +											this.marker, length, ts);
   				if (this.marker == -1) {
   
   
  
  
  
  1.3       +11 -1     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Inline.java	2000/10/19 17:00:10	1.2
  +++ Inline.java	2001/02/01 21:38:01	1.3
  @@ -1,4 +1,4 @@
  -/*-- $Id: Inline.java,v 1.2 2000/10/19 17:00:10 gears Exp $ -- 
  +/*-- $Id: Inline.java,v 1.3 2001/02/01 21:38:01 klease Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -91,6 +91,14 @@
           this.underlined = true;
       }
   
  +    if (textDecoration == TextDecoration.OVERLINE) {
  +        this.overlined = true;
  +    }
  +
  +    if (textDecoration == TextDecoration.LINE_THROUGH) {
  +        this.lineThrough = true;
  +    }
  +
       if (parent.getName().equals("fo:flow")) {
         throw new FOPException("fo:inline can't be directly"
                      + " under flow"); 
  @@ -101,6 +109,8 @@
     protected void addCharacters(char data[], int start, int length) { 
         FOText ft = new FOText(data,start,length, this);
         ft.setUnderlined(underlined);
  +      ft.setOverlined(overlined);
  +      ft.setLineThrough(lineThrough);
         children.addElement(ft);
     }
   
  
  
  
  1.13      +4 -3      xml-fop/src/org/apache/fop/fo/flow/PageNumber.java
  
  Index: PageNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/PageNumber.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PageNumber.java	2001/01/25 15:05:52	1.12
  +++ PageNumber.java	2001/02/01 21:38:02	1.13
  @@ -1,4 +1,4 @@
  -/*-- $Id: PageNumber.java,v 1.12 2001/01/25 15:05:52 eschaeffer Exp $ --
  +/*-- $Id: PageNumber.java,v 1.13 2001/02/01 21:38:02 klease Exp $ --
   
    ============================================================================
   									 The Apache Software License, Version 1.1
  @@ -81,6 +81,7 @@
   		float blue;
   		int wrapOption;
   		int whiteSpaceCollapse;
  +  TextState ts;
   
   		public PageNumber(FObj parent, PropertyList propertyList) {
   				super(parent, propertyList);
  @@ -117,7 +118,7 @@
   						this.wrapOption = this.properties.get("wrap-option").getEnum();
   						this.whiteSpaceCollapse =
   							this.properties.get("white-space-collapse").getEnum();
  -
  +						ts = new TextState();
   						this.marker = 0;
   
   						// initialize id
  @@ -128,7 +129,7 @@
   				String p = Integer.toString(area.getPage().getNumber());
   				this.marker = ((BlockArea) area).addText(fs, red, green, blue,
   											wrapOption, null, whiteSpaceCollapse, p.toCharArray(),
  -											0, p.length(), false);
  +											0, p.length(), ts);
   				return new Status(Status.OK);
   		}
   }
  
  
  
  1.12      +4 -2      xml-fop/src/org/apache/fop/fo/flow/PageNumberCitation.java
  
  Index: PageNumberCitation.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/PageNumberCitation.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PageNumberCitation.java	2001/01/30 00:03:06	1.11
  +++ PageNumberCitation.java	2001/02/01 21:38:02	1.12
  @@ -1,4 +1,4 @@
  -/*-- $Id: PageNumberCitation.java,v 1.11 2001/01/30 00:03:06 keiron Exp $ --
  +/*-- $Id: PageNumberCitation.java,v 1.12 2001/02/01 21:38:02 klease Exp $ --
   
    ============================================================================
   									 The Apache Software License, Version 1.1
  @@ -138,6 +138,7 @@
   		String pageNumber;
   		String refId;
   		String id;
  +  TextState ts;
   
   
   		public PageNumberCitation(FObj parent, PropertyList propertyList) {
  @@ -189,6 +190,7 @@
   						// create id
   						this.id = this.properties.get("id").getString();
   						idReferences.createID(id);
  +						ts = new TextState();
   
   						this.marker = 0;
   				}
  @@ -204,7 +206,7 @@
   						this.marker = ((BlockArea) area).addText(fs, red, green, blue,
   													wrapOption, null, whiteSpaceCollapse,
   													pageNumber.toCharArray(), 0, pageNumber.length(),
  -													false);
  +													ts);
   				} else { // add pageNumberCitation to area to be resolved during rendering
               BlockArea blockArea = (BlockArea)area;
               LineArea la = blockArea.getCurrentLineArea();
  
  
  
  1.24      +130 -129  xml-fop/src/org/apache/fop/layout/BlockArea.java
  
  Index: BlockArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/BlockArea.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- BlockArea.java	2001/01/30 04:50:23	1.23
  +++ BlockArea.java	2001/02/01 21:38:04	1.24
  @@ -1,4 +1,4 @@
  -/*-- $Id: BlockArea.java,v 1.23 2001/01/30 04:50:23 keiron Exp $ --
  +/*-- $Id: BlockArea.java,v 1.24 2001/02/01 21:38:04 klease Exp $ --
   
    ============================================================================
   									 The Apache Software License, Version 1.1
  @@ -74,16 +74,16 @@
    */
   public class BlockArea extends Area {
   
  -		/* relative to area container */
  -		protected int startIndent;
  -		protected int endIndent;
  +  /* relative to area container */
  +  protected int startIndent;
  +  protected int endIndent;
   
   		/* first line startIndent modifier */
  -		protected int textIndent;
  +  protected int textIndent;
   
  -		protected int lineHeight;
  +  protected int lineHeight;
   
  -		protected int halfLeading;
  +  protected int halfLeading;
   
   
   		/* text-align of all but the last line */
  @@ -152,145 +152,145 @@
   				}
   		}
   
  -		// font-variant support : addText is a wrapper for addRealText
  -		// added by Eric SCHAEFFER
  -		public int addText(FontState fontState, float red, float green,
  -											 float blue, int wrapOption, LinkSet ls,
  -											 int whiteSpaceCollapse, char data[], int start, int end,
  -											 boolean ul) {
  -			if (fontState.getFontVariant() == FontVariant.SMALL_CAPS) {
  -				FontState smallCapsFontState;
  -				try {
  -					int smallCapsFontHeight = (int) (((double) fontState.getFontSize()) * 0.8d);
  -					smallCapsFontState = new FontState(
  -						fontState.getFontInfo(),
  -						fontState.getFontFamily(),
  -						fontState.getFontStyle(),
  -						fontState.getFontWeight(),
  -						smallCapsFontHeight,
  -						FontVariant.NORMAL);
  -				} catch (FOPException ex) {
  -					smallCapsFontState = fontState;
  -					MessageHandler.errorln("Error creating small-caps FontState: " + ex.getMessage());
  -				}
  -
  -				// parse text for upper/lower case and call addRealText
  -				char c;
  -				boolean isLowerCase;
  -				int caseStart;
  -				FontState fontStateToUse;
  -				for (int i = start; i < end; ) {
  -					caseStart = i;
  -					c = data[i];
  -					isLowerCase = (java.lang.Character.isLetter(c) && java.lang.Character.isLowerCase(c));
  -					while (isLowerCase == (java.lang.Character.isLetter(c) && java.lang.Character.isLowerCase(c))) {
  -						if (isLowerCase) {
  -							data[i] = java.lang.Character.toUpperCase(c);
  -						}
  -						i++;
  -						if (i == end)
  -							break;
  -						c = data[i];
  -					}
  -					if (isLowerCase) {
  -						fontStateToUse = smallCapsFontState;
  -					} else {
  -						fontStateToUse = fontState;
  -					}
  -					int index = this.addRealText(fontStateToUse, red, green, blue, wrapOption, ls,
  -						whiteSpaceCollapse, data, caseStart, i, ul);
  -					if (index != -1) {
  -						return index;
  -					}
  -				}
  +  // font-variant support : addText is a wrapper for addRealText
  +  // added by Eric SCHAEFFER
  +  public int addText(FontState fontState, float red, float green,
  +		     float blue, int wrapOption, LinkSet ls,
  +		     int whiteSpaceCollapse, char data[], int start, int end,
  +		     TextState textState) {
  +    if (fontState.getFontVariant() == FontVariant.SMALL_CAPS) {
  +      FontState smallCapsFontState;
  +      try {
  +	int smallCapsFontHeight = (int) (((double) fontState.getFontSize()) * 0.8d);
  +	smallCapsFontState = new FontState(
  +					   fontState.getFontInfo(),
  +					   fontState.getFontFamily(),
  +					   fontState.getFontStyle(),
  +					   fontState.getFontWeight(),
  +					   smallCapsFontHeight,
  +					   FontVariant.NORMAL);
  +      } catch (FOPException ex) {
  +	smallCapsFontState = fontState;
  +	MessageHandler.errorln("Error creating small-caps FontState: " + ex.getMessage());
  +      }
  +
  +      // parse text for upper/lower case and call addRealText
  +      char c;
  +      boolean isLowerCase;
  +      int caseStart;
  +      FontState fontStateToUse;
  +      for (int i = start; i < end; ) {
  +	caseStart = i;
  +	c = data[i];
  +	isLowerCase = (java.lang.Character.isLetter(c) && java.lang.Character.isLowerCase(c));
  +	while (isLowerCase == (java.lang.Character.isLetter(c) && java.lang.Character.isLowerCase(c))) {
  +	  if (isLowerCase) {
  +	    data[i] = java.lang.Character.toUpperCase(c);
  +	  }
  +	  i++;
  +	  if (i == end)
  +	    break;
  +	  c = data[i];
  +	}
  +	if (isLowerCase) {
  +	  fontStateToUse = smallCapsFontState;
  +	} else {
  +	  fontStateToUse = fontState;
  +	}
  +	int index = this.addRealText(fontStateToUse, red, green, blue, wrapOption, ls,
  +				     whiteSpaceCollapse, data, caseStart, i, textState);
  +	if (index != -1) {
  +	  return index;
  +	}
  +      }
   
  -				return -1;
  -			}
  -
  -			// font-variant normal
  -			return this.addRealText(fontState, red, green, blue, wrapOption, ls,
  -				whiteSpaceCollapse, data, start, end, ul);
  -		}
  -
  -		protected int addRealText(FontState fontState, float red, float green,
  -											 float blue, int wrapOption, LinkSet ls,
  -											 int whiteSpaceCollapse, char data[], int start, int end,
  -											 boolean ul) {
  -				int ts, te;
  -				char[] ca;
  -
  -				ts = start;
  -				te = end;
  -				ca = data;
  +      return -1;
  +    }
   
  -				if (currentHeight + currentLineArea.getHeight() > maxHeight) {
  -						return start;
  -				}
  +    // font-variant normal
  +    return this.addRealText(fontState, red, green, blue, wrapOption, ls,
  +			    whiteSpaceCollapse, data, start, end, textState);
  +  }
  +
  +  protected int addRealText(FontState fontState, float red, float green,
  +			    float blue, int wrapOption, LinkSet ls,
  +			    int whiteSpaceCollapse, char data[], int start, int end,
  +			    TextState textState) {
  +    int ts, te;
  +    char[] ca;
  +
  +    ts = start;
  +    te = end;
  +    ca = data;
   
  -				this.currentLineArea.changeFont(fontState);
  -				this.currentLineArea.changeColor(red, green, blue);
  -				this.currentLineArea.changeWrapOption(wrapOption);
  -				this.currentLineArea.changeWhiteSpaceCollapse(whiteSpaceCollapse);
  -				this.currentLineArea.changeHyphenation(language, country, hyphenate,
  -																 hyphenationChar, hyphenationPushCharacterCount,
  -																 hyphenationRemainCharacterCount);
  -				if (ls != null) {
  -						this.currentLinkSet = ls;
  -						ls.setYOffset(currentHeight);
  -				}
  +    if (currentHeight + currentLineArea.getHeight() > maxHeight) {
  +      return start;
  +    }
   
  -				ts = this.currentLineArea.addText(ca, ts, te, ls, ul);
  -				this.hasLines = true;
  +    this.currentLineArea.changeFont(fontState);
  +    this.currentLineArea.changeColor(red, green, blue);
  +    this.currentLineArea.changeWrapOption(wrapOption);
  +    this.currentLineArea.changeWhiteSpaceCollapse(whiteSpaceCollapse);
  +    this.currentLineArea.changeHyphenation(language, country, hyphenate,
  +					   hyphenationChar, hyphenationPushCharacterCount,
  +					   hyphenationRemainCharacterCount);
  +    if (ls != null) {
  +      this.currentLinkSet = ls;
  +      ls.setYOffset(currentHeight);
  +    }
   
  -				while (ts != -1) {
  -						this.currentLineArea.align(this.align);
  -						this.addLineArea(this.currentLineArea);
  +    ts = this.currentLineArea.addText(ca, ts, te, ls, textState);
  +    this.hasLines = true;
   
  -						this.currentLineArea =
  -							new LineArea(fontState, lineHeight, halfLeading,
  -													 allocationWidth, startIndent, endIndent,
  -													 currentLineArea);
  -						if (currentHeight + currentLineArea.getHeight() >
  -										this.maxHeight) {
  -								return ts;
  -						}
  -						this.currentLineArea.changeFont(fontState);
  -						this.currentLineArea.changeColor(red, green, blue);
  -						this.currentLineArea.changeWrapOption(wrapOption);
  -						this.currentLineArea.changeWhiteSpaceCollapse(
  -							whiteSpaceCollapse);
  -						this.currentLineArea.changeHyphenation(language, country, hyphenate,
  -																		 hyphenationChar, hyphenationPushCharacterCount,
  -																		 hyphenationRemainCharacterCount);
  -						if (ls != null) {
  -								ls.setYOffset(currentHeight);
  -						}
  +    while (ts != -1) {
  +      this.currentLineArea.align(this.align);
  +      this.addLineArea(this.currentLineArea);
  +
  +      this.currentLineArea =
  +	new LineArea(fontState, lineHeight, halfLeading,
  +		     allocationWidth, startIndent, endIndent,
  +		     currentLineArea);
  +      if (currentHeight + currentLineArea.getHeight() >
  +	  this.maxHeight) {
  +	return ts;
  +      }
  +      this.currentLineArea.changeFont(fontState);
  +      this.currentLineArea.changeColor(red, green, blue);
  +      this.currentLineArea.changeWrapOption(wrapOption);
  +      this.currentLineArea.changeWhiteSpaceCollapse(
  +						    whiteSpaceCollapse);
  +      this.currentLineArea.changeHyphenation(language, country, hyphenate,
  +					     hyphenationChar, hyphenationPushCharacterCount,
  +					     hyphenationRemainCharacterCount);
  +      if (ls != null) {
  +	ls.setYOffset(currentHeight);
  +      }
   
  -						ts = this.currentLineArea.addText(ca, ts, te, ls, ul);
  -				}
  -				return -1;
  -		}
  +      ts = this.currentLineArea.addText(ca, ts, te, ls, textState);
  +    }
  +    return -1;
  +  }
   
   
  -		/**
  +  /**
   			* adds a leader to current line area of containing block area
   			* the actual leader area is created in the line area
   			*
   			* @return int +1 for success and -1 for none
   			*/
  -		public int addLeader(FontState fontState, float red, float green,
  -												 float blue, int leaderPattern, int leaderLengthMinimum,
  -												 int leaderLengthOptimum, int leaderLengthMaximum,
  -												 int ruleThickness, int ruleStyle, int leaderPatternWidth,
  -												 int leaderAlignment) {
  +  public int addLeader(FontState fontState, float red, float green,
  +		       float blue, int leaderPattern, int leaderLengthMinimum,
  +		       int leaderLengthOptimum, int leaderLengthMaximum,
  +		       int ruleThickness, int ruleStyle, int leaderPatternWidth,
  +		       int leaderAlignment) {
   
   				//this should start a new page
  -				if (currentHeight + currentLineArea.getHeight() > maxHeight) {
  -						return -1;
  -				}
  +    if (currentHeight + currentLineArea.getHeight() > maxHeight) {
  +      return -1;
  +    }
   
  -				this.currentLineArea.changeFont(fontState);
  -				this.currentLineArea.changeColor(red, green, blue);
  +    this.currentLineArea.changeFont(fontState);
  +    this.currentLineArea.changeColor(red, green, blue);
   
   				//check whether leader fits into the (rest of the) line
   				//using length.optimum to determine where to break the line as defined
  @@ -393,6 +393,7 @@
   				return endIndent;
   		}
   
  +// KL: I think we should just return startIndent here!
   		public int getStartIndent() {
   				return startIndent + paddingLeft + borderWidthLeft;
   		}
  
  
  
  1.31      +48 -6     xml-fop/src/org/apache/fop/layout/LineArea.java
  
  Index: LineArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/LineArea.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- LineArea.java	2001/01/30 04:50:23	1.30
  +++ LineArea.java	2001/02/01 21:38:05	1.31
  @@ -1,4 +1,4 @@
  -/*-- $Id: LineArea.java,v 1.30 2001/01/30 04:50:23 keiron Exp $ --
  +/*-- $Id: LineArea.java,v 1.31 2001/02/01 21:38:05 klease Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -136,6 +136,11 @@
       /* the width of the pendingAreas */
       protected int pendingWidth = 0;
   
  +    /* text-decoration of the previous text */
  +    protected boolean prevUlState = false;
  +    protected boolean prevOlState = false;
  +    protected boolean prevLTState = false;
  +
       public LineArea(FontState fontState, int lineHeight,
                       int halfLeading, int allocationWidth, int startIndent,
                       int endIndent, LineArea prevLineArea) {
  @@ -199,7 +204,7 @@
          * @return int character position
          */
       public int addText(char odata[], int start, int end, LinkSet ls,
  -                       boolean ul) {
  +                       TextState textState) {
           // this prevents an array index out of bounds
           // which occurs when some text is laid out again.
           if(start == -1) return -1;
  @@ -259,7 +264,17 @@
                       // was some)
   
                       if (spaceWidth > 0) {
  -                        addChild(new InlineSpace(spaceWidth));
  +                        InlineSpace is = new InlineSpace(spaceWidth);
  +                        if (prevUlState) {
  +                            is.setUnderlined(textState.getUnderlined());
  +                        }
  +                        if (prevOlState) {
  +                            is.setOverlined(textState.getOverlined());
  +                        }
  +                        if (prevLTState) {
  +                            is.setLineThrough(textState.getLineThrough());
  +                        }
  +                        addChild(is);
                           finalWidth += spaceWidth;
                           spaceWidth = 0;
                       }
  @@ -295,7 +310,13 @@
                                                          new String(data, wordStart,
                                                                     wordLength), wordWidth);
                           ia.setYOffset(placementOffset);
  -                        ia.setUnderlined(ul);
  +                        ia.setUnderlined(textState.getUnderlined());
  +                        prevUlState = textState.getUnderlined();
  +                        ia.setOverlined(textState.getOverlined());
  +                        prevOlState = textState.getOverlined();
  +                        ia.setLineThrough(textState.getLineThrough());
  +                        prevLTState = textState.getLineThrough();
  +
                           addChild(ia);
                           if (ls != null) {
                               Rectangle lr = new Rectangle(finalWidth, 0,
  @@ -407,14 +428,35 @@
               }
           } // end of iteration over text
   
  -        if (prev == TEXT) {
  +        if (prev == TEXT) { 
  +
  +            if (spaceWidth > 0) {
  +                InlineSpace pis = new InlineSpace(spaceWidth);
  +                if (prevUlState) {
  +                    pis.setUnderlined(textState.getUnderlined());
  +                }
  +                if (prevOlState) {
  +                    pis.setOverlined(textState.getOverlined());
  +                }
  +                if (prevLTState) {
  +                    pis.setLineThrough(textState.getLineThrough());
  +                }
  +                pendingAreas.addElement(pis);
  +                pendingWidth += spaceWidth;
  +                spaceWidth = 0;
  +            }
   
               WordArea pia = new WordArea(currentFontState, this.red,
                                               this.green, this.blue,
                                               new String(data, wordStart, wordLength), wordWidth);
   
               pia.setYOffset(placementOffset);
  -            pia.setUnderlined(ul);
  +            pia.setUnderlined(textState.getUnderlined());
  +            prevUlState = textState.getUnderlined();
  +            pia.setOverlined(textState.getOverlined());
  +            prevOlState = textState.getOverlined();
  +            pia.setLineThrough(textState.getLineThrough());
  +            prevLTState = textState.getLineThrough();
   
               if (ls != null) {
                   Rectangle lr = new Rectangle(finalWidth + spaceWidth +
  
  
  
  1.4       +17 -1     xml-fop/src/org/apache/fop/layout/inline/InlineArea.java
  
  Index: InlineArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/inline/InlineArea.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InlineArea.java	2001/01/30 04:50:25	1.3
  +++ InlineArea.java	2001/02/01 21:38:07	1.4
  @@ -1,4 +1,4 @@
  -/*-- $Id: InlineArea.java,v 1.3 2001/01/30 04:50:25 keiron Exp $ --
  +/*-- $Id: InlineArea.java,v 1.4 2001/02/01 21:38:07 klease Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -124,6 +124,22 @@
   
       public boolean getUnderlined() {
           return this.underlined;
  +    }
  +
  +    public void setOverlined(boolean ol) {
  +	    this.overlined = ol;
  +    }
  +
  +    public boolean getOverlined() {
  +	    return this.overlined;
  +    }
  +
  +    public void setLineThrough(boolean lt) {
  +	    this.lineThrough = lt;
  +    }
  +
  +    public boolean getLineThrough() {
  +	    return this.lineThrough;
       }
   
   }
  
  
  
  1.2       +34 -1     xml-fop/src/org/apache/fop/layout/inline/InlineSpace.java
  
  Index: InlineSpace.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/inline/InlineSpace.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InlineSpace.java	2001/01/24 00:35:39	1.1
  +++ InlineSpace.java	2001/02/01 21:38:08	1.2
  @@ -1,4 +1,4 @@
  -/*-- $Id: InlineSpace.java,v 1.1 2001/01/24 00:35:39 keiron Exp $ -- 
  +/*-- $Id: InlineSpace.java,v 1.2 2001/02/01 21:38:08 klease Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -56,6 +56,12 @@
   public class InlineSpace extends Space {
       private int size; // in millipoints
       private boolean resizeable = true; //to disallow size changes during justification of a line
  +
  +    // Textdecoration
  +    protected boolean underlined = false;
  +    protected boolean overlined = false;
  +    protected boolean lineThrough = false;
  +     
       
       public InlineSpace(int amount) {
   	this.size = amount;
  @@ -66,6 +72,33 @@
   	this.size = amount;
       }
   
  +    /**
  +     * @param ul true if text should be underlined
  +     */
  +    public void setUnderlined(boolean ul) {
  +        this.underlined = ul;
  +    }
  +
  +    public boolean getUnderlined() {
  +        return this.underlined;
  +    }
  +
  +    public void setOverlined(boolean ol) {
  +       this.overlined = ol;
  +    }
  +
  +    public boolean getOverlined() {
  +        return this.overlined;
  +    }
  +
  +    public void setLineThrough(boolean lt) {
  +        this.lineThrough = lt;
  +    }
  +
  +    public boolean getLineThrough() {
  +        return this.lineThrough;
  +     }
  + 
       public int getSize() {
   	return size;
       }
  
  
  
  1.48      +69 -3     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.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- PDFRenderer.java	2001/01/30 04:50:26	1.47
  +++ PDFRenderer.java	2001/02/01 21:38:11	1.48
  @@ -1,4 +1,4 @@
  -/*-- $Id: PDFRenderer.java,v 1.47 2001/01/30 04:50:26 keiron Exp $ --
  +/*-- $Id: PDFRenderer.java,v 1.48 2001/02/01 21:38:11 klease Exp $ --
   
    ============================================================================
   				   The Apache Software License, Version 1.1
  @@ -140,6 +140,20 @@
   
       /** the current colour for use in svg */
       private PDFColor currentColour = new PDFColor(0, 0, 0);
  + 
  +    // previous values used for text-decoration drawing
  +    int prevUnderlineXEndPos;
  +    int prevUnderlineYEndPos;
  +    int prevUnderlineSize;
  +    PDFColor prevUnderlineColor;
  +    int prevOverlineXEndPos;
  +    int prevOverlineYEndPos;
  +    int prevOverlineSize;
  +    PDFColor prevOverlineColor;
  +    int prevLineThroughXEndPos;
  +    int prevLineThroughYEndPos;
  +    int prevLineThroughSize;
  +    PDFColor prevLineThroughColor;
   
       /**
        * create the PDF renderer
  @@ -403,12 +417,16 @@
          * @param area the block area to render
          */
       public void renderBlockArea(BlockArea area) {
  +      // KLease: Temporary test to fix block positioning
  +      // Offset ypos by padding and border widths
  +      // this.currentYPosition -= (area.getPaddingTop() + area.borderWidthTop);
           doFrame(area);
           Enumeration e = area.getChildren().elements();
           while (e.hasMoreElements()) {
               Box b = (Box) e.nextElement();
               b.render(this);
           }
  +	//  this.currentYPosition -= (area.getPaddingBottom() + area.borderWidthBottom);
       }
   
       /**
  @@ -632,8 +650,34 @@
           pdf = pdf.append(") Tj\n");
   
           if (area.getUnderlined()) {
  -            addLine(rx, bl - size / 10, rx + area.getContentWidth(),
  -                    bl - size / 10, size / 14, theAreaColor);
  +            int yPos = bl - size/10;
  +            addLine(rx, yPos, rx + area.getContentWidth(),
  +                    yPos, size/14, theAreaColor);
  +            // save position for underlining a following InlineSpace
  +            prevUnderlineXEndPos = rx + area.getContentWidth();
  +            prevUnderlineYEndPos = yPos;
  +            prevUnderlineSize = size/14;
  +            prevUnderlineColor = theAreaColor;
  +        }
  +
  +        if (area.getOverlined()) {
  +            int yPos = bl + area.getFontState().getAscender() + size/10;
  +            addLine(rx, yPos, rx + area.getContentWidth(),
  +                    yPos, size/14, theAreaColor);
  +            prevOverlineXEndPos = rx + area.getContentWidth();
  +            prevOverlineYEndPos = yPos;
  +            prevOverlineSize = size/14;
  +            prevOverlineColor = theAreaColor;
  +        }
  +
  +        if (area.getLineThrough()) {
  +            int yPos = bl + area.getFontState().getAscender() * 3/8;
  +		    addLine(rx, yPos, rx + area.getContentWidth(),
  +		            yPos, size/14, theAreaColor);
  +            prevLineThroughXEndPos = rx + area.getContentWidth();
  +            prevLineThroughYEndPos = yPos;
  +            prevLineThroughSize = size/14;
  +            prevLineThroughColor = theAreaColor;
           }
   
           currentStream.add(pdf.toString());
  @@ -648,6 +692,28 @@
          */
       public void renderInlineSpace(InlineSpace space) {
           this.currentXPosition += space.getSize();
  +        if (space.getUnderlined()) {
  +            if (prevUnderlineColor != null) {
  +               addLine(prevUnderlineXEndPos, prevUnderlineYEndPos,
  +                       prevUnderlineXEndPos + space.getSize(),
  +                       prevUnderlineYEndPos, prevUnderlineSize, prevUnderlineColor);
  +            }
  +        }
  +        if (space.getOverlined()) {
  +            if (prevOverlineColor != null) {
  +                addLine(prevOverlineXEndPos, prevOverlineYEndPos,
  +                        prevOverlineXEndPos + space.getSize(),
  +                        prevOverlineYEndPos, prevOverlineSize, prevOverlineColor);
  +            }
  +        }
  +        if (space.getLineThrough()) {
  +            if (prevLineThroughColor != null) {
  +                addLine(prevLineThroughXEndPos, prevLineThroughYEndPos,
  +                        prevLineThroughXEndPos + space.getSize(),
  +                        prevLineThroughYEndPos, prevLineThroughSize, prevLineThroughColor);
  +            }
  +         }
  +
       }
   
       /**