xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vhenneb...@apache.org
Subject svn commit: r1343310 [3/4] - in /xmlgraphics/fop/branches/Temp_TrueTypeInPostScript: ./ conf/ examples/embedding/ examples/embedding/java/embedding/ lib/ src/documentation/content/xdocs/ src/documentation/content/xdocs/trunk/ src/documentation/intermed...
Date Mon, 28 May 2012 16:16:28 GMT
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Mon May 28 16:16:23 2012
@@ -44,8 +44,8 @@ import org.apache.fop.traits.SpaceVal;
 /**
  * LayoutManager for a block-container FO.
  */
-public class BlockContainerLayoutManager extends BlockStackingLayoutManager
-                implements ConditionalElementListener {
+public class BlockContainerLayoutManager extends BlockStackingLayoutManager implements
+        ConditionalElementListener, BreakOpportunity {
 
     /**
      * logging instance
@@ -86,6 +86,7 @@ public class BlockContainerLayoutManager
     private MinOptMax effSpaceBefore;
     private MinOptMax effSpaceAfter;
 
+    private int horizontalOverflow;
     private double contentRectOffsetX = 0;
     private double contentRectOffsetY = 0;
 
@@ -401,7 +402,7 @@ public class BlockContainerLayoutManager
             BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
                     getBlockContainerFO().getUserAgent().getEventBroadcaster());
             boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
-            eventProducer.viewportOverflow(this, getBlockContainerFO().getName(),
+            eventProducer.viewportBPDOverflow(this, getBlockContainerFO().getName(),
                     breaker.getOverflowAmount(), needClip(), canRecover,
                     getBlockContainerFO().getLocator());
         }
@@ -553,10 +554,18 @@ public class BlockContainerLayoutManager
                 BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
                         getBlockContainerFO().getUserAgent().getEventBroadcaster());
                 boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
-                eventProducer.viewportOverflow(this, getBlockContainerFO().getName(),
+                eventProducer.viewportBPDOverflow(this, getBlockContainerFO().getName(),
                         breaker.getOverflowAmount(), needClip(), canRecover,
                         getBlockContainerFO().getLocator());
             }
+            // this handles the IPD (horizontal) overflow
+            if (this.horizontalOverflow > 0) {
+                BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider
+                        .get(getBlockContainerFO().getUserAgent().getEventBroadcaster());
+                boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW);
+                eventProducer.viewportIPDOverflow(this, getBlockContainerFO().getName(),
+                        this.horizontalOverflow, needClip(), canRecover, getBlockContainerFO().getLocator());
+            }
         }
 
         setFinished(true);
@@ -1027,6 +1036,18 @@ public class BlockContainerLayoutManager
         }
     }
 
+    /** {@inheritDoc} */
+    public boolean handleOverflow(int milliPoints) {
+        if (milliPoints > this.horizontalOverflow) {
+            this.horizontalOverflow = milliPoints;
+        }
+        return true;
+    }
+
+    public int getBreakBefore() {
+        return BreakOpportunityHelper.getBreakBefore(this);
+    }
+
 }
 
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Mon May 28 16:16:23 2012
@@ -43,8 +43,8 @@ import org.apache.fop.traits.SpaceVal;
 /**
  * LayoutManager for a block FO.
  */
-public class BlockLayoutManager extends BlockStackingLayoutManager
-            implements ConditionalElementListener {
+public class BlockLayoutManager extends BlockStackingLayoutManager implements ConditionalElementListener,
+        BreakOpportunity {
 
     /** logging instance */
     private static Log log = LogFactory.getLog(BlockLayoutManager.class);
@@ -504,4 +504,8 @@ public class BlockLayoutManager extends 
         return true;
     }
 
+    public int getBreakBefore() {
+        return BreakOpportunityHelper.getBreakBefore(this);
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java Mon May 28 16:16:23 2012
@@ -89,19 +89,30 @@ public interface BlockLevelEventProducer
     void overconstrainedAdjustEndIndent(Object source, String elementName, int amount, Locator loc);
 
     /**
-     * Contents overflow a viewport.
+     * Contents IPD overflow a viewport.
      * @param source the event source
      * @param elementName the formatting object
      * @param amount the amount by which the contents overflow (in mpt)
      * @param clip true if the content will be clipped
      * @param canRecover indicates whether FOP can recover from this problem and continue working
      * @param loc the location of the error or null
-     * @throws LayoutException the layout error provoked by the method call
-     * @event.severity FATAL
+     * @event.severity ERROR
      */
-    void viewportOverflow(Object source, String elementName,
-            int amount, boolean clip, boolean canRecover,
-            Locator loc) throws LayoutException;
+    void viewportIPDOverflow(Object source, String elementName, int amount, boolean clip,
+            boolean canRecover, Locator loc);
+
+    /**
+     * Contents BPD overflow a viewport.
+     * @param source the event source
+     * @param elementName the formatting object
+     * @param amount the amount by which the contents overflow (in mpt)
+     * @param clip true if the content will be clipped
+     * @param canRecover indicates whether FOP can recover from this problem and continue working
+     * @param loc the location of the error or null
+     * @event.severity ERROR
+     */
+    void viewportBPDOverflow(Object source, String elementName, int amount, boolean clip,
+            boolean canRecover, Locator loc);
 
     /**
      * Contents overflow a region viewport.

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml Mon May 28 16:16:23 2012
@@ -22,7 +22,8 @@
   <message key="tableFixedAutoWidthNotSupported">table-layout="fixed" and width="auto", but auto-layout not supported =&gt; assuming width="100%".{{locator}}</message>
   <message key="objectTooWide">The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt &gt; {maxIPD}mpt).{{locator}}</message>
   <message key="overconstrainedAdjustEndIndent">An {elementName} {{locator}} is wider than the available room in inline-progression-dimension. Adjusting end-indent based on overconstrained geometry rules (XSL 1.1, ch. 5.3.4)</message>
-  <message key="viewportOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
+  <message key="viewportIPDOverflow">Content overflows the viewport of an {elementName} in inline-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
+  <message key="viewportBPDOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
   <message key="regionOverflow">Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message>
   <message key="flowNotMappingToRegionBody">Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}}</message>
   <message key="pageSequenceMasterExhausted">Subsequences exhausted in page-sequence-master "{pageSequenceMasterName}", {canRecover,if,using previous subsequence,cannot recover}.{{locator}}</message>

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Mon May 28 16:16:23 2012
@@ -38,7 +38,6 @@ import org.apache.fop.fo.properties.Keep
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
 import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.util.BreakUtil;
 import org.apache.fop.util.ListUtil;
 
 /**
@@ -1036,7 +1035,7 @@ public abstract class BlockStackingLayou
      * @return true if an element has been added due to a break-before.
      */
     protected boolean addKnuthElementsForBreakBefore(List returnList, LayoutContext context) {
-        int breakBefore = getBreakBefore();
+        int breakBefore = BreakOpportunityHelper.getBreakBefore(this);
         if (breakBefore == EN_PAGE
                 || breakBefore == EN_COLUMN
                 || breakBefore == EN_EVEN_PAGE
@@ -1051,27 +1050,6 @@ public abstract class BlockStackingLayou
     }
 
     /**
-     * Returns the break-before value of the current formatting object.
-     * @return the break-before value (Constants.EN_*)
-     */
-    private int getBreakBefore() {
-        int breakBefore = EN_AUTO;
-        if (fobj instanceof BreakPropertySet) {
-            breakBefore = ((BreakPropertySet)fobj).getBreakBefore();
-        }
-        if (true /* uncomment to only partially merge: && breakBefore != EN_AUTO*/) {
-            LayoutManager lm = getChildLM();
-            //It is assumed this is only called when the first LM is active.
-            if (lm instanceof BlockStackingLayoutManager) {
-                BlockStackingLayoutManager bslm = (BlockStackingLayoutManager)lm;
-                breakBefore = BreakUtil.compareBreakClasses(
-                        breakBefore, bslm.getBreakBefore());
-            }
-        }
-        return breakBefore;
-    }
-
-    /**
      * Creates Knuth elements for break-after and adds them to the return list.
      * @param returnList return list to add the additional elements to
      * @param context the layout context
@@ -1249,5 +1227,16 @@ public abstract class BlockStackingLayou
         // TODO startIndent, endIndent
     }
 
+    /**
+     * Whether this LM can handle horizontal overflow error messages (only a BlockContainerLayoutManager can).
+     * @param milliPoints horizontal overflow
+     * @return true if handled by a BlockContainerLayoutManager
+     */
+    public boolean handleOverflow(int milliPoints) {
+        if (getParent() instanceof BlockStackingLayoutManager) {
+            return ((BlockStackingLayoutManager) getParent()).handleOverflow(milliPoints);
+        }
+        return false;
+    }
 }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java Mon May 28 16:16:23 2012
@@ -228,6 +228,9 @@ public class ImageLayout implements Cons
             } else if (rat1 > rat2) {
                 adjusted.width = (int)(rat2 * size.width);
                 adjusted.height = effHeight;
+            } else {
+                adjusted.width = effWidth;
+                adjusted.height = effHeight;
             }
         } else {
             adjusted.width = effWidth;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Mon May 28 16:16:23 2012
@@ -388,6 +388,13 @@ public class InlineLayoutManager extends
             }
             lastSequence = ListUtil.getLast(returnList);
             lastChildLM = curLM;
+            // the context used to create this childLC above was applied a LayoutContext.SUPPRESS_BREAK_BEFORE
+            // in the getNextChildElements() method of the parent BlockLayoutManger; as a consequence all
+            // line breaks in blocks nested inside the inline associated with this ILM are being supressed;
+            // here we revert that supression; we do not need to do that for the first element since that
+            // is handled by the getBreakBefore() method of the wrapping BlockStackingLayoutManager.
+            // Note: this fix seems to work but is far from being the ideal way to do this
+            childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE, false);
         }
 
         if (lastSequence != null) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java Mon May 28 16:16:23 2012
