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 vh...@apache.org on 2012/04/13 18:49:38 UTC

svn commit: r1325839 [2/2] - in /xmlgraphics/fop/branches/Temp_TrueTypeInPostScript: ./ examples/embedding/java/embedding/ src/documentation/ src/documentation/content/xdocs/ src/documentation/content/xdocs/dev/ src/documentation/content/xdocs/trunk/ s...

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java Fri Apr 13 16:49:35 2012
@@ -59,7 +59,7 @@ public class Marker extends FObjMixed {
     /** {@inheritDoc} */
     public void bind(PropertyList pList) throws FOPException {
         if (findAncestor(FO_FLOW) < 0) {
-            invalidChildError(locator, getParent().getName(), FO_URI, getName(),
+            invalidChildError(locator, getParent().getName(), FO_URI, getLocalName(),
                 "rule.markerDescendantOfFlow");
         }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java Fri Apr 13 16:49:35 2012
@@ -60,7 +60,7 @@ public class RetrieveMarker extends Abst
                             PropertyList pList)
             throws FOPException {
         if (findAncestor(FO_STATIC_CONTENT) < 0) {
-            invalidChildError(locator, getParent().getName(), FO_URI, getName(),
+            invalidChildError(locator, getParent().getName(), FO_URI, getLocalName(),
                 "rule.retrieveMarkerDescendantOfStaticContent");
         } else {
             super.processNode(elementName, locator, attlist, pList);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/properties/PropertyCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/properties/PropertyCache.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/properties/PropertyCache.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/properties/PropertyCache.java Fri Apr 13 16:49:35 2012
@@ -76,20 +76,28 @@ public final class PropertyCache<T> {
      * (case insensitive).
      */
     public PropertyCache() {
-        this.useCache = Boolean.valueOf(
-                System.getProperty("org.apache.fop.fo.properties.use-cache", "true"))
-                .booleanValue();
-        if (useCache) {
-            map = new ConcurrentHashMap<Integer, WeakReference<T>>();
-            putCounter = new AtomicInteger();
-            cleanupLock = new ReentrantLock();
-            hashCodeCollisionCounter = new AtomicInteger();
+        boolean useCache;
+        try {
+            useCache = Boolean.valueOf(
+                    System.getProperty("org.apache.fop.fo.properties.use-cache", "true"))
+                    .booleanValue();
+        } catch ( SecurityException e ) {
+            useCache = true;
+            LOG.info("Unable to access org.apache.fop.fo.properties.use-cache"
+                   + " due to security restriction; defaulting to 'true'.");
+        }
+        if ( useCache ) {
+            this.map = new ConcurrentHashMap<Integer, WeakReference<T>>();
+            this.putCounter = new AtomicInteger();
+            this.cleanupLock = new ReentrantLock();
+            this.hashCodeCollisionCounter = new AtomicInteger();
         } else {
-            map = null;
-            putCounter = null;
-            cleanupLock = null;
-            hashCodeCollisionCounter = null;
+            this.map = null;
+            this.putCounter = null;
+            this.cleanupLock = null;
+            this.hashCodeCollisionCounter = null;
         }
+        this.useCache = useCache;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/FontInfo.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/FontInfo.java Fri Apr 13 16:49:35 2012
@@ -474,7 +474,7 @@ public class FontInfo {
         FontTriplet key = null;
         String f = null;
         int newWeight = weight;
-        if (newWeight <= 400) {
+        if (newWeight < 400) {
             while (f == null && newWeight > 100) {
                 newWeight -= 100;
                 key = createFontKey(family, style, newWeight);
@@ -486,7 +486,7 @@ public class FontInfo {
                 key = createFontKey(family, style, newWeight);
                 f = getInternalFontKey(key);
             }
-        } else if (newWeight == 500) {
+        } else if (newWeight == 400 || newWeight == 500) {
             key = createFontKey(family, style, 400);
             f = getInternalFontKey(key);
         } else if (newWeight > 500) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/CharVector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/CharVector.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/CharVector.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/CharVector.java Fri Apr 13 16:49:35 2012
@@ -101,9 +101,9 @@ public class CharVector implements Clone
     }
 
     /** {@inheritDoc} */
-    public Object clone() {
-        CharVector cv = new CharVector((char[])array.clone(), blockSize);
-        cv.n = this.n;
+    public Object clone() throws CloneNotSupportedException {
+        CharVector cv = (CharVector) super.clone();
+        cv.array = (char[])array.clone();
         return cv;
     }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/TernaryTree.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/TernaryTree.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/TernaryTree.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/hyphenation/TernaryTree.java Fri Apr 13 16:49:35 2012
@@ -48,7 +48,7 @@ import java.util.Stack;
  * patterns which will be keys in this tree. The strings patterns
  * are usually small (from 2 to 5 characters), but each char in the
  * tree is stored in a node. Thus memory usage is the main concern.
- * We will sacrify 'elegance' to keep memory requirenments to the
+ * We will sacrify 'elegance' to keep memory requirements to the
  * minimum. Using java's char type as pointer (yes, I know pointer
  * it is a forbidden word in java) we can keep the size of the node
  * to be just 8 bytes (3 pointers and the data char). This gives
@@ -406,16 +406,13 @@ public class TernaryTree implements Clon
     }
 
     /** {@inheritDoc} */
-    public Object clone() {
-        TernaryTree t = new TernaryTree();
+    public Object clone() throws CloneNotSupportedException {
+        TernaryTree t = (TernaryTree) super.clone();
         t.lo = (char[])this.lo.clone();
         t.hi = (char[])this.hi.clone();
         t.eq = (char[])this.eq.clone();
         t.sc = (char[])this.sc.clone();
         t.kv = (CharVector)this.kv.clone();
-        t.root = this.root;
-        t.freenode = this.freenode;
-        t.length = this.length;
 
         return t;
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Fri Apr 13 16:49:35 2012
@@ -752,7 +752,7 @@ public abstract class AbstractBreaker {
         Position positionAtBreak = elementAtBreak.getPosition();
         if (!(positionAtBreak instanceof SpaceResolver.SpaceHandlingBreakPosition)) {
             throw new UnsupportedOperationException(
-                    "Don't know how to restart at position" + positionAtBreak);
+                    "Don't know how to restart at position " + positionAtBreak);
         }
         /* Retrieve the original position wrapped into this space position */
         positionAtBreak = positionAtBreak.getPosition();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableStepper.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableStepper.java Fri Apr 13 16:49:35 2012
@@ -200,7 +200,7 @@ public class TableStepper {
 
             LinkedList footnoteList = new LinkedList();
             //Put all involved grid units into a list
-            List cellParts = new java.util.ArrayList(columnCount);
+            List cellParts = new java.util.ArrayList(activeCells.size());
             for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
                 ActiveCell activeCell = (ActiveCell) iter.next();
                 CellPart part = activeCell.createCellPart();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java Fri Apr 13 16:49:35 2012
@@ -1063,6 +1063,9 @@ public class PDFFactory {
         } else if (targetLo.startsWith("http://")) {
             // HTTP URL?
             return new PDFUri(target);
+        } else if (targetLo.startsWith("https://")) {
+            // HTTPS URL?
+            return new PDFUri(target);
         } else if (targetLo.startsWith("file://")) {
             // Non PDF files. Try to /Launch them.
             target = target.substring("file://".length());

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=1325839&r1=1325838&r2=1325839&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 Fri Apr 13 16:49:35 2012
@@ -90,6 +90,30 @@ public interface AFPCustomizable {
     void setResolution(int resolution);
 
     /**
+     * Sets whether FS11 and FS45 non-inline images should be wrapped in a page segment
+     * @param pSeg true iff images should be wrapped
+     */
+    void setWrapPSeg(boolean pSeg);
+
+    /**
+     * set true if images should be FS45
+     * @param fs45 true iff images should be FS45
+     */
+    void setFS45(boolean fs45);
+
+    /**
+     * gets whether FS11 and FS45 non-inline images should be wrapped in a page segment
+     * @return true iff images should be wrapped
+     */
+    boolean getWrapPSeg();
+
+    /**
+     * gets whether images should be FS45
+     * @return true iff images should be FS45
+     */
+    boolean getFS45();
+
+    /**
      * Returns the output/device resolution.
      *
      * @return the resolution in dpi

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=1325839&r1=1325838&r2=1325839&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 Fri Apr 13 16:49:35 2012
@@ -468,6 +468,26 @@ public class AFPDocumentHandler extends 
     }
 
     /** {@inheritDoc} */
+    public void setWrapPSeg(boolean pSeg) {
+        paintingState.setWrapPSeg(pSeg);
+    }
+
+    /** {@inheritDoc} */
+    public void setFS45(boolean fs45) {
+        paintingState.setFS45(fs45);
+    }
+
+    /** {@inheritDoc} */
+    public boolean getWrapPSeg() {
+        return  paintingState.getWrapPSeg();
+    }
+
+    /** {@inheritDoc} */
+    public boolean getFS45() {
+        return  paintingState.getFS45();
+    }
+
+    /** {@inheritDoc} */
     public void setDefaultResourceGroupFilePath(String filePath) {
         resourceManager.setDefaultResourceGroupFilePath(filePath);
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java Fri Apr 13 16:49:35 2012
@@ -149,6 +149,25 @@ public class AFPImageHandlerRenderedImag
 
     private static final class RenderedImageEncoder {
 
+        private enum FunctionSet {
+
+            FS10(MimeConstants.MIME_AFP_IOCA_FS10),
+            FS11(MimeConstants.MIME_AFP_IOCA_FS11),
+            FS45(MimeConstants.MIME_AFP_IOCA_FS45);
+
+            private String mimeType;
+
+            FunctionSet(String mimeType) {
+                this.mimeType  = mimeType;
+            }
+
+            private String getMimeType() {
+                return mimeType;
+            }
+        };
+
+
+
         private ImageRendered imageRendered;
         private Dimension targetSize;
 
@@ -223,7 +242,7 @@ public class AFPImageHandlerRenderedImag
                 throws IOException {
 
             RenderedImage renderedImage = imageRendered.getRenderedImage();
-            int functionSet = useFS10 ? 10 : 11;
+            FunctionSet functionSet = useFS10 ? FunctionSet.FS10 : FunctionSet.FS11;
 
             if (usePageSegments) {
                 assert resampledDim != null;
@@ -285,7 +304,7 @@ public class AFPImageHandlerRenderedImag
                     log.debug("Encoding image directly...");
                     imageObjectInfo.setBitsPerPixel(encodedColorModel.getPixelSize());
                     if (pixelSize == 32) {
-                        functionSet = 45; //IOCA FS45 required for CMYK
+                        functionSet = FunctionSet.FS45; //IOCA FS45 required for CMYK
                     }
 
                     //Lossy or loss-less?
@@ -315,23 +334,17 @@ public class AFPImageHandlerRenderedImag
                 log.debug("Encoding image via RGB...");
                 imageData = encodeViaRGB(renderedImage, imageObjectInfo, paintingState, baos);
             }
-
-            switch (functionSet) {
-            case 10:
-                imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS10);
-                break;
-            case 11:
-                imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS11);
-                break;
-            case 45:
-                imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45);
-                break;
-            default:
-                throw new IllegalStateException("Invalid IOCA function set: " + functionSet);
-            }
-
+            // Should image be FS45?
+            if (paintingState.getFS45()) {
+                functionSet = FunctionSet.FS45;
+            }
+            //Wrapping 300+ resolution FS11 IOCA in a page segment is apparently necessary(?)
+            imageObjectInfo.setCreatePageSegment(
+                    (functionSet.equals(FunctionSet.FS11) || functionSet.equals(FunctionSet.FS45))
+                    && paintingState.getWrapPSeg()
+            );
+            imageObjectInfo.setMimeType(functionSet.getMimeType());
             imageObjectInfo.setData(imageData);
-
             return imageObjectInfo;
         }
 

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=1325839&r1=1325838&r2=1325839&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 Fri Apr 13 16:49:35 2012
@@ -415,6 +415,14 @@ public class AFPRendererConfigurator ext
         customizable.canEmbedJpeg(allowEmbedding);
         customizable.setBitmapEncodingQuality(ieq);
 
+        //FS11 and FS45 page segment wrapping
+        boolean pSeg = imagesCfg.getAttributeAsBoolean("pseg", false);
+        customizable.setWrapPSeg(pSeg);
+
+        //FS45 image forcing
+        boolean fs45 = imagesCfg.getAttributeAsBoolean("fs45", false);
+        customizable.setFS45(fs45);
+
         // shading (filled rectangles)
         Configuration shadingCfg = cfg.getChild("shading");
         AFPShadingMode shadingMode = AFPShadingMode.valueOf(

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/AWTRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/AWTRenderer.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/AWTRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/AWTRenderer.java Fri Apr 13 16:49:35 2012
@@ -103,8 +103,9 @@ public class AWTRenderer extends Java2DR
 
     /**
      * {@inheritDoc}
+     * @throws FOPException thrown by java2DRenderer
      */
-    public void renderPage(PageViewport pageViewport) throws IOException {
+    public void renderPage(PageViewport pageViewport) throws IOException, FOPException {
 
         super.renderPage(pageViewport);
         if (statusListener != null) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java Fri Apr 13 16:49:35 2012
@@ -22,7 +22,7 @@ package org.apache.fop.render.intermedia
 import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.awt.geom.AffineTransform;
-import java.util.List;
+import java.util.ArrayList;
 
 import org.apache.xmlgraphics.java2d.GraphicContext;
 
@@ -33,7 +33,7 @@ public class IFGraphicContext extends Gr
 
     private static final AffineTransform[] EMPTY_TRANSFORM_ARRAY = new AffineTransform[0];
 
-    private List groupList = new java.util.ArrayList();
+    private ArrayList groupList = new ArrayList();
 
     /**
      * Default constructor.
@@ -48,17 +48,20 @@ public class IFGraphicContext extends Gr
      */
     protected IFGraphicContext(IFGraphicContext graphicContext) {
         super(graphicContext);
-        //We don't clone groupDepth!
+        // N.B. do not perform deep copy on groupList; doing so causes
+        // a junit regression... have not investigated cause... [GA]
+        // groupList = (ArrayList) graphicContext.groupList.clone();
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     public Object clone() {
-        return new IFGraphicContext(this);
+        return new IFGraphicContext ( this );
     }
 
     /** @param group a group */
     public void pushGroup(Group group) {
-        //this.groupDepth++;
         this.groupList.add(group);
         for (int i = 0, c = group.getTransforms().length; i < c; i++) {
             transform(group.getTransforms()[i]);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/java2d/Java2DRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/java2d/Java2DRenderer.java Fri Apr 13 16:49:35 2012
@@ -267,10 +267,15 @@ public abstract class Java2DRenderer ext
      * @param pageViewport the <code>PageViewport</code> object supplied by
      * the Area Tree
      * @throws IOException In case of an I/O error
+     * @throws FOPException if cloning of pageViewport is not supported
      * @see org.apache.fop.render.Renderer
      */
-    public void renderPage(PageViewport pageViewport) throws IOException {
-        rememberPage((PageViewport)pageViewport.clone());
+    public void renderPage(PageViewport pageViewport) throws IOException, FOPException {
+        try {
+            rememberPage((PageViewport)pageViewport.clone());
+        } catch (CloneNotSupportedException e) {
+            throw new FOPException(e);
+        }
         //The clone() call is necessary as we store the page for later. Otherwise, the
         //RenderPagesModel calls PageViewport.clear() to release memory as early as possible.
         currentPageNumber++;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java Fri Apr 13 16:49:35 2012
@@ -82,7 +82,7 @@ public class PDFDocumentNavigationHandle
         }
     }
 
-    private void renderBookmark(Bookmark bookmark, PDFOutline parent) {
+    private void renderBookmark(Bookmark bookmark, PDFOutline parent) throws IFException {
         if (parent == null) {
             parent = getPDFDoc().getOutlineRoot();
         }
@@ -141,7 +141,7 @@ public class PDFDocumentNavigationHandle
         }
     }
 
-    private PDFAction getAction(AbstractAction action) {
+    private PDFAction getAction(AbstractAction action) throws IFException {
         if (action == null) {
             return null;
         }
@@ -181,21 +181,27 @@ public class PDFDocumentNavigationHandle
         }
     }
 
-    private void updateTargetLocation(PDFGoTo pdfGoTo, GoToXYAction action) {
+    private void updateTargetLocation(PDFGoTo pdfGoTo, GoToXYAction action)
+      throws IFException {
         PageReference pageRef = this.documentHandler.getPageReference(action.getPageIndex());
-        //Convert target location from millipoints to points and adjust for different
-        //page origin
-        Point2D p2d = null;
-        p2d = new Point2D.Double(
-                action.getTargetLocation().x / 1000.0,
-                (pageRef.getPageDimension().height - action.getTargetLocation().y) / 1000.0);
-        String pdfPageRef = pageRef.getPageRef();
-        pdfGoTo.setPageReference(pdfPageRef);
-        pdfGoTo.setPosition(p2d);
-
-        //Queue this object now that it's complete
-        getPDFDoc().addObject(pdfGoTo);
-        this.completeActions.put(action.getID(), pdfGoTo);
+        if ( pageRef == null ) {
+            throw new
+                IFException("Can't resolve page reference @ index: " + action.getPageIndex(), null);
+        } else {
+            //Convert target location from millipoints to points and adjust for different
+            //page origin
+            Point2D p2d = null;
+            p2d = new Point2D.Double(
+                    action.getTargetLocation().x / 1000.0,
+                    (pageRef.getPageDimension().height - action.getTargetLocation().y) / 1000.0);
+            String pdfPageRef = pageRef.getPageRef();
+            pdfGoTo.setPageReference(pdfPageRef);
+            pdfGoTo.setPosition(p2d);
+
+            //Queue this object now that it's complete
+            getPDFDoc().addObject(pdfGoTo);
+            this.completeActions.put(action.getID(), pdfGoTo);
+        }
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/NativeTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/NativeTextHandler.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/NativeTextHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/NativeTextHandler.java Fri Apr 13 16:49:35 2012
@@ -31,7 +31,6 @@ import org.apache.xmlgraphics.ps.PSGener
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontSetup;
-import org.apache.fop.fonts.FontTriplet;
 
 /**
  * Specialized TextHandler implementation that the PSGraphics2D class delegates to to paint text
@@ -160,26 +159,14 @@ public class NativeTextHandler implement
     }
 
     private Font createFont(java.awt.Font f) {
-        String fontFamily = f.getFamily();
-        if (fontFamily.equals("sanserif")) {
-            fontFamily = "sans-serif";
-        }
-        int fontSize = 1000 * f.getSize();
-        String style = f.isItalic() ? "italic" : "normal";
-        int weight = f.isBold() ? Font.WEIGHT_BOLD : Font.WEIGHT_NORMAL;
-
-        FontTriplet triplet = fontInfo.findAdjustWeight(fontFamily, style, weight);
-        if (triplet == null) {
-            triplet = fontInfo.findAdjustWeight("sans-serif", style, weight);
-        }
-        return fontInfo.getFontInstance(triplet, fontSize);
+        return fontInfo.getFontInstanceForAWTFont(f);
     }
 
     private void establishCurrentFont() throws IOException {
         if ((currentFontName != this.font.getFontName())
                 || (currentFontSize != this.font.getFontSize())) {
             PSGenerator gen = getPSGenerator();
-            gen.writeln(this.font.getFontName() + " "
+            gen.writeln("/" + this.font.getFontTriplet().getName() + " "
                     + gen.formatDouble(font.getFontSize() / 1000f) + " F");
             currentFontName = this.font.getFontName();
             currentFontSize = this.font.getFontSize();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/RTFHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/RTFHandler.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/RTFHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/RTFHandler.java Fri Apr 13 16:49:35 2012
@@ -119,6 +119,7 @@ import org.apache.fop.render.rtf.rtflib.
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem.RtfListItemLabel;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfPage;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraphBreak;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;
@@ -430,8 +431,14 @@ public class RTFHandler extends FOEventH
                     true, this);
 
             RtfTextrun textrun = container.getTextrun();
+            RtfParagraphBreak par = textrun.addParagraphBreak();
+
+            RtfTableCell cellParent = (RtfTableCell)textrun.getParentOfClass(RtfTableCell.class);
+            if (cellParent != null && par != null) {
+                int iDepth = cellParent.findChildren(textrun);
+                cellParent.setLastParagraph(par, iDepth);
+            }
 
-            textrun.addParagraphBreak();
             int breakValue = toRtfBreakValue(bl.getBreakAfter());
             textrun.popBlockAttributes(breakValue);
 
@@ -878,6 +885,14 @@ public class RTFHandler extends FOEventH
         if (bDefer) {
             return;
         }
+        try {
+            RtfTableCell cell = (RtfTableCell)builderContext.getContainer(RtfTableCell.class, false, this);
+            cell.finish();
+
+        } catch (Exception e) {
+            log.error("endCell: " + e.getMessage());
+            throw new RuntimeException(e.getMessage());
+        }
 
         builderContext.popContainer();
         builderContext.getTableContext().selectNextColumn();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java Fri Apr 13 16:49:35 2012
@@ -28,6 +28,8 @@ package org.apache.fop.render.rtf.rtflib
 
 import java.io.IOException;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * <p>Interface for RtfElements that can contain RtfText elements.</p>
  *
@@ -61,6 +63,7 @@ public interface IRtfTextContainer {
     /**
      * Text containers usually provide default attributes for all texts that they contain.
      * @return a copy of the container's attributes.
+     * @throws FOPException if attributes cannot be obtained
      */
-    RtfAttributes getTextContainerAttributes();
+    RtfAttributes getTextContainerAttributes() throws FOPException;
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java Fri Apr 13 16:49:35 2012
@@ -39,8 +39,8 @@ import org.xml.sax.helpers.AttributesImp
  * <p>This work was authored by Bertrand Delacretaz (bdelacretaz@codeconsult.ch).</p>
  */
 
-public class RtfAttributes
-implements java.lang.Cloneable {
+public class RtfAttributes implements Cloneable {
+
     private HashMap values = new HashMap();
 
     /**
@@ -108,12 +108,9 @@ implements java.lang.Cloneable {
         return values.toString() + "(" + super.toString() + ")";
     }
 
-    /**
-     * implement cloning
-     * @return cloned Object
-     */
-    public Object clone() {
-        final RtfAttributes result = new RtfAttributes();
+    /** {@inheritDoc} */
+    public Object clone() throws CloneNotSupportedException {
+        RtfAttributes result = (RtfAttributes) super.clone();
         result.values = (HashMap)values.clone();
 
         // Added by Normand Masse

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java Fri Apr 13 16:49:35 2012
@@ -112,6 +112,30 @@ public class RtfContainer extends RtfEle
         return children.size();
     }
 
+    private int findChildren(RtfElement aChild, int iStart) {
+        for (Iterator it = this.getChildren().iterator(); it.hasNext();) {
+          final RtfElement e = (RtfElement)it.next();
+          if (aChild == e) {
+              return iStart;
+          } else if (e instanceof RtfContainer) {
+              int iFound = ((RtfContainer)e).findChildren(aChild, (iStart + 1));
+              if (iFound != -1) {
+                  return iFound;
+              }
+          }
+        }
+        return -1;
+    }
+
+    /**
+     * Find the passed child in the current container
+     * @param aChild the child element
+     * @return the depth (nested level) inside the current container
+     */
+    public int findChildren(RtfElement aChild) {
+        return findChildren(aChild, 0);
+    }
+
     /**
      * Add by Boris Poudérous on 07/22/2002
      * Set the children list

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java Fri Apr 13 16:49:35 2012
@@ -299,7 +299,7 @@ public abstract class RtfElement {
     /** find the first parent where c.isAssignableFrom(parent.getClass()) is true
      *  @return null if not found
      */
-    RtfElement getParentOfClass(Class c) {
+    public RtfElement getParentOfClass(Class c) {
         RtfElement result = null;
         RtfElement current = this;
         while (current.parent != null) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java Fri Apr 13 16:49:35 2012
@@ -29,6 +29,8 @@ package org.apache.fop.render.rtf.rtflib
 import java.io.IOException;
 import java.io.Writer;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * <p>Creates an hyperlink.
  * This class belongs to the <fo:basic-link> tag processing.</p>
@@ -157,12 +159,17 @@ implements IRtfTextContainer,
     /**
      * IRtfTextContainer requirement:
      * @return a copy of our attributes
+     * @throws FOPException if attributes cannot be cloned
      */
-    public RtfAttributes getTextContainerAttributes() {
+    public RtfAttributes getTextContainerAttributes() throws FOPException {
         if (attrib == null) {
             return null;
         }
-        return (RtfAttributes) this.attrib.clone ();
+        try {
+            return (RtfAttributes) this.attrib.clone ();
+        } catch (CloneNotSupportedException e) {
+            throw new FOPException(e);
+        }
     }
 
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java Fri Apr 13 16:49:35 2012
@@ -30,6 +30,8 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.List;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * <p>Model of an RTF paragraph, which can contain RTF text elements.</p>
  *
@@ -93,12 +95,17 @@ implements IRtfTextContainer, IRtfPageBr
     /**
      * IRtfTextContainer requirement: return a copy of our attributes
      * @return a copy of this paragraphs attributes
+     * @throws FOPException if attributes cannot be cloned
      */
-    public RtfAttributes getTextContainerAttributes() {
+    public RtfAttributes getTextContainerAttributes() throws FOPException {
         if (attrib == null) {
             return null;
         }
-        return (RtfAttributes)this.attrib.clone();
+        try {
+            return (RtfAttributes)this.attrib.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new FOPException(e);
+        }
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java Fri Apr 13 16:49:35 2012
@@ -29,6 +29,8 @@ package org.apache.fop.render.rtf.rtflib
 import java.io.IOException;
 import java.io.Writer;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * <p>Container for RtfRow elements.</p>
  *
@@ -86,11 +88,16 @@ public class RtfTable extends RtfContain
      * @param attrs attributs of new RtfTableRow
      * @return new RtfTableRow
      * @throws IOException for I/O problems
+     * @throws FOPException if attributes cannot be cloned
      */
-    public RtfTableRow newTableRow(RtfAttributes attrs) throws IOException {
+    public RtfTableRow newTableRow(RtfAttributes attrs) throws IOException, FOPException {
         RtfAttributes attr = null;
         if (attrib != null) {
-            attr = (RtfAttributes) attrib.clone ();
+            try {
+                attr = (RtfAttributes) attrib.clone ();
+            } catch (CloneNotSupportedException e) {
+                throw new FOPException(e);
+            }
             attr.set (attrs);
         } else {
             attr = attrs;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java Fri Apr 13 16:49:35 2012
@@ -48,6 +48,11 @@ public class RtfTableCell
     private boolean setCenter;
     private boolean setRight;
     private int id;
+    private RtfParagraphBreak lastBreak = null;
+    private int lastBreakDepth = Integer.MIN_VALUE;
+
+    private static final String TABLE_CELL_PARAGRAPH = "cell";
+    private static final String TABLE_CELL_NESTED_PARAGRAPH = "nestcell";
 
     /** default cell width (in twips ??) */
     public static final int DEFAULT_CELL_WIDTH = 2000;
@@ -312,7 +317,9 @@ public class RtfTableCell
 
         if (getRow().getTable().isNestedTable()) {
             //nested table
-            writeControlWordNS("nestcell");
+            if (lastBreak == null) {
+                writeControlWordNS("nestcell");
+            }
             writeGroupMark(true);
             writeControlWord("nonesttables");
             writeControlWord("par");
@@ -352,7 +359,9 @@ public class RtfTableCell
                 //writeControlWord("par");
             }
 
-            writeControlWord("cell");
+            if (lastBreak == null) {
+                writeControlWord("cell");
+            }
         }
     }
 
@@ -535,4 +544,38 @@ public class RtfTableCell
 
         return null;
     }
+
+    /**
+     * The table cell decides whether or not a newly added paragraph break
+     * will be used to write the cell-end control word.
+     * For nested tables it is not necessary.
+     *
+     * @param parBreak the paragraph break element
+     * @param breakDepth The depth is necessary for picking the correct break element.
+     * If it is deeper inside the whole cell it will be used, and if there is something on
+     * the same level (depth) it is also set because the method is called for all breaks
+     * in the correct order.
+     */
+    public void setLastParagraph(RtfParagraphBreak parBreak, int breakDepth) {
+        if (parBreak != null && breakDepth >= lastBreakDepth) {
+            lastBreak = parBreak;
+            lastBreakDepth = breakDepth;
+        }
+    }
+
+    /**
+     * The last paragraph break was just stored before,
+     * now the control word is really switched
+     */
+    public void finish() {
+      //If it is nested and contains another table do not set it
+      if (getRow().getTable().isNestedTable() && table != null) {
+          lastBreak = null;
+      } else if (lastBreak != null) {
+              lastBreak.switchControlWord(
+                                          getRow().getTable().isNestedTable()
+                                          ? TABLE_CELL_NESTED_PARAGRAPH
+                                          : TABLE_CELL_PARAGRAPH);
+      }
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java Fri Apr 13 16:49:35 2012
@@ -30,6 +30,8 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.Iterator;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * <p>Container for RtfTableCell elements.</p>
  *
@@ -106,15 +108,20 @@ public class RtfTableRow extends RtfCont
      * @param cellWidth width of new cell
      * @return new RtfTableCell
      * @throws IOException for I/O problems
+     * @throws FOPException if attributes cannot be cloned
      */
     public RtfTableCell newTableCellMergedHorizontally (int cellWidth,
-           RtfAttributes attrs) throws IOException {
+           RtfAttributes attrs) throws IOException, FOPException {
         highestCell++;
         // Added by Normand Masse
         // Inherit attributes from base cell for merge
         RtfAttributes wAttributes = null;
         if (attrs != null) {
-            wAttributes = (RtfAttributes)attrs.clone();
+            try {
+                wAttributes = (RtfAttributes)attrs.clone();
+            } catch (CloneNotSupportedException e) {
+                throw new FOPException(e);
+            }
         }
 
         cell = new RtfTableCell(this, writer, cellWidth, wAttributes, highestCell);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java Fri Apr 13 16:49:35 2012
@@ -29,6 +29,8 @@ package org.apache.fop.render.rtf.rtflib
 import java.io.IOException;
 import java.io.Writer;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * <p>Model of a text run (a piece of text with attributes) in an RTF document.</p>
  *
@@ -240,12 +242,18 @@ public class RtfText extends RtfElement 
     }
 
     /** IRtfTextContainer requirement:
-     * @return a copy of our attributes */
-    public RtfAttributes getTextContainerAttributes() {
+     * @return a copy of our attributes
+     * @throws FOPException if attributes cannot be cloned
+     */
+    public RtfAttributes getTextContainerAttributes() throws FOPException {
         if (attrib == null) {
             return null;
         }
-        return (RtfAttributes)this.attrib.clone();
+        try {
+            return (RtfAttributes)this.attrib.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new FOPException(e);
+        }
     }
 
     /** direct access to our text */

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java Fri Apr 13 16:49:35 2012
@@ -144,30 +144,6 @@ public class RtfTextrun extends RtfConta
         }
     }
 
-    /**  Class which represents a paragraph break.*/
-    private class RtfParagraphBreak extends RtfElement {
-
-        RtfParagraphBreak(RtfContainer parent, Writer w)
-                throws IOException {
-            super(parent, w);
-        }
-
-        /**
-         * @return true if this element would generate no "useful" RTF content
-         */
-        public boolean isEmpty() {
-            return false;
-        }
-
-        /**
-         * write RTF code of all our children
-         * @throws IOException for I/O problems
-         */
-        protected void writeRtfContent() throws IOException {
-            writeControlWord("par");
-        }
-    }
-
     /** Create an RTF container as a child of given container */
     RtfTextrun(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException {
         super(parent, w, attrs);
@@ -291,32 +267,35 @@ public class RtfTextrun extends RtfConta
      * Inserts paragraph break before all close group marks.
      *
      * @throws IOException  for I/O problems
+     * @return The paragraph break element
      */
-    public void addParagraphBreak() throws IOException {
-      // get copy of children list
-      List children = getChildren();
-      Stack tmp = new Stack();
-
-      // delete all previous CloseGroupMark
-      int deletedCloseGroupCount = 0;
-
-      ListIterator lit = children.listIterator(children.size());
-      while (lit.hasPrevious()
-              && (lit.previous() instanceof RtfCloseGroupMark)) {
-          tmp.push(Integer.valueOf(((RtfCloseGroupMark)lit.next()).getBreakType()));
-          lit.remove();
-          deletedCloseGroupCount++;
-      }
-
-      if (children.size() != 0) {
-          // add paragraph break and restore all deleted close group marks
-          setChildren(children);
-          new RtfParagraphBreak(this, writer);
-          for (int i = 0; i < deletedCloseGroupCount; i++) {
-              addCloseGroupMark(((Integer)tmp.pop()).intValue());
-          }
-      }
-  }
+    public RtfParagraphBreak addParagraphBreak() throws IOException {
+        // get copy of children list
+        List children = getChildren();
+        Stack tmp = new Stack();
+        RtfParagraphBreak par = null;
+
+        // delete all previous CloseGroupMark
+        int deletedCloseGroupCount = 0;
+
+        ListIterator lit = children.listIterator(children.size());
+        while (lit.hasPrevious()
+                && (lit.previous() instanceof RtfCloseGroupMark)) {
+            tmp.push(Integer.valueOf(((RtfCloseGroupMark)lit.next()).getBreakType()));
+            lit.remove();
+            deletedCloseGroupCount++;
+        }
+
+        if (children.size() != 0) {
+            // add paragraph break and restore all deleted close group marks
+            setChildren(children);
+            par = new RtfParagraphBreak(this, writer);
+            for (int i = 0; i < deletedCloseGroupCount; i++) {
+                addCloseGroupMark(((Integer)tmp.pop()).intValue());
+            }
+        }
+        return par;
+    }
 
     /**
      * Inserts a leader.
@@ -486,6 +465,8 @@ public class RtfTextrun extends RtfConta
              * child.
              * -If the RtfTextrun is the last child of its parent, write a
              * RtfParagraphBreak only, if it is not the last child.
+             * -If the RtfParagraphBreak can not be hidden (e.g. a table cell requires it)
+             * it is also written
              */
             boolean bHide = false;
             bHide = bRtfParagraphBreak;
@@ -494,7 +475,8 @@ public class RtfTextrun extends RtfConta
                     || bFirst
                     || (bSuppressLastPar && bLast && lastParagraphBreak != null
                         && e == lastParagraphBreak)
-                    || bBookmark);
+                    || bBookmark)
+                && ((RtfParagraphBreak)e).canHide();
 
             if (!bHide) {
                 newLine();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java Fri Apr 13 16:49:35 2012
@@ -29,6 +29,7 @@ import org.apache.fop.datatypes.PercentB
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.flow.table.Table;
+import org.apache.fop.fo.flow.table.TableColumn;
 import org.apache.fop.fo.pagination.PageSequence;
 
 /**
@@ -59,6 +60,13 @@ public class PercentContext implements P
         if (fobj == null) {
             return 0;
         }
+
+        // Special handler for TableColumn width specifications, needs to be
+        // relative to the parent!
+        if ( ( fobj instanceof TableColumn ) && ( fobj.getParent() instanceof FObj ) ) {
+            fobj = (FObj) fobj.getParent();
+        }
+
         switch (lengthBase) {
         case LengthBase.CONTAINING_BLOCK_WIDTH:
         case LengthBase.PARENT_AREA_WIDTH:
@@ -66,12 +74,27 @@ public class PercentContext implements P
             Object width = lengthMap.get(fobj);
             if (width != null) {
                 return Integer.parseInt(width.toString());
-            } else {
-                return -1;
+            } else if (fobj.getParent() != null) {
+              // If the object itself has no width the parent width will be used
+              // because it is the base width of this object
+              width = lengthMap.get(fobj.getParent());
+              if (width != null) {
+                return Integer.parseInt(width.toString());
+              }
             }
+            return 0;
         case LengthBase.TABLE_UNITS:
             Object unit = tableUnitMap.get(fobj);
-            return (unit != null) ? ((Integer)unit).intValue() : 0;
+            if (unit != null) {
+                return ((Integer)unit).intValue();
+            } else if (fobj.getParent() != null) {
+              // If the object itself has no width the parent width will be used
+              unit = tableUnitMap.get(fobj.getParent());
+              if (unit != null) {
+                return ((Integer)unit).intValue();
+              }
+            }
+            return 0;
         default:
             log.error(new Exception("Unsupported base type for LengthBase:" + lengthBase));
             return 0;

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=1325839&r1=1325838&r2=1325839&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 Fri Apr 13 16:49:35 2012
@@ -72,6 +72,9 @@ public class TXTRenderer extends Abstrac
     /** Buffer for background and images. */
     private StringBuffer[] decoData;
 
+    /** Leading of line containing Courier font size of 10pt. */
+    public static final int LINE_LEADING = 1070;
+
     /** Height of one symbol in Courier font size of 10pt. */
     public static final int CHAR_HEIGHT = 7860;
 
@@ -192,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, CHAR_HEIGHT);
+        int row = Helper.ceilPosition(this.currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2*LINE_LEADING);
 
         String s = area.getText();
 
@@ -216,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);
+        pageHeight = Helper.ceilPosition((int) height, CHAR_HEIGHT + 2*LINE_LEADING);
 
         // init buffers
         charData = new StringBuffer[pageHeight];
@@ -460,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, CHAR_HEIGHT);
+        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);
+        int height = Helper.ceilPosition((int) pos.getHeight(), CHAR_HEIGHT + 2*LINE_LEADING);
 
         fillRect(x1, y1, width, height, IMAGE_CHAR);
     }
@@ -559,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));
+        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));
+        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/tools/anttasks/FileCompare.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/tools/anttasks/FileCompare.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/tools/anttasks/FileCompare.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/tools/anttasks/FileCompare.java Fri Apr 13 16:49:35 2012
@@ -126,7 +126,7 @@ public class FileCompare {
      */
     private static boolean compareFileSize(File oldFile, File newFile) {
         return oldFile.length() == newFile.length();
-    }    // end: compareBytes
+    }
 
     private boolean filesExist(File oldFile, File newFile) {
         if (!oldFile.exists()) {

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:r1307576-1325837

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/util/XMLResourceBundle.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/util/XMLResourceBundle.java?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/util/XMLResourceBundle.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/util/XMLResourceBundle.java Fri Apr 13 16:49:35 2012
@@ -117,7 +117,7 @@ public class XMLResourceBundle extends R
         if (baseName == null) {
             throw new NullPointerException("baseName must not be null");
         }
-
+        assert locale != null;
         ResourceBundle bundle;
         if (!locale.equals(Locale.getDefault())) {
             bundle = handleGetXMLBundle(baseName, "_" + locale, false, loader);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml?rev=1325839&r1=1325838&r2=1325839&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml Fri Apr 13 16:49:35 2012
@@ -62,12 +62,80 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <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">
+        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">
+        A global setting to wrap F11 images in page segments.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="52763">
+        Support list-block in marker, thus preventing NPE.
+      </action>
+      <action context="Code" dev="GA" type="fix">
+        Must use unqualified (local name) when reporting invalid child error.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="53065">
+        Restore lookup on Event message lookup field part. Add locale field to Event to
+        enable locale dependent deferred bundle load during lookup field part substitution.
+      </action>
+      <action context="Code" dev="MH" type="fix">
+        Bug in AFP font metrics that performed integer arithmetic when it should have been
+	double arithemetic.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="49754" due-to="Simon Pepping">
+        Bring clone() in line with the recommendations in Object.clone().
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="52966" due-to="Luis Bernardo">
+        How to use native text with EPSDocumentGraphics2D.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="51599" due-to="Paul Huemer">
+        Allow https scheme URI for PDF external action target.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="50901" due-to="Carsten Pfeiffer">
+        RTF percentage table column width not calculated from table.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="51009" due-to="Max Aster">
+        RTF generates unexpected lines for blocks in tables. Also fix three findbugs issues.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="51007" due-to="Max Aster">
+        RTF tables do not support percent column-widths.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="50435" due-to="Armin Haaf">
+        Access denied (java.util.PropertyPermission org.apache.fop.fo.properties.use-cache read).
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="49763" due-to="Adrian Buza">
+        Incorrect message when encountering a block in an inline in a footnote.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="47380" due-to="Georg Datterl">
+        Specified rule-thickness applies only when leader-pattern is rule, otherwise should use default thickness.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="49302" due-to="Julien Aymé">
+        Eliminate duplicate code.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="49350" due-to="Julien Aymé">
+        Correct coding error in AFPResourceLevel#equals.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="51836" due-to="Melanie Drake">
+        Throw IFException instead of NPE if navigation target (page reference) doesn't exist.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="51808" due-to="Sergey Vladimirov">
+        Fixed memory waste in traits map.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="51807" due-to="Sergey Vladimirov">
+        Fixed small memory waste in rowCells array construction.
+      </action>
+      <action context="Code" dev="GA" type="fix" fixes-bug="53005" due-to="Alberto Simões">
+        Fixed incorrect rejection of fo:wrapper inside fo:inline inside fo:footnote-body.
+      </action>
       <action context="Code" dev="PH,VH" type="add">
         Added support for PDF Object Streams. When accessibility is enabled and PDF version 1.5 
         selected, the structure tree will be stored in object streams in order to reduce the size of 
         the final PDF.
       </action>
-      <action context="Code" dev="VH" type="add" fixes-bug="46962" due-to="Alexios Giotis">
+      <action context="Code" dev="VH" type="fix" fixes-bug="46962" due-to="Alexios Giotis">
         Fixed deadlock in PropertyCache.
       </action>
       <action context="Code" dev="VH" type="add" fixes-bug="51385" due-to="Mehdi Houshmand">
@@ -297,9 +365,9 @@
         Bugfix: fix performance issue when adding nodes, if the number of children
         is significantly large.
       </action>
-	  <action context="Config" dev="SP" type="fix">
-		Bugfix: relative URIs in the configuration file (base, font-base, hyphenation-base) are evaluated relative to the base URI of the configuration file.
-	  </action>
+      <action context="Config" dev="SP" type="fix">
+	Bugfix: relative URIs in the configuration file (base, font-base, hyphenation-base) are evaluated relative to the base URI of the configuration file.
+      </action>
       <action context="Layout" dev="AD" type="fix" fixes-bug="49848">
         Bugfix: correct behavior of keep-together.within-line in case there are nested inlines
       </action>



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