Ok, this should be my last patch for this maintenance release ;-)
It adds inheritance for the text-decoration property from parent inline or block elements and fixes a bug with non-breaking spaces (but not all) Christian
Index: docs/examples/fo/textdeko.fo =================================================================== RCS file: /home/cvspublic/xml-fop/docs/examples/fo/textdeko.fo,v retrieving revision 1.3.4.2 diff -u -r1.3.4.2 textdeko.fo --- docs/examples/fo/textdeko.fo 13 Dec 2001 09:25:21 -0000 1.3.4.2 +++ docs/examples/fo/textdeko.fo 9 Jan 2002 08:47:29 -0000 @@ -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">_        +               + +             </fo:inline> + </fo:block> </fo:flow> </fo:page-sequence> 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.2.1 diff -u -r1.12.2.1 FObjMixed.java --- src/org/apache/fop/fo/FObjMixed.java 13 Dec 2001 09:25:21 -0000 1.12.2.1 +++ src/org/apache/fop/fo/FObjMixed.java 9 Jan 2002 08:47:44 -0000 @@ -36,6 +36,10 @@ super(parent, propertyList); } + public TextState getTextState() { + return ts; + } + protected void addCharacters(char data[], int start, int length) { // addChild(new FOText(data, start, length, this)); FOText ft = new FOText(data, start, length, this); 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.2.1 diff -u -r1.7.2.1 PropertyManager.java --- src/org/apache/fop/fo/PropertyManager.java 13 Dec 2001 09:25:22 -0000 1.7.2.1 +++ src/org/apache/fop/fo/PropertyManager.java 9 Jan 2002 08:47:46 -0000 @@ -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); } 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.2 diff -u -r1.41.2.2 Block.java --- src/org/apache/fop/fo/flow/Block.java 13 Dec 2001 09:25:22 -0000 1.41.2.2 +++ src/org/apache/fop/fo/flow/Block.java 9 Jan 2002 08:47:48 -0000 @@ -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 { 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.2.1 diff -u -r1.8.2.1 Inline.java --- src/org/apache/fop/fo/flow/Inline.java 13 Dec 2001 09:25:22 -0000 1.8.2.1 +++ src/org/apache/fop/fo/flow/Inline.java 9 Jan 2002 08:47:48 -0000 @@ -74,7 +74,7 @@ // this.properties.get("z-index"); // Text Decoration Properties - ts = propMgr.getTextDecoration(); + ts = propMgr.getTextDecoration(parent); } Index: src/org/apache/fop/render/PrintRenderer.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/PrintRenderer.java,v retrieving revision 1.14 diff -u -r1.14 PrintRenderer.java --- src/org/apache/fop/render/PrintRenderer.java 18 Sep 2001 13:06:07 -0000 1.14 +++ src/org/apache/fop/render/PrintRenderer.java 9 Jan 2002 08:48:02 -0000 @@ -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: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]