Hi, this patch adds text-decoration support for blocks. There still some things I want to do (like inherit text-decoration from a parent inline, problems with hyphenation and  ).
Christian
Index: docs/examples/fo/textdeko.fo =================================================================== RCS file: /home/cvspublic/xml-fop/docs/examples/fo/textdeko.fo,v retrieving revision 1.3.4.1 diff -u -u -r1.3.4.1 textdeko.fo --- docs/examples/fo/textdeko.fo 2001/12/06 21:28:18 1.3.4.1 +++ docs/examples/fo/textdeko.fo 2001/12/11 19:36:36 @@ -77,7 +77,7 @@ line-height="15pt" space-after.optimum="10pt" text-align="start"> - This is simple test of the text-decoration<fo:inline text-decoration="underline">underline</fo:inline>. + This is simple test of the text-decoration <fo:inline +text-decoration="underline">'underline'</fo:inline>. </fo:block> <fo:block font-size="22pt" font-family="sans-serif" @@ -96,7 +96,7 @@ </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 CR: + The following text decorations are defined in the REC: </fo:block> <fo:list-block space-after.optimum="13pt"> @@ -244,6 +244,12 @@ space-after.optimum="10pt" text-align="start"> 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. </fo:block> Index: src/org/apache/fop/fo/FObjMixed.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/FObjMixed.java,v retrieving revision 1.12 diff -u -u -r1.12 FObjMixed.java --- src/org/apache/fop/fo/FObjMixed.java 2001/08/01 22:12:52 1.12 +++ src/org/apache/fop/fo/FObjMixed.java 2001/12/11 19:36:45 @@ -8,6 +8,7 @@ package org.apache.fop.fo; import org.apache.fop.layout.Area; +import org.apache.fop.layout.TextState; import org.apache.fop.apps.FOPException; /** @@ -16,6 +17,9 @@ */ public class FObjMixed extends FObj { + // Textdecoration + protected TextState ts; + public static class Maker extends FObj.Maker { public FObj make(FObj parent, PropertyList propertyList) throws FOPException { @@ -33,7 +37,14 @@ } protected void addCharacters(char data[], int start, int length) { - addChild(new FOText(data, start, length, this)); + // addChild(new FOText(data, start, length, this)); + FOText ft = new FOText(data, start, length, this); + ft.setLogger(log); + ft.setUnderlined(ts.getUnderlined()); + ft.setOverlined(ts.getOverlined()); + ft.setLineThrough(ts.getLineThrough()); + addChild(ft); + } public Status layout(Area area) throws FOPException { Index: src/org/apache/fop/fo/PropertyManager.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/PropertyManager.java,v retrieving revision 1.7 diff -u -u -r1.7 PropertyManager.java --- src/org/apache/fop/fo/PropertyManager.java 2001/08/06 09:12:58 1.7 +++ src/org/apache/fop/fo/PropertyManager.java 2001/12/11 19:36:47 @@ -26,6 +26,8 @@ import java.text.FieldPosition; import org.apache.fop.layout.Area; import org.apache.fop.layout.ColumnArea; +import org.apache.fop.layout.TextState; +import org.apache.fop.fo.properties.TextDecoration; public class PropertyManager { @@ -247,4 +249,29 @@ AbsolutePositionProps props = new AbsolutePositionProps(); return props; } + + public TextState getTextDecoration() throws FOPException { + TextState ts = new TextState(); + + int textDecoration = this.properties.get("text-decoration").getEnum(); + + switch (textDecoration) { + case TextDecoration.UNDERLINE: + ts.setUnderlined(true); + break; + case TextDecoration.OVERLINE: + ts.setOverlined(true); + break; + case TextDecoration.LINE_THROUGH: + ts.setLineThrough(true); + break; + case TextDecoration.NONE: + ts.setUnderlined(false); + ts.setOverlined(false); + ts.setLineThrough(false); + } + + return ts; + } + } Index: src/org/apache/fop/fo/flow/Block.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.41.2.1 diff -u -u -r1.41.2.1 Block.java --- src/org/apache/fop/fo/flow/Block.java 2001/12/06 21:28:21 1.41.2.1 +++ src/org/apache/fop/fo/flow/Block.java 2001/12/11 19:36:49 @@ -66,10 +66,13 @@ // this may be helpful on other FOs too boolean anythingLaidOut = false; - public Block(FObj parent, PropertyList propertyList) { + public Block(FObj parent, PropertyList propertyList) + throws FOPException { + super(parent, propertyList); this.name = "fo:block"; this.span = this.properties.get("span").getEnum(); + ts = propMgr.getTextDecoration(); } public Status layout(Area area) throws FOPException { Index: src/org/apache/fop/fo/flow/Inline.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/flow/Inline.java,v retrieving revision 1.8 diff -u -u -r1.8 Inline.java --- src/org/apache/fop/fo/flow/Inline.java 2001/09/16 13:42:49 1.8 +++ src/org/apache/fop/fo/flow/Inline.java 2001/12/11 19:36:50 @@ -30,12 +30,6 @@ return new Inline.Maker(); } - // Textdecoration - protected boolean underlined = false; - protected boolean overlined = false; - protected boolean lineThrough = false; - - public Inline(FObj parent, PropertyList propertyList) throws FOPException { super(parent, propertyList); @@ -79,27 +73,17 @@ // this.properties.get("visibility"); // this.properties.get("z-index"); - int textDecoration = this.properties.get("text-decoration").getEnum(); - - if (textDecoration == TextDecoration.UNDERLINE) { - this.underlined = true; - } + // Text Decoration Properties + ts = propMgr.getTextDecoration(); - if (textDecoration == TextDecoration.OVERLINE) { - this.overlined = true; - } - - if (textDecoration == TextDecoration.LINE_THROUGH) { - this.lineThrough = true; - } } protected void addCharacters(char data[], int start, int length) { FOText ft = new FOText(data, start, length, this); ft.setLogger(log); - ft.setUnderlined(underlined); - ft.setOverlined(overlined); - ft.setLineThrough(lineThrough); + ft.setUnderlined(ts.getUnderlined()); + ft.setOverlined(ts.getOverlined()); + ft.setLineThrough(ts.getLineThrough()); children.addElement(ft); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]