@@ -28,6 +28,8 @@ import org.apache.fop.area.inline.Space;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.layoutmgr.AbstractLayoutManager;
+import org.apache.fop.layoutmgr.BreakOpportunity;
+import org.apache.fop.layoutmgr.BreakOpportunityHelper;
 import org.apache.fop.layoutmgr.KnuthElement;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.NonLeafPosition;
@@ -39,8 +41,8 @@ import org.apache.fop.traits.MinOptMax;
  * which stack children in the inline direction, such as Inline or
  * Line. It should not be instantiated directly.
  */
-public abstract class InlineStackingLayoutManager extends AbstractLayoutManager
-                                         implements InlineLevelLayoutManager {
+public abstract class InlineStackingLayoutManager extends AbstractLayoutManager implements
+        InlineLevelLayoutManager, BreakOpportunity {
 
     /**
      * Size of border and padding in BPD (ie, before and after).
@@ -385,4 +387,9 @@ public abstract class InlineStackingLayo
 
         return returnList;
     }
+
+    public int getBreakBefore() {
+        return BreakOpportunityHelper.getBreakBefore(this);
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Mon May 28 16:16:23 2012
@@ -45,6 +45,7 @@ import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.hyphenation.Hyphenation;
 import org.apache.fop.hyphenation.Hyphenator;
 import org.apache.fop.layoutmgr.Adjustment;
+import org.apache.fop.layoutmgr.BlockLayoutManager;
 import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.BreakElement;
 import org.apache.fop.layoutmgr.BreakingAlgorithm;
@@ -389,7 +390,10 @@ public class LineLayoutManager extends I
 
             if (log.isWarnEnabled()) {
                 int lack = difference + bestActiveNode.availableShrink;
-                if (lack < 0) {
+                // if this LLM is nested inside a BlockContainerLayoutManager that is constraining
+                // the available width and thus responsible for the overflow then we do not issue
+                // warning event here and instead let the BCLM handle that at a later stage
+                if (lack < 0 && !handleOverflow(-lack)) {
                     InlineLevelEventProducer eventProducer
                         = InlineLevelEventProducer.Provider.get(
                             getFObj().getUserAgent().getEventBroadcaster());
@@ -1635,4 +1639,15 @@ public class LineLayoutManager extends I
         return true;
     }
 
+    /**
+     * Whether this LM can handle horizontal overflow error messages (only a BlockContainerLayoutManager can).
+     * @param milliPoints horizontal overflow
+     * @return true if handled by a BlockContainerLayoutManager
+     */
+    public boolean handleOverflow(int milliPoints) {
+        if (getParent() instanceof BlockLayoutManager) {
+            return ((BlockLayoutManager) getParent()).handleOverflow(milliPoints);
+        }
+        return false;
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java Mon May 28 16:16:23 2012
@@ -49,7 +49,7 @@ public abstract class CollapsingBorderMo
 
     //These statics are used singleton-style. No MT issues here.
     private static CollapsingBorderModel collapse = null;
-    private static CollapsingBorderModel collapseWithPrecedence = null;
+    // private static CollapsingBorderModel collapseWithPrecedence = null;
 
     /**
      * @param borderCollapse border collapse control
@@ -63,10 +63,7 @@ public abstract class CollapsingBorderMo
                 }
                 return collapse;
             case Constants.EN_COLLAPSE_WITH_PRECEDENCE:
-                if (collapseWithPrecedence == null) {
-                    //collapseWithPrecedence = new CollapsingBorderModelWithPrecedence();
-                }
-                return collapseWithPrecedence;
+                throw new UnsupportedOperationException ( "collapse-with-precedence not yet supported" );
             default:
                 throw new IllegalArgumentException("Illegal border-collapse mode.");
         }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java Mon May 28 16:16:23 2012
@@ -245,13 +245,14 @@ public class ColumnSetup {
      * the left-most column; otherwise, the first column is the left-most
      * column.
      * @param col column index (1 is first column)
+     * @param nrColSpan number columns spanned (for calculating offset in rtl mode)
      * @param context the context for percentage based calculations
      * @return the X offset of the requested column
      */
-    public int getXOffset(int col, PercentBaseContext context) {
+    public int getXOffset(int col, int nrColSpan, PercentBaseContext context) {
         // TODO handle vertical WMs [GA]
         if ( (wmTraits != null) && (wmTraits.getColumnProgressionDirection() == Direction.RL) ) {
-            return getXOffsetRTL(col, context);
+            return getXOffsetRTL(col, nrColSpan, context);
         } else {
             return getXOffsetLTR(col, context);
         }
@@ -262,9 +263,9 @@ public class ColumnSetup {
      * column; i.e., those columns whose column numbers are greater than the
      * specified column number.
      */
-    private int getXOffsetRTL(int col, PercentBaseContext context) {
+    private int getXOffsetRTL(int col, int nrColSpan, PercentBaseContext context) {
         int xoffset = 0;
-        for (int i = col, nc = colWidths.size(); ++i < nc;) {
+        for (int i = (col + nrColSpan - 1), nc = colWidths.size(); ++i < nc;) {
             int effCol = i;
             if (colWidths.get(effCol) != null) {
                 xoffset += ((Length) colWidths.get(effCol)).getValue(context);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/RowPainter.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/RowPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/RowPainter.java Mon May 28 16:16:23 2012
@@ -468,7 +468,7 @@ class RowPainter {
         block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
         block.setIPD(ipd);
         block.setBPD(bpd);
-        block.setXOffset(tclm.getXOffsetOfGridUnit(colIndex)
+        block.setXOffset(tclm.getXOffsetOfGridUnit(colIndex, 1)
                 + (borderStart.getRetainedWidth() / 2));
         block.setYOffset(getRowOffset(rowIndex)
                 - (borderBefore.getRetainedWidth() / 2));

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Mon May 28 16:16:23 2012
@@ -317,16 +317,17 @@ public class TableContentLayoutManager i
      * @return the requested X offset
      */
     protected int getXOffsetOfGridUnit(PrimaryGridUnit gu) {
-        return getXOffsetOfGridUnit(gu.getColIndex());
+        return getXOffsetOfGridUnit(gu.getColIndex(), gu.getCell().getNumberColumnsSpanned());
     }
 
     /**
      * Returns the X offset of the grid unit in the given column.
      * @param colIndex the column index (zero-based)
+     * @param nrColSpan number columns spanned
      * @return the requested X offset
      */
-    protected int getXOffsetOfGridUnit(int colIndex) {
-        return startXOffset + getTableLM().getColumns().getXOffset(colIndex + 1, getTableLM());
+    protected int getXOffsetOfGridUnit(int colIndex, int nrColSpan) {
+        return startXOffset + getTableLM().getColumns().getXOffset(colIndex + 1, nrColSpan, getTableLM());
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColorHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColorHandler.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColorHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColorHandler.java Mon May 28 16:16:23 2012
@@ -23,7 +23,6 @@ import java.awt.Color;
 import java.awt.color.ColorSpace;
 import java.awt.color.ICC_ColorSpace;
 import java.awt.color.ICC_Profile;
-import java.text.DecimalFormat;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -36,7 +35,7 @@ import org.apache.xmlgraphics.java2d.col
 import org.apache.xmlgraphics.java2d.color.NamedColorSpace;
 import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
 
-import org.apache.fop.util.DecimalFormatCache;
+import org.apache.xmlgraphics.util.DoubleFormatUtil;
 
 /**
  * This class handles the registration of color spaces and the generation of PDF code to select
@@ -225,9 +224,9 @@ public class PDFColorHandler {
         if (comps.length != componentCount) {
             throw new IllegalStateException("Color with unexpected component count encountered");
         }
-        DecimalFormat df = DecimalFormatCache.getDecimalFormat(4);
         for (int i = 0, c = comps.length; i < c; i++) {
-            codeBuffer.append(df.format(comps[i])).append(" ");
+            DoubleFormatUtil.formatDouble(comps[i], 4, 4, codeBuffer);
+            codeBuffer.append(" ");
         }
         codeBuffer.append(command).append("\n");
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFInfo.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFInfo.java Mon May 28 16:16:23 2012
@@ -21,12 +21,11 @@ package org.apache.fop.pdf;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
 import java.util.Date;
-import java.util.Locale;
 import java.util.TimeZone;
 
+import org.apache.xmlgraphics.util.DateFormatUtil;
+
 /**
  * class representing an /Info object
  */
@@ -236,57 +235,13 @@ public class PDFInfo extends PDFObject {
     }
 
     /**
-     * Returns a SimpleDateFormat instance for formatting PDF date-times.
-     * @return a new SimpleDateFormat instance
-     */
-    protected static SimpleDateFormat getPDFDateFormat() {
-        SimpleDateFormat df = new SimpleDateFormat("'D:'yyyyMMddHHmmss", Locale.ENGLISH);
-        df.setTimeZone(TimeZone.getTimeZone("GMT"));
-        return df;
-    }
-
-    /**
      * Formats a date/time according to the PDF specification (D:YYYYMMDDHHmmSSOHH'mm').
      * @param time date/time value to format
      * @param tz the time zone
      * @return the requested String representation
      */
-    protected static String formatDateTime(Date time, TimeZone tz) {
-        Calendar cal = Calendar.getInstance(tz, Locale.ENGLISH);
-        cal.setTime(time);
-
-        int offset = cal.get(Calendar.ZONE_OFFSET);
-        offset += cal.get(Calendar.DST_OFFSET);
-
-        // DateFormat is operating on GMT so adjust for time zone offset
-        Date dt1 = new Date(time.getTime() + offset);
-        StringBuffer sb = new StringBuffer();
-        sb.append(getPDFDateFormat().format(dt1));
-
-        offset /= (1000 * 60); // Convert to minutes
-
-        if (offset == 0) {
-            sb.append('Z');
-        } else {
-            if (offset > 0) {
-                sb.append('+');
-            } else {
-                sb.append('-');
-            }
-            int offsetHour = Math.abs(offset / 60);
-            int offsetMinutes = Math.abs(offset % 60);
-            if (offsetHour < 10) {
-                sb.append('0');
-            }
-            sb.append(Integer.toString(offsetHour));
-            sb.append('\'');
-            if (offsetMinutes < 10) {
-                sb.append('0');
-            }
-            sb.append(Integer.toString(offsetMinutes));
-            sb.append('\'');
-        }
-        return sb.toString();
+    protected static String formatDateTime(final Date time, TimeZone tz) {
+        return DateFormatUtil.formatPDFDate(time, tz);
     }
 
     /**
@@ -294,7 +249,7 @@ public class PDFInfo extends PDFObject {
      * @param time date/time value to format
      * @return the requested String representation
      */
-    protected static String formatDateTime(Date time) {
+    protected static String formatDateTime(final Date time) {
         return formatDateTime(time, TimeZone.getDefault());
     }
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java Mon May 28 16:16:23 2012
@@ -43,10 +43,9 @@ public class PDFJavaScriptLaunchAction e
     /** {@inheritDoc} */
     public String toPDFString() {
         StringBuffer sb = new StringBuffer(64);
-        sb.append(getObjectID());
         sb.append("<<\n/S /JavaScript\n/JS (");
         sb.append(this.script);
-        sb.append(")\n>>\nendobj\n");
+        sb.append(")\n>>");
         return sb.toString();
     }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java Mon May 28 16:16:23 2012
@@ -19,7 +19,7 @@
 
 package org.apache.fop.pdf;
 
-import org.apache.fop.util.DecimalFormatCache;
+import org.apache.xmlgraphics.util.DoubleFormatUtil;
 
 /**
  * This class represents a simple number object. It also contains contains some
@@ -75,7 +75,12 @@ public class PDFNumber extends PDFObject
      * @return the value as a string
      */
     public static String doubleOut(double doubleDown, int dec) {
-        return DecimalFormatCache.getDecimalFormat(dec).format(doubleDown);
+        if (dec < 0 || dec > 16) {
+            throw new IllegalArgumentException("Parameter dec must be between 1 and 16");
+        }
+        StringBuffer buf = new StringBuffer();
+        DoubleFormatUtil.formatDouble(doubleDown, dec, dec, buf);
+        return buf.toString();
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFStructElem.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFStructElem.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFStructElem.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFStructElem.java Mon May 28 16:16:23 2012
@@ -50,7 +50,6 @@ public class PDFStructElem extends PDFDi
         if (parent instanceof PDFStructElem) {
             parentElement = (PDFStructElem) parent;
         }
-        put("Type", new PDFName("StructElem"));
         put("S", structureType);
         setParent(parent);
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPCustomizable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPCustomizable.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPCustomizable.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPCustomizable.java Mon May 28 16:16:23 2012
@@ -90,6 +90,13 @@ public interface AFPCustomizable {
     void setResolution(int resolution);
 
     /**
+     * Sets the line width correction
+     *
+     * @param correction the line width multiplying factor correction
+     */
+    void setLineWidthCorrection(float correction);
+
+    /**
      * Sets whether FS11 and FS45 non-inline images should be wrapped in a page segment
      * @param pSeg true iff images should be wrapped
      */

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java Mon May 28 16:16:23 2012
@@ -443,6 +443,11 @@ public class AFPDocumentHandler extends 
     }
 
     /** {@inheritDoc} */
+    public void setLineWidthCorrection(float correction) {
+        paintingState.setLineWidthCorrection(correction);
+    }
+
+    /** {@inheritDoc} */
     public int getResolution() {
         return paintingState.getResolution();
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java Mon May 28 16:16:23 2012
@@ -29,6 +29,7 @@ import java.util.List;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 
+import org.apache.fop.afp.AFPConstants;
 import org.apache.fop.afp.AFPEventProducer;
 import org.apache.fop.afp.AFPResourceLevel;
 import org.apache.fop.afp.AFPResourceLevelDefaults;
@@ -37,6 +38,7 @@ import org.apache.fop.afp.fonts.AFPFontC
 import org.apache.fop.afp.fonts.AFPFontInfo;
 import org.apache.fop.afp.fonts.CharacterSet;
 import org.apache.fop.afp.fonts.CharacterSetBuilder;
+import org.apache.fop.afp.fonts.CharacterSetType;
 import org.apache.fop.afp.fonts.DoubleByteFont;
 import org.apache.fop.afp.fonts.OutlineFont;
 import org.apache.fop.afp.fonts.RasterFont;
@@ -220,7 +222,7 @@ public class AFPRendererConfigurator ext
                     }
                 } else {
                     font.addCharacterSet(sizeMpt, CharacterSetBuilder.getSingleByteInstance()
-                                .build(characterset, codepage, encoding, accessor, eventProducer));
+                                .buildSBCS(characterset, codepage, encoding, accessor, eventProducer));
                 }
             }
             return font;
@@ -254,7 +256,7 @@ public class AFPRendererConfigurator ext
                     log.error(msg);
                 }
             } else {
-                characterSet = CharacterSetBuilder.getSingleByteInstance().build(
+                characterSet = CharacterSetBuilder.getSingleByteInstance().buildSBCS(
                         characterset, codepage, encoding, accessor, eventProducer);
             }
             // Return new font object
@@ -269,10 +271,10 @@ public class AFPRendererConfigurator ext
             }
             String name = afpFontCfg.getAttribute("name", characterset);
             CharacterSet characterSet = null;
-            boolean ebcdicDBCS = afpFontCfg.getAttributeAsBoolean("ebcdic-dbcs", false);
-
+            CharacterSetType charsetType = afpFontCfg.getAttributeAsBoolean("ebcdic-dbcs", false)
+                    ? CharacterSetType.DOUBLE_BYTE_LINE_DATA : CharacterSetType.DOUBLE_BYTE;
             characterSet = CharacterSetBuilder.getDoubleByteInstance().buildDBCS(characterset,
-                    codepage, encoding, ebcdicDBCS, accessor, eventProducer);
+                    codepage, encoding, charsetType, accessor, eventProducer);
 
             // Create a new font object
             DoubleByteFont font = new DoubleByteFont(name, characterSet);
@@ -322,7 +324,7 @@ public class AFPRendererConfigurator ext
                 }
                 List<FontTriplet> fontTriplets = afi.getFontTriplets();
                 for (int j = 0; j < fontTriplets.size(); ++j) {
-                    FontTriplet triplet = (FontTriplet) fontTriplets.get(j);
+                    FontTriplet triplet = fontTriplets.get(j);
                     if (log.isDebugEnabled()) {
                         log.debug("  Font triplet "
                                 + triplet.getName() + ", "
@@ -445,6 +447,13 @@ public class AFPRendererConfigurator ext
             customizable.setResolution(rendererResolutionCfg.getValueAsInteger(240));
         }
 
+        // renderer resolution
+        Configuration lineWidthCorrectionCfg = cfg.getChild("line-width-correction", false);
+        if (lineWidthCorrectionCfg != null) {
+            customizable.setLineWidthCorrection(lineWidthCorrectionCfg
+                    .getValueAsFloat(AFPConstants.LINE_WIDTH_CORRECTION));
+        }
+
         // a default external resource group file setting
         Configuration resourceGroupFileCfg
         = cfg.getChild("resource-group-file", false);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFParser.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFParser.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFParser.java Mon May 28 16:16:23 2012
@@ -156,7 +156,7 @@ public class IFParser implements IFConst
 
         private ContentHandler navParser;
 
-        private ContentHandler structureTreeHandler;
+        private StructureTreeHandler structureTreeHandler;
 
         private Attributes pageSequenceAttributes;
 
@@ -165,12 +165,18 @@ public class IFParser implements IFConst
 
         private final class StructureTreeHandler extends DefaultHandler {
 
+            private final Locale pageSequenceLanguage;
+
             private final StructureTreeEventHandler structureTreeEventHandler;
 
             private StructureTreeHandler(StructureTreeEventHandler structureTreeEventHandler,
                     Locale pageSequenceLanguage) throws SAXException {
+                this.pageSequenceLanguage = pageSequenceLanguage;
                 this.structureTreeEventHandler = structureTreeEventHandler;
-                structureTreeEventHandler.startPageSequence(pageSequenceLanguage);
+            }
+
+            void startStructureTree(String type) {
+                structureTreeEventHandler.startPageSequence(pageSequenceLanguage, type);
             }
 
             public void endDocument() throws SAXException {
@@ -263,6 +269,8 @@ public class IFParser implements IFConst
 
                     } else if (localName.equals(EL_STRUCTURE_TREE)) {
                         if (userAgent.isAccessibilityEnabled()) {
+                            String type = attributes.getValue("type");
+                            structureTreeHandler.startStructureTree(type);
                             delegate = structureTreeHandler;
                         } else {
                             /* Delegate to a handler that does nothing */

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFSerializer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFSerializer.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFSerializer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFSerializer.java Mon May 28 16:16:23 2012
@@ -64,6 +64,15 @@ import org.apache.fop.util.XMLUtil;
 public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
         implements IFConstants, IFPainter, IFDocumentNavigationHandler {
 
+    /**
+     * Intermediate Format (IF) version, used to express an @version attribute
+     * in the root element of the IF document, the initial value of which
+     * is set to '2.0' to signify that something preceded it (but didn't
+     * happen to be marked as such), and that this version is not necessarily
+     * backwards compatible with the unmarked (<2.0) version.
+     */
+    public static final String VERSION = "2.0";
+
     private IFDocumentHandler mimicHandler;
     private int pageSequenceIndex; // used for accessibility
 
@@ -167,7 +176,9 @@ public class IFSerializer extends Abstra
                     DocumentNavigationExtensionConstants.NAMESPACE);
             handler.startPrefixMapping(InternalElementMapping.STANDARD_PREFIX,
                     InternalElementMapping.URI);
-            handler.startElement(EL_DOCUMENT);
+            AttributesImpl atts = new AttributesImpl();
+            addAttribute(atts, "version", VERSION);
+            handler.startElement(EL_DOCUMENT, atts);
         } catch (SAXException e) {
             throw new IFException("SAX error in startDocument()", e);
         }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java Mon May 28 16:16:23 2012
@@ -189,11 +189,11 @@ final class IFStructureTreeBuilder imple
         pageSequenceEventRecorders.get(pageSequenceIndex).replay(handler);
     }
 
-    public void startPageSequence(Locale locale) {
+    public void startPageSequence(Locale locale, String role) {
         SAXEventRecorder eventRecorder = new SAXEventRecorder();
         pageSequenceEventRecorders.add(eventRecorder);
         delegate = StructureTree2SAXEventAdapter.newInstance(eventRecorder);
-        delegate.startPageSequence(locale);
+        delegate.startPageSequence(locale, role);
     }
 
     public void endPageSequence() {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFUtil.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFUtil.java Mon May 28 16:16:23 2012
@@ -22,9 +22,10 @@ package org.apache.fop.render.intermedia
 import java.awt.Rectangle;
 import java.awt.geom.AffineTransform;
 
+import org.apache.xmlgraphics.util.DoubleFormatUtil;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.util.DecimalFormatCache;
 
 /**
  * Utility functions for the intermediate format.
@@ -40,7 +41,9 @@ public final class IFUtil {
             //See http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3
             value = 0.0;
         }
-        return DecimalFormatCache.getDecimalFormat(6).format(value);
+        StringBuffer buf = new StringBuffer();
+        DoubleFormatUtil.formatDouble(value, 6, 6, buf);
+        return buf.toString();
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/FOToPDFRoleMap.java Mon May 28 16:16:23 2012
@@ -103,9 +103,9 @@ final class FOToPDFRoleMap {
         addStructureType("Formula");
         addStructureType("Form");
 
-        NON_STRUCT = (PDFName) STANDARD_STRUCTURE_TYPES.get("NonStruct");
+        NON_STRUCT = STANDARD_STRUCTURE_TYPES.get("NonStruct");
         assert NON_STRUCT != null;
-        THEAD = (PDFName) STANDARD_STRUCTURE_TYPES.get("THead");
+        THEAD = STANDARD_STRUCTURE_TYPES.get("THead");
         assert THEAD != null;
 
         // Create the standard mappings
@@ -155,7 +155,7 @@ final class FOToPDFRoleMap {
     }
 
     private static void addMapping(String fo, String structureType) {
-        PDFName type = (PDFName) STANDARD_STRUCTURE_TYPES.get(structureType);
+        PDFName type = STANDARD_STRUCTURE_TYPES.get(structureType);
         assert type != null;
         addMapping(fo, new SimpleMapper(type));
     }
@@ -168,21 +168,6 @@ final class FOToPDFRoleMap {
     /**
      * Maps a Formatting Object to a PDFName representing the associated structure type.
      * @param fo the formatting object's local name
-     * @param parent the parent of the structure element to be mapped
-     * @return the structure type or null if no match could be found
-     */
-    public static PDFName mapFormattingObject(String fo, PDFObject parent) {
-        Mapper mapper = (Mapper) DEFAULT_MAPPINGS.get(fo);
-        if (mapper != null) {
-            return mapper.getStructureType(parent);
-        } else {
-            return NON_STRUCT;
-        }
-    }
-
-    /**
-     * Maps a Formatting Object to a PDFName representing the associated structure type.
-     * @param fo the formatting object's local name
      * @param role the value of the formatting object's role property
      * @param parent the parent of the structure element to be mapped
      * @param eventBroadcaster the event broadcaster
@@ -192,11 +177,11 @@ final class FOToPDFRoleMap {
             PDFObject parent, EventBroadcaster eventBroadcaster) {
         PDFName type = null;
         if (role == null) {
-            type = mapFormattingObject(fo, parent);
+            type = getDefaultMappingFor(fo, parent);
         } else {
-            type = (PDFName) STANDARD_STRUCTURE_TYPES.get(role);
+            type = STANDARD_STRUCTURE_TYPES.get(role);
             if (type == null) {
-                type = mapFormattingObject(fo, parent);
+                type = getDefaultMappingFor(fo, parent);
                 PDFEventProducer.Provider.get(eventBroadcaster).nonStandardStructureType(fo,
                         fo, role, type.toString().substring(1));
             }
@@ -205,6 +190,21 @@ final class FOToPDFRoleMap {
         return type;
     }
 
+    /**
+     * Maps a Formatting Object to a PDFName representing the associated structure type.
+     * @param fo the formatting object's local name
+     * @param parent the parent of the structure element to be mapped
+     * @return the structure type or NonStruct if no match could be found
+     */
+    private static PDFName getDefaultMappingFor(String fo, PDFObject parent) {
+        Mapper mapper = DEFAULT_MAPPINGS.get(fo);
+        if (mapper != null) {
+            return mapper.getStructureType(parent);
+        } else {
+            return NON_STRUCT;
+        }
+    }
+
     private interface Mapper {
         PDFName getStructureType(PDFObject parent);
     }
@@ -226,14 +226,13 @@ final class FOToPDFRoleMap {
     private static class TableCellMapper implements Mapper {
 
         public PDFName getStructureType(PDFObject parent) {
-            PDFStructElem grandParent = (PDFStructElem)
-                ((PDFStructElem) parent).getParentStructElem();
+            PDFStructElem grandParent = ((PDFStructElem) parent).getParentStructElem();
             //TODO What to do with cells from table-footer? Currently they are mapped on TD.
             PDFName type;
             if (THEAD.equals(grandParent.getStructureType())) {
-               type = (PDFName) STANDARD_STRUCTURE_TYPES.get("TH");
+               type = STANDARD_STRUCTURE_TYPES.get("TH");
             } else {
-                type = (PDFName) STANDARD_STRUCTURE_TYPES.get("TD");
+                type = STANDARD_STRUCTURE_TYPES.get("TD");
             }
             assert type != null;
             return type;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java Mon May 28 16:16:23 2012
@@ -19,8 +19,6 @@
 
 package org.apache.fop.render.pdf;
 
-import java.util.Locale;
-
 import org.apache.fop.pdf.PDFArray;
 import org.apache.fop.pdf.PDFDictionary;
 import org.apache.fop.pdf.PDFDocument;
@@ -29,7 +27,6 @@ import org.apache.fop.pdf.PDFName;
 import org.apache.fop.pdf.PDFPage;
 import org.apache.fop.pdf.PDFParentTree;
 import org.apache.fop.pdf.PDFStructElem;
-import org.apache.fop.pdf.PDFStructTreeRoot;
 
 
 /**
@@ -59,8 +56,6 @@ class PDFLogicalStructureHandler {
      */
     private PDFArray pageParentTreeArray;
 
-    private PDFStructElem rootStructureElement;
-
     /**
      * Class providing the necessary information for bracketing content
      * associated to a structure element as a marked-content sequence.
@@ -95,22 +90,10 @@ class PDFLogicalStructureHandler {
      */
     PDFLogicalStructureHandler(PDFDocument pdfDoc) {
         this.pdfDoc = pdfDoc;
-        PDFStructTreeRoot structTreeRoot = pdfDoc.makeStructTreeRoot(parentTree);
-        rootStructureElement = pdfDoc.makeStructureElement(
-                FOToPDFRoleMap.mapFormattingObject("root", structTreeRoot), structTreeRoot);
-        structTreeRoot.addKid(rootStructureElement);
     }
 
-
-    PDFStructElem createPageSequence(Locale language) {
-        PDFStructElem structElemPart = pdfDoc.makeStructureElement(
-                FOToPDFRoleMap.mapFormattingObject("page-sequence", rootStructureElement),
-                rootStructureElement);
-        rootStructureElement.addKid(structElemPart);
-        if (language != null) {
-            structElemPart.setLanguage(language);
-        }
-        return structElemPart;
+    PDFParentTree getParentTree() {
+        return parentTree;
     }
 
     private int getNextParentTreeKey() {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java Mon May 28 16:16:23 2012
@@ -29,7 +29,11 @@ import org.apache.fop.accessibility.Stru
 import org.apache.fop.events.EventBroadcaster;
 import org.apache.fop.fo.extensions.ExtensionElementMapping;
 import org.apache.fop.pdf.PDFFactory;
+import org.apache.fop.pdf.PDFName;
+import org.apache.fop.pdf.PDFObject;
+import org.apache.fop.pdf.PDFParentTree;
 import org.apache.fop.pdf.PDFStructElem;
+import org.apache.fop.pdf.PDFStructTreeRoot;
 
 class PDFStructureTreeBuilder implements StructureTreeEventHandler {
 
@@ -41,21 +45,42 @@ class PDFStructureTreeBuilder implements
 
     private LinkedList<PDFStructElem> ancestors = new LinkedList<PDFStructElem>();
 
+    private PDFStructElem rootStructureElement;
+
     void setPdfFactory(PDFFactory pdfFactory) {
         this.pdfFactory = pdfFactory;
     }
 
     void setLogicalStructureHandler(PDFLogicalStructureHandler logicalStructureHandler) {
         this.logicalStructureHandler = logicalStructureHandler;
+        createRootStructureElement();
+    }
+
+    private void createRootStructureElement() {
+        assert rootStructureElement == null;
+        PDFParentTree parentTree = logicalStructureHandler.getParentTree();
+        PDFStructTreeRoot structTreeRoot = pdfFactory.getDocument().makeStructTreeRoot(parentTree);
+        rootStructureElement = createStructureElement("root", structTreeRoot, null);
+        structTreeRoot.addKid(rootStructureElement);
     }
 
     void setEventBroadcaster(EventBroadcaster eventBroadcaster) {
         this.eventBroadcaster = eventBroadcaster;
     }
 
-    public void startPageSequence(Locale locale) {
+    public void startPageSequence(Locale language, String role) {
         ancestors = new LinkedList<PDFStructElem>();
-        ancestors.add(logicalStructureHandler.createPageSequence(locale));
+        PDFStructElem structElem = createStructureElement("page-sequence", rootStructureElement, role);
+        if (language != null) {
+            structElem.setLanguage(language);
+        }
+        rootStructureElement.addKid(structElem);
+        ancestors.add(structElem);
+    }
+
+    private PDFStructElem createStructureElement(String name, PDFObject parent, String role) {
+        PDFName structureType = FOToPDFRoleMap.mapFormattingObject(name, role, parent, eventBroadcaster);
+        return pdfFactory.getDocument().makeStructureElement(structureType, parent);
     }
 
     public void endPageSequence() {
@@ -64,12 +89,10 @@ class PDFStructureTreeBuilder implements
     public StructureTreeElement startNode(String name, Attributes attributes) {
         PDFStructElem parent = ancestors.getFirst();
         String role = attributes.getValue("role");
-        PDFStructElem created;
-        created = pdfFactory.getDocument().makeStructureElement(
-                FOToPDFRoleMap.mapFormattingObject(name, role, parent, eventBroadcaster), parent);
-        parent.addKid(created);
-        ancestors.addFirst(created);
-        return created;
+        PDFStructElem structElem = createStructureElement(name, parent, role);
+        parent.addKid(structElem);
+        ancestors.addFirst(structElem);
+        return structElem;
     }
 
     public void endNode(String name) {
@@ -83,34 +106,30 @@ class PDFStructureTreeBuilder implements
     public StructureTreeElement startImageNode(String name, Attributes attributes) {
         PDFStructElem parent = ancestors.getFirst();
         String role = attributes.getValue("role");
-        PDFStructElem created;
-        created = pdfFactory.getDocument().makeStructureElement(
-                FOToPDFRoleMap.mapFormattingObject(name, role, parent, eventBroadcaster), parent);
-        parent.addKid(created);
+        PDFStructElem structElem = createStructureElement(name, parent, role);
+        parent.addKid(structElem);
         String altTextNode = attributes.getValue(ExtensionElementMapping.URI, "alt-text");
         if (altTextNode != null) {
-            created.put("Alt", altTextNode);
+            structElem.put("Alt", altTextNode);
         } else {
-            created.put("Alt", "No alternate text specified");
+            structElem.put("Alt", "No alternate text specified");
         }
-        ancestors.addFirst(created);
-        return created;
+        ancestors.addFirst(structElem);
+        return structElem;
     }
 
     public StructureTreeElement startReferencedNode(String name, Attributes attributes) {
         PDFStructElem parent = ancestors.getFirst();
         String role = attributes.getValue("role");
-        PDFStructElem created;
+        PDFStructElem structElem;
         if ("#PCDATA".equals(name)) {
-            created = new PDFStructElem.Placeholder(parent, name);
+            structElem = new PDFStructElem.Placeholder(parent, name);
         } else {
-            created = pdfFactory.getDocument().makeStructureElement(
-                    FOToPDFRoleMap.mapFormattingObject(name, role, parent,
-                            eventBroadcaster), parent);
+            structElem = createStructureElement(name, parent, role);
         }
-        parent.addKid(created);
-        ancestors.addFirst(created);
-        return created;
+        parent.addKid(structElem);
+        ancestors.addFirst(structElem);
+        return structElem;
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSDocumentHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSDocumentHandler.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSDocumentHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSDocumentHandler.java Mon May 28 16:16:23 2012
@@ -26,6 +26,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -58,6 +59,7 @@ import org.apache.fop.render.intermediat
 import org.apache.fop.render.intermediate.IFPainter;
 import org.apache.fop.render.ps.extensions.PSCommentAfter;
 import org.apache.fop.render.ps.extensions.PSCommentBefore;
+import org.apache.fop.render.ps.extensions.PSPageTrailerCodeBefore;
 import org.apache.fop.render.ps.extensions.PSSetPageDevice;
 import org.apache.fop.render.ps.extensions.PSSetupCode;
 
@@ -99,10 +101,11 @@ public class PSDocumentHandler extends A
     private PSPageDeviceDictionary pageDeviceDictionary;
 
     /** This is a collection holding all document header comments */
-    private Collection[] comments = new Collection[3];
+    private Collection[] comments = new Collection[4];
     private static final int COMMENT_DOCUMENT_HEADER = 0;
     private static final int COMMENT_DOCUMENT_TRAILER = 1;
     private static final int COMMENT_PAGE_TRAILER = 2;
+    private static final int PAGE_TRAILER_CODE_BEFORE = 3;
 
     private PSEventProducer eventProducer;
 
@@ -448,8 +451,9 @@ public class PSDocumentHandler extends A
 
     /** {@inheritDoc} */
     public void startPageTrailer() throws IFException {
-        super.startPageTrailer();
         try {
+            writeExtensions(PAGE_TRAILER_CODE_BEFORE);
+            super.startPageTrailer();
             gen.writeDSCComment(DSCConstants.PAGE_TRAILER);
         } catch (IOException ioe) {
             throw new IFException("I/O error in startPageTrailer()", ioe);
@@ -531,6 +535,11 @@ public class PSDocumentHandler extends A
                     comments[targetCollection] = new java.util.ArrayList();
                 }
                 comments[targetCollection].add(extension);
+            } else if (extension instanceof PSPageTrailerCodeBefore) {
+                if (comments[PAGE_TRAILER_CODE_BEFORE] == null) {
+                    comments[PAGE_TRAILER_CODE_BEFORE] = new ArrayList();
+                }
+                comments[PAGE_TRAILER_CODE_BEFORE].add(extension);
             }
         } catch (IOException ioe) {
             throw new IFException("I/O error in handleExtensionObject()", ioe);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSPainter.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSPainter.java Mon May 28 16:16:23 2012
@@ -76,10 +76,14 @@ public class PSPainter extends AbstractI
      * @param documentHandler the parent document handler
      */
     public PSPainter(PSDocumentHandler documentHandler) {
+        this(documentHandler, IFState.create());
+    }
+
+    protected PSPainter(PSDocumentHandler documentHandler, IFState state) {
         super();
         this.documentHandler = documentHandler;
         this.borderPainter = new PSBorderPainter(documentHandler.gen);
-        this.state = IFState.create();
+        this.state = state;
     }
 
     /** {@inheritDoc} */
@@ -348,6 +352,10 @@ public class PSPainter extends AbstractI
     public void drawText(int x, int y, int letterSpacing, int wordSpacing,
             int[][] dp, String text) throws IFException {
         try {
+            //Do not draw text if font-size is 0 as it creates an invalid PostScript file
+            if (state.getFontSize() == 0) {
+                return;
+            }
             PSGenerator generator = getGenerator();
             generator.useColor(state.getTextColor());
             beginTextObject();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java Mon May 28 16:16:23 2012
@@ -41,6 +41,7 @@ public class PSExtensionElementMapping e
             foObjs = new java.util.HashMap<String, Maker>();
             foObjs.put(PSSetupCodeElement.ELEMENT, new PSSetupCodeMaker());
             foObjs.put(PSPageSetupCodeElement.ELEMENT, new PSPageSetupCodeMaker());
+            foObjs.put(PSPageTrailerCodeBefore.ELEMENT, new PSPageTrailerCodeBeforeMaker());
             foObjs.put(PSSetPageDeviceElement.ELEMENT, new PSSetPageDeviceMaker());
             foObjs.put(PSCommentBefore.ELEMENT, new PSCommentBeforeMaker());
             foObjs.put(PSCommentAfter.ELEMENT, new PSCommentAfterMaker());
@@ -59,6 +60,12 @@ public class PSExtensionElementMapping e
         }
     }
 
+    static class PSPageTrailerCodeBeforeMaker extends ElementMapping.Maker {
+        public FONode make(FONode parent) {
+            return new PSPageTrailerCodeBeforeElement(parent);
+        }
+    }
+
     static class PSSetPageDeviceMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
             return new PSSetPageDeviceElement(parent);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java Mon May 28 16:16:23 2012
@@ -53,6 +53,7 @@ public class PSExtensionHandler extends 
             lastAttributes = new AttributesImpl(attributes);
             handled = false;
             if (localName.equals(PSSetupCode.ELEMENT)
+                    || localName.equals(PSPageTrailerCodeBefore.ELEMENT)
                     || localName.equals(PSSetPageDevice.ELEMENT)
                     || localName.equals(PSCommentBefore.ELEMENT)
                     || localName.equals(PSCommentAfter.ELEMENT)) {
@@ -84,6 +85,8 @@ public class PSExtensionHandler extends 
                 this.returnedObject = new PSCommentBefore(content.toString());
             } else if (PSCommentAfter.ELEMENT.equals(localName)) {
                 this.returnedObject = new PSCommentAfter(content.toString());
+            } else if (PSPageTrailerCodeBefore.ELEMENT.equals(localName)) {
+                this.returnedObject = new PSPageTrailerCodeBefore(content.toString());
             }
         }
         content.setLength(0); //Reset text buffer (see characters())

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java Mon May 28 16:16:23 2012
@@ -28,6 +28,7 @@ package org.apache.fop.render.rtf.rtflib
 
 import java.io.IOException;
 import java.io.Writer;
+import java.util.List;
 
 /**
  * <p>Models a section in an RTF document</p>
@@ -192,7 +193,11 @@ implements
      * @throws IOException for I/O problems
      */
     protected void writeRtfSuffix() throws IOException {
-        writeControlWord("sect");
+        // write suffix /sect only if this section is not last section (see bug #51484)
+        List siblings = parent.getChildren();
+        if ( ( siblings.indexOf ( this ) + 1 ) < siblings.size() ) {
+            writeControlWord("sect");
+        }
     }
 
     private void closeCurrentTable() throws IOException {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/txt/TXTRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/txt/TXTRenderer.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/txt/TXTRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/txt/TXTRenderer.java Mon May 28 16:16:23 2012
@@ -195,7 +195,7 @@ public class TXTRenderer extends Abstrac
      */
     protected void renderText(TextArea area) {
         int col = Helper.ceilPosition(this.currentIPPosition, CHAR_WIDTH);
-        int row = Helper.ceilPosition(this.currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2*LINE_LEADING);
+        int row = Helper.ceilPosition(this.currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2 * LINE_LEADING);
 
         String s = area.getText();
 
@@ -219,7 +219,7 @@ public class TXTRenderer extends Abstrac
         double height = bounds.getHeight();
 
         pageWidth = Helper.ceilPosition((int) width, CHAR_WIDTH);
-        pageHeight = Helper.ceilPosition((int) height, CHAR_HEIGHT + 2*LINE_LEADING);
+        pageHeight = Helper.ceilPosition((int) height, CHAR_HEIGHT + 2 * LINE_LEADING);
 
         // init buffers
         charData = new StringBuffer[pageHeight];
@@ -463,9 +463,9 @@ public class TXTRenderer extends Abstrac
      */
     public void renderImage(Image image, Rectangle2D pos) {
         int x1 = Helper.ceilPosition(currentIPPosition, CHAR_WIDTH);
-        int y1 = Helper.ceilPosition(currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2*LINE_LEADING);
+        int y1 = Helper.ceilPosition(currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2 * LINE_LEADING);
         int width = Helper.ceilPosition((int) pos.getWidth(), CHAR_WIDTH);
-        int height = Helper.ceilPosition((int) pos.getHeight(), CHAR_HEIGHT + 2*LINE_LEADING);
+        int height = Helper.ceilPosition((int) pos.getHeight(), CHAR_HEIGHT + 2 * LINE_LEADING);
 
         fillRect(x1, y1, width, height, IMAGE_CHAR);
     }
@@ -562,9 +562,9 @@ public class TXTRenderer extends Abstrac
     protected void drawBackAndBorders(Area area, float startx, float starty,
             float width, float height) {
         bm.setWidth(Helper.ceilPosition(toMilli(width), CHAR_WIDTH));
-        bm.setHeight(Helper.ceilPosition(toMilli(height), CHAR_HEIGHT + 2*LINE_LEADING));
+        bm.setHeight(Helper.ceilPosition(toMilli(height), CHAR_HEIGHT + 2 * LINE_LEADING));
         bm.setStartX(Helper.ceilPosition(toMilli(startx), CHAR_WIDTH));
-        bm.setStartY(Helper.ceilPosition(toMilli(starty), CHAR_HEIGHT + 2*LINE_LEADING));
+        bm.setStartY(Helper.ceilPosition(toMilli(starty), CHAR_HEIGHT + 2 * LINE_LEADING));
 
         super.drawBackAndBorders(area, startx, starty, width, height);
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/xml/XMLRenderer.java Mon May 28 16:16:23 2012
@@ -97,6 +97,15 @@ import org.apache.fop.util.XMLUtil;
  */
 public class XMLRenderer extends AbstractXMLRenderer {
 
+    /**
+     * Area Tree  (AT) version, used to express an @version attribute
+     * in the root element of the AT document, the initial value of which
+     * is set to '2.0' to signify that something preceded it (but didn't
+     * happen to be marked as such), and that this version is not necessarily
+     * backwards compatible with the unmarked (<2.0) version.
+     */
+    public static final String VERSION = "2.0";
+
     /** XML MIME type */
     public static final String XML_MIME_TYPE = MimeConstants.MIME_FOP_AREA_TREE;
 
@@ -365,7 +374,9 @@ public class XMLRenderer extends Abstrac
         if (userAgent.getProducer() != null) {
             comment("Produced by " + userAgent.getProducer());
         }
-        startElement("areaTree");
+        atts.clear();
+        addAttribute("version", VERSION);
+        startElement("areaTree", atts);
     }
 
     /** {@inheritDoc} */
@@ -825,11 +836,10 @@ public class XMLRenderer extends Abstrac
         }
         maybeAddLevelAttribute(word);
         maybeAddPositionAdjustAttribute(word);
-        if ( word.isReversed() ) {
-            addAttribute("reversed", "true");
-        }
+        String text = word.getWord();
+        maybeAddReversedAttribute(word, text);
         startElement("word", atts);
-        characters(word.getWord());
+        characters(text);
         endElement("word");
         super.renderWord(word);
     }
@@ -917,5 +927,11 @@ public class XMLRenderer extends Abstrac
         }
     }
 
+    private void maybeAddReversedAttribute ( WordArea w, String text ) {
+        if ( w.isReversed() && ( text.length() > 1 )  ) {
+            addAttribute("reversed", "true");
+        }
+    }
+
 
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/svg/PDFGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/svg/PDFGraphics2D.java Mon May 28 16:16:23 2012
@@ -1171,8 +1171,8 @@ public class PDFGraphics2D extends Abstr
 
         currentStream.write("q\n");
         writeClip(shape);
-        currentStream.write("" + usrW + " 0 0 " + (-usrH) + " " + usrX
-                            + " " + (usrY + usrH) + " cm\n"
+        currentStream.write("" + PDFNumber.doubleOut(usrW) + " 0 0 " + PDFNumber.doubleOut(-usrH) + " "
+                + PDFNumber.doubleOut(usrX) + " " + PDFNumber.doubleOut(usrY + usrH) + " cm\n"
                             + imageInfo.getName() + " Do\nQ\n");
         return true;
     }

Propchange: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/util/ColorExt.java
------------------------------------------------------------------------------
  Merged /xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:r1325838-1343304

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml Mon May 28 16:16:23 2012
@@ -53,6 +53,7 @@
     <context id="Extensions" title="Changes to the Bundled Extensions"/>
     <context id="Images" title="Changes to the Image Support"/>
     <context id="Config" title="Changes to the User Configuration"/>
+    <context id="Test" title="Changes to unit tests or other test code"/>
   </contexts>
 
   <changes>
@@ -62,10 +63,105 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="53304,53306">
+        Add version attribute to AT and IF intermediate formats. Also eliminate redundant use of reversed attribute in AT format.
+      </action>
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="53295" due-to="Luis Bernardo">
+        Add extension to place code just before PostScript %PageTrailer.
+      </action>
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="53294" due-to="Robert Meyer">
+        Fix invalid PostScript file being created when font-size is 0.
+      </action>
+      <action context="Docs" dev="GA" type="update">
+        Update FAQ and New Bug documentation.
+      </action>
+      <action context="Code" dev="VH" type="add">
+        Added support for the role property on fo:page-sequence, fo:flow and fo:static-content. This 
+        allows to change the mapping of those FOs to PDF structure types when enabling 
+        accessibility.
+      </action>
+      <action context="Renderers" dev="VH" type="fix" due-to="Martin Koegler">
+        Stop outputting the Type entry for structure elements in order to create a smaller PDF 
+        ouptut when accessibility is enabled.
+      </action>
+      <action context="Config" dev="GA" type="fix" fixes-bug="52144" due-to="Luis Bernardo">
+        Fix crash on use of version switch (-v).
+      </action>
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="53242" due-to="Luis Bernardo">
+        Support fractional line widths in AFP renderer, fixing problem with SVG line drawing.
+      </action>
+      <action context="Config" dev="GA" type="fix" fixes-bug="53248" due-to="Luis Bernardo">
+        Fix exception thrown from use of -print option in CLI.
+      </action>
+      <action context="Docs" dev="GA" type="fix" fixes-bug="53247">
+        Fix renderer mime type for PCL output; should be application/x-pcl.
+      </action>
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="40699" due-to="Luis Bernardo">
+        Fix for invalid PDF for certain numerical values in SVG lineargradient.
+      </action>
+      <action context="Layout" dev="GA" type="fix" fixes-bug="53185" due-to="Robert Meyer">
+        Unify date formatting between FOP and XGC as well as tidying the date format code.
+      </action>
+      <action context="Layout" dev="GA" type="fix" fixes-bug="45715" due-to="Luis Bernardo">
+        Break before (break-before) not respected on blocks nested in inlines.
+      </action>
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="48723" due-to="Robert Meyer">
+        Fix for XGC when rendering PostScript using SVG being drawn upside down when using a custom affine transform.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="43940" due-to="Julien Aymé, Ognjen Blagojevic">
+        Use new double format utility to improve thread safety and performance.
+      </action>
+      <action context="Fonts" dev="GA" type="fix" fixes-bug="53148" due-to="Tassos Charoulis">
+        Fix performance regression in JDK 1.6 Update 19 due to use of Java Beans API. Fix checkstyle errors.
+      </action>
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="51484" due-to="Benjamin Riefenstahl">
+        Don't write final /sect suffix in RTF if section is last section.
+      </action>
+      <action context="Fonts" dev="GA" type="fix" fixes-bug="53143">
+        Ensure fonts are not loaded twice (redundantly).
+      </action>
+      <action context="Test" dev="GA" type="update" fixes-bug="50196" due-to="Matthias Reischenbacher">
+        Add test for basic-link with padding.
+      </action>
+      <action context="Code" dev="GA" type="update">
+        Improve property function argument parsing, specifically, better separate required, optional, and variable arguments and the handling of optional argument defaults.
+        Regularize property function class names.
+      </action>
+      <action context="Layout" dev="GA" type="fix" fixes-bug="51043" due-to="Pascal Sancho">
+        Don't restart layout unless abs(ipd difference) > 1 in order to prevent rounding issues from triggering false restart.
+      </action>
+      <action context="Fonts" dev="GA" type="update">
+        Removing experimental feature that violates XSL-FO and Unicode semantics by misinterpreting Basic Latin code points. Users must use private use codepoints to access font specific
+        character mappings that have no assigned Unicode code point. See bug 50492.
+      </action>
+      <action context="Layout" dev="GA" type="fix" fixes-bug="53103" due-to="Matthias Reischenbacher">
+        Ensure that table cell spanning works in right-to-left writing mode.
+      </action>
+      <action context="Layout" dev="GA" type="fix" fixes-bug="53086">
+        Ensure that table footer and header are included in bididirectional resolution.
+      </action>
+      <action context="Layout" dev="GA" type="fix" fixes-bug="53097">
+        Ensure writing-mode specified on fo:table is used to determine writing mode of table and its descendants.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="53094" due-to="Luis Bernardo">
+        Convert block container overflow exception to event model, improving overflow property behavior.
+      </action>
+      <action context="Code" dev="GA" type="update" fixes-bug="51617">
+        Add run target for embedded examples. Add increased JVM memory heap flag for example8 in case font cache is rebuilt.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="53083">
+        Update to use of checkstyle-5.5 as default configuration. Remove checkstyle-4.0 configuration. Also, import environment build properties before local properties, so that latter can refer to former.'
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="52572" due-to="Pascal Sancho">
+        Prevent NPE on use of unsupported collapse-with-precedence; fall back to collapse. Fix checkstyle errors from prior commit.
+      </action>
+      <action context="Layout" dev="GA" type="fix" fixes-bug="52514" due-to="Luis Bernardo">
+        Ensure square image is appropriately scaled.
+      </action>
       <action context="Code" dev="GA" type="fix" fixes-bug="50062">
         Invoke JVM in headless mode from FOP command scripts and JS shell to prevent stealing focus from GUI applications.
       </action>
-      <action context="Code" dev="GA" type="fix" fixes-bug="52114">
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="52114">
         Take leading derived space before/after into account when computing rows for TXT renderer.
       </action>
       <action context="Code" dev="PH" type="add" fixes-bug="49893">

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/test/events/inline-level.fo
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/test/events/inline-level.fo?rev=1343310&r1=1343309&r2=1343310&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/test/events/inline-level.fo (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/test/events/inline-level.fo Mon May 28 16:16:23 2012
@@ -2,16 +2,14 @@
 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <fo:layout-master-set>
     <fo:simple-page-master master-name="page"
-      page-height="420pt" page-width="320pt" margin="10pt">
+      page-height="420pt" page-width="100pt" margin="10pt">
       <fo:region-body background-color="#F0F0F0"/>
     </fo:simple-page-master>
   </fo:layout-master-set>
   <fo:page-sequence master-reference="page">
     <fo:flow flow-name="xsl-region-body">
       <fo:block>The following line overflows its container:</fo:block>
-      <fo:block-container width="100pt" height="100pt" border="1pt solid black">
-        <fo:block>ThisLineOverflowsItsContainer</fo:block>
-      </fo:block-container>
+      <fo:block border="1pt solid black">ThisLineOverflowsItsContainer</fo:block>
     </fo:flow>
   </fo:page-sequence>
 </fo:root>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message