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.fo2001/12/06 21:28:18 1.3.4.1
+++ docs/examples/fo/textdeko.fo2001/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-decorationunderline.
+This is simple test of the text-decoration 'underline'.
- The following text decorations are defined in the CR:
+ The following text decorations are defined in the REC:
@@ -244,6 +244,12 @@
space-after.optimum="10pt"
text-align="start">
What about underlining of whitespace only ?
+
+
+
+
+ A whole block should work now.
+ And again some more Text to get at least two lines.
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.java2001/08/01 22:12:52 1.12
+++ src/org/apache/fop/fo/FObjMixed.java2001/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 Sta