You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by sp...@apache.org on 2006/10/11 16:19:29 UTC
svn commit: r462812 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/area/inline/
src/java/org/apache/fop/layoutmgr/inline/ test/layoutengine/
test/layoutengine/standard-testcases/
Author: spepping
Date: Wed Oct 11 07:19:28 2006
New Revision: 462812
URL: http://svn.apache.org/viewvc?view=rev&rev=462812
Log:
FilledArea now properly applies the variation factor, when a page
number citation is resolved. It (and each InlineArea) may have an
adjustingInfo object for that purpose. Adapted leader_toc testcase to
the new, correct, results; removed page-number-citation_forward-ref
testcase because it duplicates the leader_toc testcase.
Removed:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_forward-ref.xml
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/AbstractTextArea.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/FilledArea.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/InlineArea.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/AbstractTextArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/AbstractTextArea.java?view=diff&rev=462812&r1=462811&r2=462812
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/AbstractTextArea.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/AbstractTextArea.java Wed Oct 11 07:19:28 2006
@@ -51,7 +51,7 @@
private int textWordSpaceAdjust = 0;
private int textLetterSpaceAdjust = 0;
- private TextAdjustingInfo adjustingInfo = null;
+ private TextAdjustingInfo textAdjustingInfo = null;
private int baselineOffset = 0;
/**
@@ -68,7 +68,7 @@
* @param adj the current adjustment of the area
*/
public AbstractTextArea(int stretch, int shrink, int adj) {
- adjustingInfo = new TextAdjustingInfo(stretch, shrink, adj);
+ textAdjustingInfo = new TextAdjustingInfo(stretch, shrink, adj);
}
/**
@@ -115,7 +115,7 @@
* @param spaceDiff the space difference
*/
public void setSpaceDifference(int spaceDiff) {
- adjustingInfo.spaceDifference = spaceDiff;
+ textAdjustingInfo.spaceDifference = spaceDiff;
}
/**
@@ -127,7 +127,7 @@
*/
public boolean applyVariationFactor(double variationFactor,
int lineStretch, int lineShrink) {
- if (adjustingInfo != null) {
+ if (textAdjustingInfo != null) {
// compute the new adjustments:
// if the variation factor is negative, it means that before
// the ipd variation the line had to stretch and now it has
@@ -140,23 +140,23 @@
if (textWordSpaceAdjust < 0) {
// from a negative adjustment to a positive one
balancingFactor
- = ((double) adjustingInfo.availableStretch / adjustingInfo.availableShrink)
+ = ((double) textAdjustingInfo.availableStretch / textAdjustingInfo.availableShrink)
* ((double) lineShrink / lineStretch);
} else {
// from a positive adjustment to a negative one
balancingFactor
- = ((double) adjustingInfo.availableShrink / adjustingInfo.availableStretch)
+ = ((double) textAdjustingInfo.availableShrink / textAdjustingInfo.availableStretch)
* ((double) lineStretch / lineShrink);
}
}
- textWordSpaceAdjust = (int) ((textWordSpaceAdjust - adjustingInfo.spaceDifference)
+ textWordSpaceAdjust = (int) ((textWordSpaceAdjust - textAdjustingInfo.spaceDifference)
* variationFactor * balancingFactor)
- + adjustingInfo.spaceDifference;
+ + textAdjustingInfo.spaceDifference;
textLetterSpaceAdjust *= variationFactor;
// update the ipd of the area
- int oldAdjustment = adjustingInfo.adjustment;
- adjustingInfo.adjustment *= balancingFactor * variationFactor;
- ipd += adjustingInfo.adjustment - oldAdjustment;
+ int oldAdjustment = textAdjustingInfo.adjustment;
+ textAdjustingInfo.adjustment *= balancingFactor * variationFactor;
+ ipd += textAdjustingInfo.adjustment - oldAdjustment;
}
return false;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/FilledArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/FilledArea.java?view=diff&rev=462812&r1=462811&r2=462812
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/FilledArea.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/FilledArea.java Wed Oct 11 07:19:28 2006
@@ -35,7 +35,7 @@
*/
public class FilledArea extends InlineParent {
private int unitWidth;
-
+
/**
* Create a new filled area.
*/
@@ -114,6 +114,19 @@
newList.addAll(inlines);
}
return newList;
+ }
+
+ /**
+ * recursively apply the variation factor to all descendant areas
+ * @param variationFactor the variation factor that must be applied to adjustments
+ * @param lineStretch the total stretch of the line
+ * @param lineShrink the total shrink of the line
+ * @return true if there is an UnresolvedArea descendant
+ */
+ public boolean applyVariationFactor(double variationFactor,
+ int lineStretch, int lineShrink) {
+ setIPD(getIPD() + adjustingInfo.applyVariationFactor(variationFactor));
+ return false;
}
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/InlineArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/InlineArea.java?view=diff&rev=462812&r1=462811&r2=462812
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/InlineArea.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/inline/InlineArea.java Wed Oct 11 07:19:28 2006
@@ -55,6 +55,18 @@
availableShrink = shrink;
adjustment = adj;
}
+
+ /**
+ * Apply the variation factor
+ *
+ * @param variationFactor the factor by which the adjustment is to be changed
+ * @return the IPD increase
+ */
+ protected int applyVariationFactor(double variationFactor) {
+ int oldAdjustment = adjustment;
+ adjustment *= variationFactor;
+ return adjustment - oldAdjustment;
+ }
}
/**
@@ -77,6 +89,38 @@
private int storedIPDVariation = 0;
/**
+ * The adjustment information object
+ */
+ protected InlineAdjustingInfo adjustingInfo = null;
+
+ /**
+ * @return the adjustment information object
+ */
+ public InlineAdjustingInfo getAdjustingInfo() {
+ return adjustingInfo;
+ }
+
+ /**
+ * Create a new adjustment information object
+ * @param stretch the available space for stretching
+ * @param shrink the available space for shrinking
+ * @param adj space adjustment type
+ */
+ public void setAdjustingInfo(int stretch, int shrink, int adjustment) {
+ adjustingInfo = new InlineAdjustingInfo(stretch, shrink, adjustment);
+ }
+
+ /**
+ * Modify the adjustment value in the adjustment information object
+ * @param adjustment the new adjustment value
+ */
+ public void setAdjustment(int adjustment) {
+ if (adjustingInfo != null) {
+ adjustingInfo.adjustment = adjustment;
+ }
+ }
+
+ /**
* Increase the inline progression dimensions of this area.
* This is used for inline parent areas that contain mulitple child areas.
*
@@ -165,7 +209,10 @@
*/
public boolean applyVariationFactor(double variationFactor,
int lineStretch, int lineShrink) {
- // default behaviour: simply return false
+ // default behaviour: update the IPD and return false
+ if (adjustingInfo != null) {
+ setIPD(getIPD() + adjustingInfo.applyVariationFactor(variationFactor));
+ }
return false;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?view=diff&rev=462812&r1=462811&r2=462812
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java Wed Oct 11 07:19:28 2006
@@ -253,6 +253,7 @@
// create the AreaInfo object to store the computed values
areaInfo = new AreaInfo((short) 0, ipd, false, context.getAlignmentContext());
+ curArea.setAdjustingInfo(ipd.max - ipd.opt, ipd.opt - ipd.min, 0);
addKnuthElementsForBorderPaddingStart(seq);
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java?view=diff&rev=462812&r1=462811&r2=462812
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java Wed Oct 11 07:19:28 2006
@@ -255,6 +255,7 @@
- areaInfo.ipdArea.opt));
}
area.setIPD(width);
+ area.setAdjustment(width - areaInfo.ipdArea.opt);
}
/** @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int) */
Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml?view=diff&rev=462812&r1=462811&r2=462812
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Wed Oct 11 07:19:28 2006
@@ -219,11 +219,6 @@
placed correctly.</description>
</testcase>
<testcase>
- <name>page-number-citation: Forward references not adjusted properly</name>
- <file>page-number-citation_forward-ref.xml</file>
- <description>Forward references are not properly adjusted when they are resolved.</description>
- </testcase>
- <testcase>
<name>page-number-citation-last: FOs spanning multiple pages are not properly handled.</name>
<file>page-number-citation-last_basic.xml</file>
<description>Resolution of forward references does not wait until an FO is fully finished when an FO spans multiple pages.</description>
Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml?view=diff&rev=462812&r1=462811&r2=462812
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_toc.xml Wed Oct 11 07:19:28 2006
@@ -30,7 +30,8 @@
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
- <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:page-sequence master-reference="normal" white-space-collapse="true"
+ initial-page-number="9">
<fo:flow flow-name="xsl-region-body">
<fo:block text-align-last="justify">
<fo:basic-link internal-destination="N4">1. Chapter</fo:basic-link>
@@ -99,7 +100,7 @@
<fo:block>Text
</fo:block>
- <fo:block id="N28">2. Chapter
+ <fo:block id="N28" break-before="page">2. Chapter
</fo:block>
<fo:block>Text
@@ -123,32 +124,32 @@
<checks>
<eval expected="11100" xpath="//flow/block[1]/lineArea/@bpd"/>
<eval expected="360000" xpath="//flow/block[1]/lineArea/@ipd"/>
- <eval expected="263812" xpath="//flow/block[1]/lineArea/inlineparent[2]/@ipd"/>
+ <eval expected="286768" xpath="//flow/block[1]/lineArea/inlineparent[2]/@ipd"/>
<eval expected="5280" xpath="//flow/block[1]/lineArea/inlineparent[2]/@offset"/>
<eval expected="11100" xpath="//flow/block[2]/lineArea/@bpd"/>
<eval expected="331654" xpath="//flow/block[2]/lineArea/@ipd"/>
- <eval expected="231669" xpath="//flow/block[2]/lineArea/inlineparent[2]/@ipd"/>
+ <eval expected="254591" xpath="//flow/block[2]/lineArea/inlineparent[2]/@ipd"/>
<eval expected="5280" xpath="//flow/block[2]/lineArea/inlineparent[2]/@offset"/>
<eval expected="11100" xpath="//flow/block[3]/lineArea/@bpd"/>
<eval expected="331654" xpath="//flow/block[3]/lineArea/@ipd"/>
- <eval expected="231669" xpath="//flow/block[3]/lineArea/inlineparent[2]/@ipd"/>
+ <eval expected="254591" xpath="//flow/block[3]/lineArea/inlineparent[2]/@ipd"/>
<eval expected="5280" xpath="//flow/block[3]/lineArea/inlineparent[2]/@offset"/>
<eval expected="11100" xpath="//flow/block[4]/lineArea/@bpd"/>
<eval expected="360000" xpath="//flow/block[4]/lineArea/@ipd"/>
- <eval expected="263812" xpath="//flow/block[4]/lineArea/inlineparent[2]/@ipd"/>
+ <eval expected="280199" xpath="//flow/block[4]/lineArea/inlineparent[2]/@ipd"/>
<eval expected="5280" xpath="//flow/block[4]/lineArea/inlineparent[2]/@offset"/>
<eval expected="11100" xpath="//flow/block[5]/lineArea/@bpd"/>
<eval expected="331654" xpath="//flow/block[5]/lineArea/@ipd"/>
- <eval expected="231669" xpath="//flow/block[5]/lineArea/inlineparent[2]/@ipd"/>
+ <eval expected="248032" xpath="//flow/block[5]/lineArea/inlineparent[2]/@ipd"/>
<eval expected="5280" xpath="//flow/block[5]/lineArea/inlineparent[2]/@offset"/>
<eval expected="11100" xpath="//flow/block[6]/lineArea/@bpd"/>
<eval expected="331654" xpath="//flow/block[6]/lineArea/@ipd"/>
- <eval expected="231669" xpath="//flow/block[6]/lineArea/inlineparent[2]/@ipd"/>
+ <eval expected="248032" xpath="//flow/block[6]/lineArea/inlineparent[2]/@ipd"/>
<eval expected="5280" xpath="//flow/block[6]/lineArea/inlineparent[2]/@offset"/>
</checks>
</testcase>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org