aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--STATUS7
-rw-r--r--src/codegen/properties.xml30
-rw-r--r--src/org/apache/fop/apps/Version.java2
-rw-r--r--src/org/apache/fop/fo/PropertyListBuilder.java4
-rw-r--r--src/org/apache/fop/fo/flow/Block.java14
-rw-r--r--src/org/apache/fop/layout/Area.java28
-rw-r--r--src/org/apache/fop/render/pdf/PDFRenderer.java6
7 files changed, 87 insertions, 4 deletions
diff --git a/STATUS b/STATUS
index 0e340f66e..633b04609 100644
--- a/STATUS
+++ b/STATUS
@@ -5,6 +5,7 @@ STATUS
Things to do:
Get images working
+[PARTIAL] Get padding working
[PARTIAL] Incorporate Arved Sandstrom's simple-link implementation
[PARTIAL] Implement basic keeps
[PARTIAL] Incorporate Eric Schaeffer's further table fixes
@@ -28,7 +29,11 @@ Todo's and problems with AWT Previewer:
- should "preview" be an option when calling FOP instead of having
it's own main method?
-Done:
+Done since 0.12.0 release:
+
+basic support for padding-{top,left,bottom,right} on blocks.
+
+Done for 0.12.0 release:
Make sure Makefiles work
Switch to using Status object as return from layout()
diff --git a/src/codegen/properties.xml b/src/codegen/properties.xml
index 647adf33b..df9e36c51 100644
--- a/src/codegen/properties.xml
+++ b/src/codegen/properties.xml
@@ -330,5 +330,33 @@
<datatype>ColorType</datatype>
<default>transparent</default>
</property>
+ <property>
+ <name>padding-top</name>
+ <class-name>PaddingTop</class-name>
+ <inherited>false</inherited>
+ <datatype>Length</datatype>
+ <default>0pt</default>
+ </property>
+ <property>
+ <name>padding-left</name>
+ <class-name>PaddingLeft</class-name>
+ <inherited>false</inherited>
+ <datatype>Length</datatype>
+ <default>0pt</default>
+ </property>
+ <property>
+ <name>padding-bottom</name>
+ <class-name>PaddingBottom</class-name>
+ <inherited>false</inherited>
+ <datatype>Length</datatype>
+ <default>0pt</default>
+ </property>
+ <property>
+ <name>padding-right</name>
+ <class-name>PaddingRight</class-name>
+ <inherited>false</inherited>
+ <datatype>Length</datatype>
+ <default>0pt</default>
+ </property>
</property-list>
-
+
diff --git a/src/org/apache/fop/apps/Version.java b/src/org/apache/fop/apps/Version.java
index ead62e372..92d444e41 100644
--- a/src/org/apache/fop/apps/Version.java
+++ b/src/org/apache/fop/apps/Version.java
@@ -62,6 +62,6 @@ public class Version {
* @return the version string
*/
public static String getVersion() {
- return "FOP 0.12.0";
+ return "FOP 0.12.1[dev]";
}
}
diff --git a/src/org/apache/fop/fo/PropertyListBuilder.java b/src/org/apache/fop/fo/PropertyListBuilder.java
index 1bd425ce7..bffb5d3e9 100644
--- a/src/org/apache/fop/fo/PropertyListBuilder.java
+++ b/src/org/apache/fop/fo/PropertyListBuilder.java
@@ -105,6 +105,10 @@ public class PropertyListBuilder {
propertyTable.put("column-width",ColumnWidth.maker());
propertyTable.put("keep-with-next",KeepWithNext.maker());
propertyTable.put("background-color",BackgroundColor.maker());
+ propertyTable.put("padding-top",PaddingTop.maker());
+ propertyTable.put("padding-bottom",PaddingBottom.maker());
+ propertyTable.put("padding-left",PaddingLeft.maker());
+ propertyTable.put("padding-right",PaddingRight.maker());
propertyTable.put("height",SVGLength.maker());
propertyTable.put("width",SVGLength.maker());
diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java
index 8742b8fcf..76599ca23 100644
--- a/src/org/apache/fop/fo/flow/Block.java
+++ b/src/org/apache/fop/fo/flow/Block.java
@@ -84,6 +84,10 @@ public class Block extends FObjMixed {
int textIndent;
int keepWithNext;
ColorType backgroundColor;
+ int paddingTop;
+ int paddingBottom;
+ int paddingLeft;
+ int paddingRight;
BlockArea blockArea;
@@ -137,6 +141,14 @@ public class Block extends FObjMixed {
this.properties.get("keep-with-next").getEnum();
this.backgroundColor =
this.properties.get("background-color").getColorType();
+ this.paddingTop =
+ this.properties.get("padding-top").getLength().mvalue();
+ this.paddingLeft =
+ this.properties.get("padding-left").getLength().mvalue();
+ this.paddingBottom =
+ this.properties.get("padding-bottom").getLength().mvalue();
+ this.paddingRight =
+ this.properties.get("padding-right").getLength().mvalue();
if (area instanceof BlockArea) {
area.end();
@@ -187,6 +199,8 @@ public class Block extends FObjMixed {
textIndent, align, alignLast, lineHeight);
blockArea.setPage(area.getPage());
blockArea.setBackgroundColor(backgroundColor);
+ blockArea.setPadding(paddingTop, paddingLeft, paddingBottom,
+ paddingRight);
blockArea.start();
int numChildren = this.children.size();
diff --git a/src/org/apache/fop/layout/Area.java b/src/org/apache/fop/layout/Area.java
index dff0fb5e7..e16d7df54 100644
--- a/src/org/apache/fop/layout/Area.java
+++ b/src/org/apache/fop/layout/Area.java
@@ -82,6 +82,11 @@ abstract public class Area extends Box {
protected ColorType backgroundColor;
+ protected int paddingTop;
+ protected int paddingLeft;
+ protected int paddingBottom;
+ protected int paddingRight;
+
public Area (FontState fontState) {
this.fontState = fontState;
}
@@ -146,6 +151,22 @@ abstract public class Area extends Box {
return this.backgroundColor;
}
+ public int getPaddingTop() {
+ return this.paddingTop;
+ }
+
+ public int getPaddingLeft() {
+ return this.paddingLeft;
+ }
+
+ public int getPaddingBottom() {
+ return this.paddingBottom;
+ }
+
+ public int getPaddingRight() {
+ return this.paddingRight;
+ }
+
public void increaseHeight(int amount) {
this.currentHeight += amount;
}
@@ -167,6 +188,13 @@ abstract public class Area extends Box {
this.backgroundColor = bgColor;
}
+ public void setPadding(int top, int left, int bottom, int right) {
+ this.paddingTop = top;
+ this.paddingLeft = left;
+ this.paddingBottom = bottom;
+ this.paddingRight = right;
+ }
+
public int spaceLeft() {
return maxHeight - currentHeight;
}
diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java
index 276233f36..03bf6d40e 100644
--- a/src/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/org/apache/fop/render/pdf/PDFRenderer.java
@@ -237,10 +237,14 @@ public class PDFRenderer implements Renderer {
int w = area.getContentWidth();
int h = area.getHeight();
ColorType bg = area.getBackgroundColor();
+ int pt = area.getPaddingTop();
+ int pl = area.getPaddingLeft();
+ int pb = area.getPaddingBottom();
+ int pr = area.getPaddingRight();
// I'm not sure I should have to check for bg being null
// but I do
if ((bg != null) && (bg.alpha() == 0)) {
- this.addRect(rx, ry, w, -h,
+ this.addRect(rx - pl, ry + pt, w + pl + pr , - (h + pt + pb),
bg.red(), bg.green(), bg.blue(),
bg.red(), bg.green(), bg.blue());
}