Browse Source

Clearer method names given for finding border and padding for regions.

See: http://marc.theaimsgroup.com/?l=fop-dev&m=106777246222766&w=2
and http://www.w3.org/TR/2001/REC-xsl-20011015/slice4.html#area-stackblock


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196979 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Glen Mazza 20 years ago
parent
commit
cfda23fd7b

+ 12
- 16
src/java/org/apache/fop/area/RegionViewport.java View File

@@ -112,12 +112,11 @@ public class RegionViewport extends Area implements Cloneable {
}

/**
* Return the margin-before offset for printing text
* (sum of region border and padding)
* Return the sum of region border- and padding-before
*
* @return margin-before offset, in millipoints
* @return width in millipoints
*/
public int getMarginBeforeWidth() {
public int getBorderAndPaddingWidthBefore() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_BEFORE);
if (bps != null) {
@@ -133,12 +132,11 @@ public class RegionViewport extends Area implements Cloneable {
}
/**
* Return the margin-after offset for printing text
* (sum of region border and padding)
* Return the sum of region border- and padding-after
*
* @return margin-after offset, in millipoints
* @return width in millipoints
*/
public int getMarginAfterWidth() {
public int getBorderAndPaddingWidthAfter() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_AFTER);
@@ -155,12 +153,11 @@ public class RegionViewport extends Area implements Cloneable {
}

/**
* Return the margin-start offset for printing text
* (sum of region border and padding)
* Return the sum of region border- and padding-start
*
* @return margin-start offset, in millipoints
* @return width in millipoints
*/
public int getMarginStartWidth() {
public int getBorderAndPaddingWidthStart() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_START);
if (bps != null) {
@@ -176,12 +173,11 @@ public class RegionViewport extends Area implements Cloneable {
}

/**
* Return the margin-end offset for printing text
* (sum of region border and padding)
* Return the sum of region border- and padding-end
*
* @return margin-end offset, in millipoints
* @return width in millipoints
*/
public int getMarginEndWidth() {
public int getBorderAndPaddingWidthEnd() {
int margin = 0;
BorderProps bps = (BorderProps) getTrait(Trait.BORDER_END);
if (bps != null) {

+ 3
- 2
src/java/org/apache/fop/layoutmgr/PageLayoutManager.java View File

@@ -475,7 +475,8 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
Region.BODY_CODE);
curBody = (BodyRegion) rv.getRegion();
flowBPD = (int) rv.getViewArea().getHeight() -
rv.getMarginBeforeWidth() - rv.getMarginAfterWidth();
rv.getBorderAndPaddingWidthBefore() - rv.getBorderAndPaddingWidthAfter();

return curPage;
}

@@ -714,7 +715,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
RegionViewport rv = curPage.getPage().getRegionViewport(Region.BODY_CODE);
int ipdWidth = (int) rv.getViewArea().getWidth() -
rv.getMarginStartWidth() - rv.getMarginEndWidth();
rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();

curSpan.setIPD(ipdWidth);
//curSpan.setPosition(BPD, newpos);

+ 4
- 7
src/java/org/apache/fop/render/pdf/PDFRenderer.java View File

@@ -530,15 +530,12 @@ public class PDFRenderer extends PrintRenderer {
Rectangle2D viewArea = region.getViewArea();
float width = (float)(viewArea.getWidth() / 1000f);
float height = (float)(viewArea.getHeight() / 1000f);
/*
Trait.Background back;
back = (Trait.Background)region.getTrait(Trait.BACKGROUND);
*/

if (region.getRegion().getRegionClass() == org.apache.fop.fo.pagination.Region.BODY_CODE)
if (region.getRegion().getRegionClass()
== org.apache.fop.fo.pagination.Region.BODY_CODE)
{
BPMarginOffset = region.getMarginBeforeWidth();
IPMarginOffset = region.getMarginStartWidth();
BPMarginOffset = region.getBorderAndPaddingWidthBefore();
IPMarginOffset = region.getBorderAndPaddingWidthStart();
}

drawBackAndBorders(region, startx, starty, width, height);

Loading…
Cancel
Save