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 je...@apache.org on 2008/03/06 14:34:59 UTC

svn commit: r634267 [12/39] - in /xmlgraphics/fop/branches/Temp_ProcessingFeedback: ./ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/intermediate/ examples/embedding/xml/xml/ examples/fo/ examples/fo/advanced/...

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DAdapter.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DAdapter.java Thu Mar  6 05:33:44 2008
@@ -1,50 +1,50 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
- 
-package org.apache.fop.render;
-
-import java.io.IOException;
-
-/**
- * This interface represents an optional feature that can be provided by
- * a renderer. It is exposed by calling the getGraphics2DAdapter() method
- * on the renderer. Renderers that support this feature allow painting
- * of arbitrary images through a Graphics2D instance.
- */
-public interface Graphics2DAdapter {
-
-    /**
-     * Paints an arbitrary images on a given Graphics2D instance. The renderer
-     * providing this functionality must set up a Graphics2D instance so that
-     * the image with the given extents (in mpt) can be painted by the painter
-     * passed to this method. The Graphics2DImagePainter is then passed this
-     * Graphics2D instance so the image can be painted.
-     * @param painter the painter which will paint the actual image
-     * @param context the renderer context for the current renderer
-     * @param x X position of the image
-     * @param y Y position of the image
-     * @param width width of the image
-     * @param height height of the image
-     * @throws IOException In case of an I/O error while writing the output format
-     */
-    void paintImage(org.apache.xmlgraphics.java2d.Graphics2DImagePainter painter, 
-            RendererContext context,
-            int x, int y, int width, int height) throws IOException;
-    
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+ 
+package org.apache.fop.render;
+
+import java.io.IOException;
+
+/**
+ * This interface represents an optional feature that can be provided by
+ * a renderer. It is exposed by calling the getGraphics2DAdapter() method
+ * on the renderer. Renderers that support this feature allow painting
+ * of arbitrary images through a Graphics2D instance.
+ */
+public interface Graphics2DAdapter {
+
+    /**
+     * Paints an arbitrary images on a given Graphics2D instance. The renderer
+     * providing this functionality must set up a Graphics2D instance so that
+     * the image with the given extents (in mpt) can be painted by the painter
+     * passed to this method. The Graphics2DImagePainter is then passed this
+     * Graphics2D instance so the image can be painted.
+     * @param painter the painter which will paint the actual image
+     * @param context the renderer context for the current renderer
+     * @param x X position of the image
+     * @param y Y position of the image
+     * @param width width of the image
+     * @param height height of the image
+     * @throws IOException In case of an I/O error while writing the output format
+     */
+    void paintImage(org.apache.xmlgraphics.java2d.Graphics2DImagePainter painter, 
+            RendererContext context,
+            int x, int y, int width, int height) throws IOException;
+    
+}

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DImagePainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DImagePainter.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DImagePainter.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DImagePainter.java Thu Mar  6 05:33:44 2008
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
- 
-package org.apache.fop.render;
-
-/**
- * This interface is used by the Graphics2DAdapter. Components that can paint using
- * a Graphics2D instance can implement this interface to paint themselves.
- * @deprecated use {@link org.apache.xmlgraphics.java2d.Graphics2DImagePainter} directly!
- */
-public interface Graphics2DImagePainter
-        extends org.apache.xmlgraphics.java2d.Graphics2DImagePainter {
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+ 
+package org.apache.fop.render;
+
+/**
+ * This interface is used by the Graphics2DAdapter. Components that can paint using
+ * a Graphics2D instance can implement this interface to paint themselves.
+ * @deprecated use {@link org.apache.xmlgraphics.java2d.Graphics2DImagePainter} directly!
+ */
+public interface Graphics2DImagePainter
+        extends org.apache.xmlgraphics.java2d.Graphics2DImagePainter {
+
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Graphics2DImagePainter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/ImageAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/ImageAdapter.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/ImageAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/ImageAdapter.java Thu Mar  6 05:33:44 2008
@@ -1,47 +1,47 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
- 
-package org.apache.fop.render;
-
-import java.awt.image.RenderedImage;
-import java.io.IOException;
-
-/**
- * This interface represents an optional feature that can be provided by
- * a renderer. It is exposed by calling the getImageAdapter() method
- * on the renderer. Renderers that support this feature allow painting
- * of images (RendererImage instances).
- */
-public interface ImageAdapter {
-
-    /**
-     * Paints an image at the given position.
-     * @param image the image which will be painted
-     * @param context the renderer context for the current renderer
-     * @param x X position of the image
-     * @param y Y position of the image
-     * @param width width of the image
-     * @param height height of the image
-     * @throws IOException In case of an I/O error while writing the output format
-     */
-    void paintImage(RenderedImage image, 
-            RendererContext context,
-            int x, int y, int width, int height) throws IOException;
-    
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+ 
+package org.apache.fop.render;
+
+import java.awt.image.RenderedImage;
+import java.io.IOException;
+
+/**
+ * This interface represents an optional feature that can be provided by
+ * a renderer. It is exposed by calling the getImageAdapter() method
+ * on the renderer. Renderers that support this feature allow painting
+ * of images (RendererImage instances).
+ */
+public interface ImageAdapter {
+
+    /**
+     * Paints an image at the given position.
+     * @param image the image which will be painted
+     * @param context the renderer context for the current renderer
+     * @param x X position of the image
+     * @param y Y position of the image
+     * @param width width of the image
+     * @param height height of the image
+     * @throws IOException In case of an I/O error while writing the output format
+     */
+    void paintImage(RenderedImage image, 
+            RendererContext context,
+            int x, int y, int width, int height) throws IOException;
+    
+}

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/ImageAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/ImageAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRenderer.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRenderer.java Thu Mar  6 05:33:44 2008
@@ -78,7 +78,7 @@
     }
 
     /**
-     * Returns the internal font key fot a font triplet coming from the area tree
+     * Returns the internal font key for a font triplet coming from the area tree
      * @param area the area from which to retrieve the font triplet information
      * @return the internal font key (F1, F2 etc.) or null if not found
      */

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRendererConfigurator.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRendererConfigurator.java Thu Mar  6 05:33:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.render;
 

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/PrintRendererConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Renderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Renderer.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Renderer.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/Renderer.java Thu Mar  6 05:33:44 2008
@@ -20,16 +20,16 @@
 package org.apache.fop.render;
 
 // Java
-import java.io.OutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 
-// FOP
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.area.PageViewport;
+import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.LineArea;
 import org.apache.fop.area.OffDocumentItem;
+import org.apache.fop.area.PageSequence;
+import org.apache.fop.area.PageViewport;
 import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.apps.FOUserAgent;
 
 
 /**
@@ -142,8 +142,16 @@
      * Tells the renderer that a new page sequence starts.
      *
      * @param seqTitle  The title of the page sequence
+     * @deprecated Use startPageSequence(PageSequence) instead
      */
     void startPageSequence(LineArea seqTitle);
+
+    /**
+     * Tells the renderer that a new page sequence starts.
+     *
+     * @param pageSequence the page sequence
+     */
+    void startPageSequence(PageSequence pageSequence);
 
     /**
      * Tells the renderer to render a particular page. A renderer typically

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/RendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/RendererConfigurator.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/RendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/RendererConfigurator.java Thu Mar  6 05:33:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.render;
 

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/RendererConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/RendererFactory.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerConfigurator.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerConfigurator.java Thu Mar  6 05:33:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.render;
 

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerRegistry.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerRegistry.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerRegistry.java Thu Mar  6 05:33:44 2008
@@ -1,166 +1,166 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.xmlgraphics.util.Service;
-
-/**
- * This class holds references to various XML handlers used by FOP. It also
- * supports automatic discovery of additional XML handlers available through
- * the class path.
- */
-public class XMLHandlerRegistry {
-
-    /** the logger */
-    private static Log log = LogFactory.getLog(XMLHandlerRegistry.class);
-    
-    /** Map containing XML handlers for various document types */
-    private Map handlers = new java.util.HashMap();
-    
-    /**
-     * Default constructor.
-     */
-    public XMLHandlerRegistry() {
-        discoverXMLHandlers();
-    }
-    
-    /**
-     * Add a default XML handler which is able to handle any namespace.
-     * @param handler XMLHandler to use
-     */
-    private void setDefaultXMLHandler(XMLHandler handler) {
-        addXMLHandler(XMLHandler.HANDLE_ALL, handler);
-    }
-    
-    /**
-     * Add an XML handler. The handler itself is inspected to find out what it supports.
-     * @param classname the fully qualified class name
-     */
-    public void addXMLHandler(String classname) {
-        try {
-            XMLHandler handlerInstance = (XMLHandler)Class.forName(classname).newInstance();
-            addXMLHandler(handlerInstance);
-        } catch (ClassNotFoundException e) {
-            throw new IllegalArgumentException("Could not find "
-                                               + classname);
-        } catch (InstantiationException e) {
-            throw new IllegalArgumentException("Could not instantiate "
-                                               + classname);
-        } catch (IllegalAccessException e) {
-            throw new IllegalArgumentException("Could not access "
-                                               + classname);
-        } catch (ClassCastException e) {
-            throw new IllegalArgumentException(classname
-                                               + " is not an " 
-                                               + XMLHandler.class.getName());
-        }
-    }
-    
-    /**
-     * Add an XML handler. The handler itself is inspected to find out what it supports.
-     * @param handler the XMLHandler instance
-     */
-    public void addXMLHandler(XMLHandler handler) {
-        String ns = handler.getNamespace();
-        if (ns == null) {
-            setDefaultXMLHandler(handler);
-        } else {
-            addXMLHandler(ns, handler);
-        }
-    }
-    
-    /**
-     * Add an XML handler for the given MIME type and XML namespace.
-     * @param ns Namespace URI
-     * @param handler XMLHandler to use
-     */
-    private void addXMLHandler(String ns,
-                              XMLHandler handler) {
-        List lst = (List)handlers.get(ns);
-        if (lst == null) {
-            lst = new java.util.ArrayList();
-            handlers.put(ns, lst);
-        }
-        lst.add(handler);
-    }
-    
-    /**
-     * Returns an XMLHandler which handles an XML dialect of the given namespace and for
-     * a specified output format defined by its MIME type.
-     * @param renderer the Renderer for which to retrieve a Renderer
-     * @param ns the XML namespace associated with the XML to be rendered
-     * @return the XMLHandler responsible for handling the XML or null if none is available
-     */
-    public XMLHandler getXMLHandler(Renderer renderer, String ns) {
-        XMLHandler handler;
-
-        List lst = (List)handlers.get(ns);
-        handler = getXMLHandler(renderer, lst);
-        if (handler == null) {
-            lst = (List)handlers.get(XMLHandler.HANDLE_ALL);
-            handler = getXMLHandler(renderer, lst);
-        }
-        return handler;
-    }
-
-    private XMLHandler getXMLHandler(Renderer renderer, List lst) {
-        XMLHandler handler;
-        if (lst != null) {
-            for (int i = 0, c = lst.size(); i < c; i++) {
-                //TODO Maybe add priorities later
-                handler = (XMLHandler)lst.get(i);
-                if (handler.supportsRenderer(renderer)) {
-                    return handler;
-                }
-            }
-        }
-        return null; //No handler found
-    }
-    
-    /**
-     * Discovers XMLHandler implementations through the classpath and dynamically
-     * registers them.
-     */
-    private void discoverXMLHandlers() {
-        // add mappings from available services
-        Iterator providers = Service.providers(XMLHandler.class);
-        if (providers != null) {
-            while (providers.hasNext()) {
-                XMLHandler handler = (XMLHandler)providers.next();
-                try {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Dynamically adding XMLHandler: " + handler.getClass().getName());
-                    }
-                    addXMLHandler(handler);
-                } catch (IllegalArgumentException e) {
-                    log.error("Error while adding XMLHandler", e);
-                }
-
-            }
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.xmlgraphics.util.Service;
+
+/**
+ * This class holds references to various XML handlers used by FOP. It also
+ * supports automatic discovery of additional XML handlers available through
+ * the class path.
+ */
+public class XMLHandlerRegistry {
+
+    /** the logger */
+    private static Log log = LogFactory.getLog(XMLHandlerRegistry.class);
+    
+    /** Map containing XML handlers for various document types */
+    private Map handlers = new java.util.HashMap();
+    
+    /**
+     * Default constructor.
+     */
+    public XMLHandlerRegistry() {
+        discoverXMLHandlers();
+    }
+    
+    /**
+     * Add a default XML handler which is able to handle any namespace.
+     * @param handler XMLHandler to use
+     */
+    private void setDefaultXMLHandler(XMLHandler handler) {
+        addXMLHandler(XMLHandler.HANDLE_ALL, handler);
+    }
+    
+    /**
+     * Add an XML handler. The handler itself is inspected to find out what it supports.
+     * @param classname the fully qualified class name
+     */
+    public void addXMLHandler(String classname) {
+        try {
+            XMLHandler handlerInstance = (XMLHandler)Class.forName(classname).newInstance();
+            addXMLHandler(handlerInstance);
+        } catch (ClassNotFoundException e) {
+            throw new IllegalArgumentException("Could not find "
+                                               + classname);
+        } catch (InstantiationException e) {
+            throw new IllegalArgumentException("Could not instantiate "
+                                               + classname);
+        } catch (IllegalAccessException e) {
+            throw new IllegalArgumentException("Could not access "
+                                               + classname);
+        } catch (ClassCastException e) {
+            throw new IllegalArgumentException(classname
+                                               + " is not an " 
+                                               + XMLHandler.class.getName());
+        }
+    }
+    
+    /**
+     * Add an XML handler. The handler itself is inspected to find out what it supports.
+     * @param handler the XMLHandler instance
+     */
+    public void addXMLHandler(XMLHandler handler) {
+        String ns = handler.getNamespace();
+        if (ns == null) {
+            setDefaultXMLHandler(handler);
+        } else {
+            addXMLHandler(ns, handler);
+        }
+    }
+    
+    /**
+     * Add an XML handler for the given MIME type and XML namespace.
+     * @param ns Namespace URI
+     * @param handler XMLHandler to use
+     */
+    private void addXMLHandler(String ns,
+                              XMLHandler handler) {
+        List lst = (List)handlers.get(ns);
+        if (lst == null) {
+            lst = new java.util.ArrayList();
+            handlers.put(ns, lst);
+        }
+        lst.add(handler);
+    }
+    
+    /**
+     * Returns an XMLHandler which handles an XML dialect of the given namespace and for
+     * a specified output format defined by its MIME type.
+     * @param renderer the Renderer for which to retrieve a Renderer
+     * @param ns the XML namespace associated with the XML to be rendered
+     * @return the XMLHandler responsible for handling the XML or null if none is available
+     */
+    public XMLHandler getXMLHandler(Renderer renderer, String ns) {
+        XMLHandler handler;
+
+        List lst = (List)handlers.get(ns);
+        handler = getXMLHandler(renderer, lst);
+        if (handler == null) {
+            lst = (List)handlers.get(XMLHandler.HANDLE_ALL);
+            handler = getXMLHandler(renderer, lst);
+        }
+        return handler;
+    }
+
+    private XMLHandler getXMLHandler(Renderer renderer, List lst) {
+        XMLHandler handler;
+        if (lst != null) {
+            for (int i = 0, c = lst.size(); i < c; i++) {
+                //TODO Maybe add priorities later
+                handler = (XMLHandler)lst.get(i);
+                if (handler.supportsRenderer(renderer)) {
+                    return handler;
+                }
+            }
+        }
+        return null; //No handler found
+    }
+    
+    /**
+     * Discovers XMLHandler implementations through the classpath and dynamically
+     * registers them.
+     */
+    private void discoverXMLHandlers() {
+        // add mappings from available services
+        Iterator providers = Service.providers(XMLHandler.class);
+        if (providers != null) {
+            while (providers.hasNext()) {
+                XMLHandler handler = (XMLHandler)providers.next();
+                try {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Dynamically adding XMLHandler: " + handler.getClass().getName());
+                    }
+                    addXMLHandler(handler);
+                } catch (IllegalArgumentException e) {
+                    log.error("Error while adding XMLHandler", e);
+                }
+
+            }
+        }
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/XMLHandlerRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRenderer.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRenderer.java Thu Mar  6 05:33:44 2008
@@ -23,6 +23,7 @@
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 import java.awt.image.RenderedImage;
 import java.io.FileNotFoundException;
@@ -139,28 +140,23 @@
  * handle all types of inline area, text, image etc and draws various lines and
  * rectangles.
  * </p>
- * 
- * Note: There are specific extensions that have been added to the FO. They are
- * specific to their location within the FO and have to be processed accordingly
- * (ie. at the start or end of the page).
- * 
+ *
+ * Note: There are specific extensions that have been added to the
+ * FO. They are specific to their location within the FO and have to be
+ * processed accordingly (ie. at the start or end of the page).
+ *
  */
 public class AFPRenderer extends AbstractPathOrientedRenderer {
 
     /**
-     * 2400 dpi renderer resolution
+     * The default afp renderer output resolution
      */
-    protected static final int DPI_240_RESOLUTION = 240;
-
-    /**
-     * 14400 dpi renderer resolution
-     */
-    protected static final int DPI_1440_RESOLUTION = 1440;
+    private static final int DEFAULT_DPI_RESOLUTION = 240;
 
     /**
      * The afp factor for calculating resolutions (e.g. 72000/240 = 300)
      */
-    protected static final int DPI_CONVERSION_FACTOR = 72000;
+    private static final int DPI_CONVERSION_FACTOR = 72000;
 
     /**
      * The afp data stream object responsible for generating afp data
@@ -168,11 +164,46 @@
     private AFPDataStream afpDataStream = null;
 
     /**
+     * The map of afp root extensions
+     */
+    // UNUSED
+    // private HashMap rootExtensionMap = null;
+    /**
      * The map of page segments
      */
-    private Map pageSegmentsMap = null;
+    private HashMap pageSegmentsMap = null;
+
+    /**
+     * The fonts on the current page
+     */
+    private HashMap currentPageFonts = null;
 
     /**
+     * The current color object
+     */
+    private Color currentColor = null;
+
+    /**
+     * The page font number counter, used to determine the next font reference
+     */
+    private int pageFontCounter = 0;
+
+    /**
+     * The current font family
+     */
+    // UNUSED
+    // private String currentFontFamily = "";
+    /**
+     * The current font size
+     */
+    private int currentFontSize = 0;
+
+    /**
+     * The Options to be set on the AFPRenderer
+     */
+    // UNUSED
+    // private Map afpOptions = null;
+    /**
      * The page width
      */
     private int pageWidth = 0;
@@ -183,6 +214,11 @@
     private int pageHeight = 0;
 
     /**
+     * The current page sequence id
+     */
+    // UNUSED
+    // private String pageSequenceId = null;
+    /**
      * The portrait rotation
      */
     private int portraitRotation = 0;
@@ -193,6 +229,21 @@
     private int landscapeRotation = 270;
 
     /**
+     * The line cache, avoids drawing duplicate lines in tables.
+     */
+    // UNUSED
+    // private HashSet lineCache = null;
+    /**
+     * The current x position for line drawing
+     */
+    // UNUSED
+    // private float x;
+    /**
+     * The current y position for line drawing
+     */
+    // UNUSED
+    // private float y;
+    /**
      * The map of saved incomplete pages
      */
     private Map pages = null;
@@ -210,10 +261,7 @@
     /**
      * The output resolution
      */
-    private int resolution = DPI_240_RESOLUTION;
-
-    /** drawing state */
-    protected AFPState currentState = null;
+    private int resolution = DEFAULT_DPI_RESOLUTION;
 
     /**
      * Constructor for AFPRenderer.
@@ -224,22 +272,20 @@
 
     /**
      * Set up the font info
-     * 
-     * @param inFontInfo
-     *            font info to set up
+     *
+     * @param inFontInfo  font info to set up
      */
     public void setupFontInfo(FontInfo inFontInfo) {
         this.fontInfo = inFontInfo;
         int num = 1;
         if (this.fontList != null && this.fontList.size() > 0) {
             for (Iterator it = this.fontList.iterator(); it.hasNext();) {
-                AFPFontInfo afi = (AFPFontInfo) it.next();
-                AFPFont bf = (AFPFont) afi.getAFPFont();
-                for (Iterator it2 = afi.getFontTriplets().iterator(); it2
-                        .hasNext();) {
-                    FontTriplet ft = (FontTriplet) it2.next();
-                    this.fontInfo.addFontProperties("F" + num, ft.getName(), ft
-                            .getStyle(), ft.getWeight());
+                AFPFontInfo afi = (AFPFontInfo)it.next();
+                AFPFont bf = (AFPFont)afi.getAFPFont();
+                for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext();) {
+                    FontTriplet ft = (FontTriplet)it2.next();
+                    this.fontInfo.addFontProperties("F" + num, ft.getName()
+                                                    , ft.getStyle(), ft.getWeight());
                     this.fontInfo.addMetrics("F" + num, bf);
                     num++;
                 }
@@ -248,36 +294,33 @@
             log.warn("No AFP fonts configured - using default setup");
         }
         if (this.fontInfo.fontLookup("sans-serif", "normal", 400) == null) {
-            CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500",
-                    "CZH200  ", 1, new Helvetica());
+            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZH200  ",
+                    1, new Helvetica());
             AFPFont bf = new OutlineFont("Helvetica", cs);
-            this.fontInfo.addFontProperties("F" + num, "sans-serif", "normal",
-                    400);
+            this.fontInfo.addFontProperties("F" + num, "sans-serif", "normal", 400);
             this.fontInfo.addMetrics("F" + num, bf);
             num++;
         }
         if (this.fontInfo.fontLookup("serif", "normal", 400) == null) {
-            CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500",
-                    "CZN200  ", 1, new TimesRoman());
+            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZN200  ",
+                    1, new TimesRoman());
             AFPFont bf = new OutlineFont("Helvetica", cs);
             this.fontInfo.addFontProperties("F" + num, "serif", "normal", 400);
             this.fontInfo.addMetrics("F" + num, bf);
             num++;
         }
         if (this.fontInfo.fontLookup("monospace", "normal", 400) == null) {
-            CharacterSet cs = new FopCharacterSet("T1V10500", "Cp500",
-                    "CZ4200  ", 1, new Courier());
+            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZ4200  ",
+                    1, new Courier());
             AFPFont bf = new OutlineFont("Helvetica", cs);
-            this.fontInfo.addFontProperties("F" + num, "monospace", "normal",
-                    400);
+            this.fontInfo.addFontProperties("F" + num, "monospace", "normal", 400);
             this.fontInfo.addMetrics("F" + num, bf);
             num++;
         }
         if (this.fontInfo.fontLookup("any", "normal", 400) == null) {
-            FontTriplet ft = this.fontInfo.fontLookup("sans-serif", "normal",
-                    400);
-            this.fontInfo.addFontProperties(this.fontInfo
-                    .getInternalFontKey(ft), "any", "normal", 400);
+            FontTriplet ft = this.fontInfo.fontLookup("sans-serif", "normal", 400);
+            this.fontInfo.addFontProperties(
+                    this.fontInfo.getInternalFontKey(ft), "any", "normal", 400);
         }
     }
 
@@ -292,49 +335,57 @@
      * {@inheritDoc}
      */
     public void startRenderer(OutputStream outputStream) throws IOException {
-        this.currentState = new AFPState();
-        this.afpDataStream = new AFPDataStream();
-        this.afpDataStream.setPortraitRotation(portraitRotation);
-        this.afpDataStream.setLandscapeRotation(landscapeRotation);
-        this.afpDataStream.startDocument(outputStream);
+        currentPageFonts = new HashMap();
+        currentColor = new Color(255, 255, 255);
+        afpDataStream = new AFPDataStream();
+        afpDataStream.setPortraitRotation(portraitRotation);
+        afpDataStream.setLandscapeRotation(landscapeRotation);
+        afpDataStream.startDocument(outputStream);
     }
 
     /**
      * {@inheritDoc}
      */
     public void stopRenderer() throws IOException {
-        this.afpDataStream.endDocument();
+        afpDataStream.endDocument();
     }
 
     /**
      * {@inheritDoc}
      */
     public boolean supportsOutOfOrder() {
-        // return false;
+        //return false;
         return true;
     }
 
     /**
-     * Prepare a page for rendering. This is called if the renderer supports out
-     * of order rendering. The renderer should prepare the page so that a page
-     * further on in the set of pages can be rendered. The body of the page
-     * should not be rendered. The page will be rendered at a later time by the
-     * call to render page.
-     * 
+     * Prepare a page for rendering. This is called if the renderer supports
+     * out of order rendering. The renderer should prepare the page so that a
+     * page further on in the set of pages can be rendered. The body of the
+     * page should not be rendered. The page will be rendered at a later time
+     * by the call to render page.
+     *
      * {@inheritDoc}
      */
     public void preparePage(PageViewport page) {
+        // initializeRootExtensions(page);
 
-        this.currentState.reset();
+        // this.currentFontFamily = "";
+        this.currentFontSize = 0;
+        this.pageFontCounter = 0;
+        this.currentPageFonts.clear();
+        // this.lineCache = new HashSet();
 
         Rectangle2D bounds = page.getViewArea();
 
         this.pageWidth = mpts2units(bounds.getWidth());
         this.pageHeight = mpts2units(bounds.getHeight());
 
+        // renderPageGroupExtensions(page);
+
         final int pageRotation = 0;
         this.afpDataStream.startPage(pageWidth, pageHeight, pageRotation,
-                this.resolution, this.resolution);
+                getResolution(), getResolution());
 
         renderPageObjectExtensions(page);
 
@@ -372,15 +423,12 @@
     }
 
     /**
-     * Renders a region viewport.
-     * <p>
-     * 
-     * The region may clip the area and it establishes a position from where the
-     * region is placed.
-     * </p>
-     * 
-     * @param port
-     *            The region viewport to be rendered
+     * Renders a region viewport. <p>
+     *
+     * The region may clip the area and it establishes a position from where
+     * the region is placed.</p>
+     *
+     * @param port  The region viewport to be rendered
      */
     public void renderRegionViewport(RegionViewport port) {
         if (port != null) {
@@ -395,9 +443,11 @@
             handleRegionTraits(port);
 
             /*
-             * _afpDataStream.startOverlay(mpts2units(view.getX()) ,
-             * mpts2units(view.getY()) , mpts2units(view.getWidth()) ,
-             * mpts2units(view.getHeight()) , rotation);
+            _afpDataStream.startOverlay(mpts2units(view.getX())
+                , mpts2units(view.getY())
+                , mpts2units(view.getWidth())
+                , mpts2units(view.getHeight())
+                , rotation);
              */
 
             pushViewPortPos(new ViewPortPos(view, regionReference.getCTM()));
@@ -408,7 +458,7 @@
                 renderRegion(regionReference);
             }
             /*
-             * _afpDataStream.endOverlay();
+            _afpDataStream.endOverlay();
              */
             popViewPortPos();
         }
@@ -423,65 +473,77 @@
         // save positions
         int saveIP = currentIPPosition;
         int saveBP = currentBPPosition;
-        // String saveFontName = currentFontName;
 
         CTM ctm = bv.getCTM();
         int borderPaddingStart = bv.getBorderAndPaddingWidthStart();
         int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore();
-        float x, y;
-        x = (float) (bv.getXOffset() + containingIPPosition) / 1000f;
-        y = (float) (bv.getYOffset() + containingBPPosition) / 1000f;
-        // This is the content-rect
-        float width = (float) bv.getIPD() / 1000f;
-        float height = (float) bv.getBPD() / 1000f;
+        //This is the content-rect
+        float width = (float)bv.getIPD() / 1000f;
+        float height = (float)bv.getBPD() / 1000f;
 
         if (bv.getPositioning() == Block.ABSOLUTE
                 || bv.getPositioning() == Block.FIXED) {
 
-            currentIPPosition = bv.getXOffset();
-            currentBPPosition = bv.getYOffset();
-
-            // For FIXED, we need to break out of the current viewports to the
-            // one established by the page. We save the state stack for
-            // restoration
-            // after the block-container has been painted. See below.
+            //For FIXED, we need to break out of the current viewports to the
+            //one established by the page. We save the state stack for restoration
+            //after the block-container has been painted. See below.
             List breakOutList = null;
             if (bv.getPositioning() == Block.FIXED) {
                 breakOutList = breakOutOfStateStack();
             }
 
-            CTM tempctm = new CTM(containingIPPosition, containingBPPosition);
-            ctm = tempctm.multiply(ctm);
-
-            // Adjust for spaces (from margin or indirectly by start-indent etc.
-            x += bv.getSpaceStart() / 1000f;
-            currentIPPosition += bv.getSpaceStart();
-
-            y += bv.getSpaceBefore() / 1000f;
-            currentBPPosition += bv.getSpaceBefore();
-
-            float bpwidth = (borderPaddingStart + bv
-                    .getBorderAndPaddingWidthEnd()) / 1000f;
-            float bpheight = (borderPaddingBefore + bv
-                    .getBorderAndPaddingWidthAfter()) / 1000f;
-
-            drawBackAndBorders(bv, x, y, width + bpwidth, height + bpheight);
-
-            // Now adjust for border/padding
-            currentIPPosition += borderPaddingStart;
-            currentBPPosition += borderPaddingBefore;
+            AffineTransform positionTransform = new AffineTransform();
+            positionTransform.translate(bv.getXOffset(), bv.getYOffset());
+            
+            //"left/"top" (bv.getX/YOffset()) specify the position of the content rectangle
+            positionTransform.translate(-borderPaddingStart, -borderPaddingBefore);
 
-            Rectangle2D clippingRect = null;
-            clippingRect = new Rectangle(currentIPPosition, currentBPPosition,
-                    bv.getIPD(), bv.getBPD());
+            //skipping fox:transform here
 
-            // startVParea(ctm, clippingRect);
-            pushViewPortPos(new ViewPortPos(clippingRect, ctm));
+            //saveGraphicsState();
+            //Viewport position
+            //concatenateTransformationMatrix(mptToPt(positionTransform));
+            
+            //Background and borders
+            float bpwidth = (borderPaddingStart + bv.getBorderAndPaddingWidthEnd()) / 1000f;
+            float bpheight = (borderPaddingBefore + bv.getBorderAndPaddingWidthAfter()) / 1000f;
+            Point2D ptSrc = new Point(0, 0);
+            Point2D ptDst = positionTransform.transform(ptSrc, null);
+            Rectangle2D borderRect = new Rectangle2D.Double(ptDst.getX(), ptDst.getY(),
+                    1000 * (width + bpwidth), 1000 * (height + bpheight));
+            pushViewPortPos(new ViewPortPos(borderRect, new CTM(positionTransform)));
+            drawBackAndBorders(bv, 0, 0, width + bpwidth, height + bpheight);
+
+            //Shift to content rectangle after border painting
+            AffineTransform contentRectTransform = new AffineTransform();
+            contentRectTransform.translate(borderPaddingStart, borderPaddingBefore);
+            //concatenateTransformationMatrix(mptToPt(contentRectTransform));
+            ptSrc = new Point(0, 0);
+            ptDst = contentRectTransform.transform(ptSrc, null);
+            Rectangle2D contentRect = new Rectangle2D.Double(ptDst.getX(), ptDst.getY(),
+                    1000 * width, 1000 * height);
+            pushViewPortPos(new ViewPortPos(contentRect, new CTM(contentRectTransform)));
+
+            //Clipping is not supported, yet
+            //Rectangle2D clippingRect = null;
+            //clippingRect = new Rectangle(0, 0, bv.getIPD(), bv.getBPD());
+
+            //saveGraphicsState();
+            //Set up coordinate system for content rectangle
+            AffineTransform contentTransform = ctm.toAffineTransform();
+            //concatenateTransformationMatrix(mptToPt(contentTransform));
+            contentRect = new Rectangle2D.Double(0, 0, 1000 * width, 1000 * height);
+            pushViewPortPos(new ViewPortPos(contentRect, new CTM(contentTransform)));
+            
             currentIPPosition = 0;
             currentBPPosition = 0;
             renderBlocks(bv, children);
-            // endVParea();
+
+            popViewPortPos();
             popViewPortPos();
+            //restoreGraphicsState();
+            popViewPortPos();
+            //restoreGraphicsState();
 
             if (breakOutList != null) {
                 restoreStateStackAfterBreakOut(breakOutList);
@@ -493,37 +555,36 @@
 
             currentBPPosition += bv.getSpaceBefore();
 
-            // borders and background in the old coordinate system
+            //borders and background in the old coordinate system
             handleBlockTraits(bv);
 
-            // Advance to start of content area
+            //Advance to start of content area
             currentIPPosition += bv.getStartIndent();
 
             CTM tempctm = new CTM(containingIPPosition, currentBPPosition);
             ctm = tempctm.multiply(ctm);
 
-            // Now adjust for border/padding
+            //Now adjust for border/padding
             currentBPPosition += borderPaddingBefore;
 
             Rectangle2D clippingRect = null;
             clippingRect = new Rectangle(currentIPPosition, currentBPPosition,
                     bv.getIPD(), bv.getBPD());
 
-            // startVParea(ctm, clippingRect);
+            //startVParea(ctm, clippingRect);
             pushViewPortPos(new ViewPortPos(clippingRect, ctm));
 
             currentIPPosition = 0;
             currentBPPosition = 0;
             renderBlocks(bv, children);
-            // endVParea();
+            //endVParea();
             popViewPortPos();
 
             currentIPPosition = saveIP;
             currentBPPosition = saveBP;
 
-            currentBPPosition += (int) (bv.getAllocBPD());
+            currentBPPosition += (int)(bv.getAllocBPD());
         }
-        // currentFontName = saveFontName;
     }
 
     /** {@inheritDoc} */
@@ -537,7 +598,13 @@
      */
     public void renderPage(PageViewport pageViewport) {
 
-        currentState.reset();
+        // initializeRootExtensions(page);
+
+        // this.currentFontFamily = "";
+        this.currentFontSize = 0;
+        this.pageFontCounter = 0;
+        this.currentPageFonts.clear();
+        // this.lineCache = new HashSet();
 
         Rectangle2D bounds = pageViewport.getViewArea();
 
@@ -546,14 +613,14 @@
 
         if (pages != null && pages.containsKey(pageViewport)) {
 
-            this.afpDataStream.restorePage((PageObject) pages
-                    .remove(pageViewport));
+            this.afpDataStream.restorePage((PageObject) pages.remove(pageViewport));
 
         } else {
+            // renderPageGroupExtensions(page);
 
             final int pageRotation = 0;
             this.afpDataStream.startPage(pageWidth, pageHeight, pageRotation,
-                    this.resolution, this.resolution);
+                    getResolution(), getResolution());
 
             renderPageObjectExtensions(pageViewport);
 
@@ -563,7 +630,16 @@
 
         renderPageAreas(pageViewport.getPage());
 
-        this.afpDataStream.addFontsToCurrentPage(currentState.getPageFonts());
+        Iterator i = currentPageFonts.values().iterator();
+        while (i.hasNext()) {
+            AFPFontAttributes afpFontAttributes = (AFPFontAttributes) i.next();
+
+            afpDataStream.createFont(
+                (byte)afpFontAttributes.getFontReference(),
+                afpFontAttributes.getFont(),
+                afpFontAttributes.getPointSize());
+
+        }
 
         try {
             afpDataStream.endPage();
@@ -615,12 +691,22 @@
      */
     public void fillRect(float x, float y, float width, float height) {
         /*
-         * afpDataStream.createShading( pts2units(x), pts2units(y),
-         * pts2units(width), pts2units(height), currentColor.getRed(),
-         * currentColor.getGreen(), currentColor.getBlue());
+        afpDataStream.createShading(
+            pts2units(x),
+            pts2units(y),
+            pts2units(width),
+            pts2units(height),
+            currentColor.getRed(),
+            currentColor.getGreen(),
+            currentColor.getBlue());
          */
-        afpDataStream.createLine(pts2units(x), pts2units(y), pts2units(x
-                + width), pts2units(y), pts2units(height), currentState.getColor());
+        afpDataStream.createLine(
+            pts2units(x),
+            pts2units(y),
+            pts2units(x + width),
+            pts2units(y),
+            pts2units(height),
+            currentColor);
     }
 
     /**
@@ -635,124 +721,195 @@
             return;
         }
         switch (style) {
-        case Constants.EN_DOUBLE:
-            if (horz) {
-                float h3 = h / 3;
-                float ym1 = y1;
-                float ym2 = ym1 + h3 + h3;
-                afpDataStream.createLine(pts2units(x1), pts2units(ym1),
-                        pts2units(x2), pts2units(ym1), pts2units(h3), col);
-                afpDataStream.createLine(pts2units(x1), pts2units(ym2),
-                        pts2units(x2), pts2units(ym2), pts2units(h3), col);
-            } else {
-                float w3 = w / 3;
-                float xm1 = x1;
-                float xm2 = xm1 + w3 + w3;
-                afpDataStream.createLine(pts2units(xm1), pts2units(y1),
-                        pts2units(xm1), pts2units(y2), pts2units(w3), col);
-                afpDataStream.createLine(pts2units(xm2), pts2units(y1),
-                        pts2units(xm2), pts2units(y2), pts2units(w3), col);
-            }
-            break;
-        case Constants.EN_DASHED:
-            if (horz) {
-                float w2 = 2 * h;
-                while (x1 + w2 < x2) {
-                    afpDataStream.createLine(pts2units(x1), pts2units(y1),
-                            pts2units(x1 + w2), pts2units(y1), pts2units(h),
-                            col);
-                    x1 += 2 * w2;
+            case Constants.EN_DOUBLE:
+                if (horz) {
+                    float h3 = h / 3;
+                    float ym1 = y1;
+                    float ym2 = ym1 + h3 + h3;
+                    afpDataStream.createLine(
+                        pts2units(x1),
+                        pts2units(ym1),
+                        pts2units(x2),
+                        pts2units(ym1),
+                        pts2units(h3),
+                        col
+                    );
+                    afpDataStream.createLine(
+                        pts2units(x1),
+                        pts2units(ym2),
+                        pts2units(x2),
+                        pts2units(ym2),
+                        pts2units(h3),
+                        col
+                    );
+                } else {
+                    float w3 = w / 3;
+                    float xm1 = x1;
+                    float xm2 = xm1 + w3 + w3;
+                    afpDataStream.createLine(
+                        pts2units(xm1),
+                        pts2units(y1),
+                        pts2units(xm1),
+                        pts2units(y2),
+                        pts2units(w3),
+                        col
+                    );
+                    afpDataStream.createLine(
+                        pts2units(xm2),
+                        pts2units(y1),
+                        pts2units(xm2),
+                        pts2units(y2),
+                        pts2units(w3),
+                        col
+                    );
                 }
-            } else {
-                float h2 = 2 * w;
-                while (y1 + h2 < y2) {
-                    afpDataStream.createLine(pts2units(x1), pts2units(y1),
-                            pts2units(x1), pts2units(y1 + h2), pts2units(w),
-                            col);
-                    y1 += 2 * h2;
+                break;
+            case Constants.EN_DASHED:
+                if (horz) {
+                    float w2 = 2 * h;
+                    while (x1 + w2 < x2) {
+                        afpDataStream.createLine(
+                            pts2units(x1),
+                            pts2units(y1),
+                            pts2units(x1 + w2),
+                            pts2units(y1),
+                            pts2units(h),
+                            col
+                        );
+                        x1 += 2 * w2;
+                    }
+                } else {
+                    float h2 = 2 * w;
+                    while (y1 + h2 < y2) {
+                        afpDataStream.createLine(
+                            pts2units(x1),
+                            pts2units(y1),
+                            pts2units(x1),
+                            pts2units(y1 + h2),
+                            pts2units(w),
+                            col
+                        );
+                        y1 += 2 * h2;
+                    }
                 }
-            }
-            break;
-        case Constants.EN_DOTTED:
-            if (horz) {
-                while (x1 + h < x2) {
-                    afpDataStream
-                            .createLine(pts2units(x1), pts2units(y1),
-                                    pts2units(x1 + h), pts2units(y1),
-                                    pts2units(h), col);
-                    x1 += 2 * h;
+                break;
+            case Constants.EN_DOTTED:
+                if (horz) {
+                    while (x1 + h < x2) {
+                        afpDataStream.createLine(
+                            pts2units(x1),
+                            pts2units(y1),
+                            pts2units(x1 + h),
+                            pts2units(y1),
+                            pts2units(h),
+                            col
+                        );
+                        x1 += 2 * h;
+                    }
+                } else {
+                    while (y1 + w < y2) {
+                        afpDataStream.createLine(
+                            pts2units(x1),
+                            pts2units(y1),
+                            pts2units(x1),
+                            pts2units(y1 + w),
+                            pts2units(w),
+                            col
+                        );
+                        y1 += 2 * w;
+                    }
                 }
-            } else {
-                while (y1 + w < y2) {
-                    afpDataStream
-                            .createLine(pts2units(x1), pts2units(y1),
-                                    pts2units(x1), pts2units(y1 + w),
-                                    pts2units(w), col);
-                    y1 += 2 * w;
+                break;
+            case Constants.EN_GROOVE:
+            case Constants.EN_RIDGE:
+            {
+                float colFactor = (style == EN_GROOVE ? 0.4f : -0.4f);
+                if (horz) {
+                    Color uppercol = lightenColor(col, -colFactor);
+                    Color lowercol = lightenColor(col, colFactor);
+                    float h3 = h / 3;
+                    float ym1 = y1;
+                    afpDataStream.createLine(
+                        pts2units(x1),
+                        pts2units(ym1),
+                        pts2units(x2),
+                        pts2units(ym1),
+                        pts2units(h3),
+                        uppercol
+                    );
+                    afpDataStream.createLine(
+                        pts2units(x1),
+                        pts2units(ym1 + h3),
+                        pts2units(x2),
+                        pts2units(ym1 + h3),
+                        pts2units(h3),
+                        col
+                    );
+                    afpDataStream.createLine(
+                        pts2units(x1),
+                        pts2units(ym1 + h3 + h3),
+                        pts2units(x2),
+                        pts2units(ym1 + h3 + h3),
+                        pts2units(h3),
+                        lowercol
+                    );
+                } else {
+                    Color leftcol = lightenColor(col, -colFactor);
+                    Color rightcol = lightenColor(col, colFactor);
+                    float w3 = w / 3;
+                    float xm1 = x1 + (w3 / 2);
+                    afpDataStream.createLine(
+                        pts2units(xm1),
+                        pts2units(y1),
+                        pts2units(xm1),
+                        pts2units(y2),
+                        pts2units(w3),
+                        leftcol
+                    );
+                    afpDataStream.createLine(
+                        pts2units(xm1 + w3),
+                        pts2units(y1),
+                        pts2units(xm1 + w3),
+                        pts2units(y2),
+                        pts2units(w3),
+                        col
+                    );
+                    afpDataStream.createLine(
+                        pts2units(xm1 + w3 + w3),
+                        pts2units(y1),
+                        pts2units(xm1 + w3 + w3),
+                        pts2units(y2),
+                        pts2units(w3),
+                        rightcol
+                    );
                 }
+                break;
             }
-            break;
-        case Constants.EN_GROOVE:
-        case Constants.EN_RIDGE: {
-            float colFactor = (style == EN_GROOVE ? 0.4f : -0.4f);
-            if (horz) {
-                Color uppercol = lightenColor(col, -colFactor);
-                Color lowercol = lightenColor(col, colFactor);
-                float h3 = h / 3;
-                float ym1 = y1;
-                afpDataStream.createLine(pts2units(x1), pts2units(ym1),
-                        pts2units(x2), pts2units(ym1), pts2units(h3), uppercol);
-                afpDataStream.createLine(pts2units(x1), pts2units(ym1 + h3),
-                        pts2units(x2), pts2units(ym1 + h3), pts2units(h3), col);
-                afpDataStream.createLine(pts2units(x1),
-                        pts2units(ym1 + h3 + h3), pts2units(x2), pts2units(ym1
-                                + h3 + h3), pts2units(h3), lowercol);
-            } else {
-                Color leftcol = lightenColor(col, -colFactor);
-                Color rightcol = lightenColor(col, colFactor);
-                float w3 = w / 3;
-                float xm1 = x1 + (w3 / 2);
-                afpDataStream.createLine(pts2units(xm1), pts2units(y1),
-                        pts2units(xm1), pts2units(y2), pts2units(w3), leftcol);
-                afpDataStream.createLine(pts2units(xm1 + w3), pts2units(y1),
-                        pts2units(xm1 + w3), pts2units(y2), pts2units(w3), col);
-                afpDataStream.createLine(pts2units(xm1 + w3 + w3),
-                        pts2units(y1), pts2units(xm1 + w3 + w3), pts2units(y2),
-                        pts2units(w3), rightcol);
-            }
-            break;
-        }
-        case Constants.EN_HIDDEN:
-            break;
-        case Constants.EN_INSET:
-        case Constants.EN_OUTSET:
-        default:
-            afpDataStream.createLine(pts2units(x1), pts2units(y1),
-                    pts2units(horz ? x2 : x1), pts2units(horz ? y1 : y2),
-                    pts2units(Math.abs(horz ? (y2 - y1) : (x2 - x1))), col);
+            case Constants.EN_HIDDEN:
+                break;
+            case Constants.EN_INSET:
+            case Constants.EN_OUTSET:
+            default:
+                afpDataStream.createLine(
+                    pts2units(x1),
+                    pts2units(y1),
+                    pts2units(horz ? x2 : x1),
+                    pts2units(horz ? y1 : y2),
+                    pts2units(Math.abs(horz ? (y2 - y1) : (x2 - x1))),
+                    col
+                );
         }
     }
 
     /**
      * {@inheritDoc}
      */
-    protected RendererContext createRendererContext(int x, int y, int width,
-            int height, Map foreignAttributes) {
+    protected RendererContext createRendererContext(int x, int y, int width, int height,
+            Map foreignAttributes) {
         RendererContext context;
-        context = super.createRendererContext(x, y, width, height,
-                foreignAttributes);
+        context = super.createRendererContext(x, y, width, height, foreignAttributes);
         context.setProperty(AFPRendererContextConstants.AFP_GRAYSCALE,
                 new Boolean(!this.colorImages));
-        context.setProperty(AFPRendererContextConstants.AFP_FONT_INFO,
-                this.fontInfo);
-        context.setProperty(AFPRendererContextConstants.AFP_RESOLUTION,
-                new Integer(this.resolution));
-        context.setProperty(AFPRendererContextConstants.AFP_BITS_PER_PIXEL,
-                new Integer(this.bitsPerPixel));
-        context.setProperty(AFPRendererContextConstants.AFP_DATASTREAM,
-                this.afpDataStream);
-        context.setProperty(AFPRendererContextConstants.AFP_STATE,
-                this.currentState);
         return context;
     }
 
@@ -906,46 +1063,47 @@
                  * io.setImageData(fopimage.getRessourceBytes());
                  *//*
             } else if (MimeConstants.MIME_TIFF.equals(mime)
-                    && fopimage instanceof TIFFImage) {
+                        && fopimage instanceof TIFFImage) {
                 TIFFImage tiffImage = (TIFFImage) fopimage;
                 int x = mpts2units(pos.getX() + currentIPPosition);
                 int y = mpts2units(pos.getY() + currentBPPosition);
                 int w = mpts2units(pos.getWidth());
                 int h = mpts2units(pos.getHeight());
-                int res = getResolution();
-                ImageObject io = afpDataStream.getImageObject(x, y, w, h, res,
-                        res);
+                ImageObject io = afpDataStream.getImageObject(x, y, w, h,
+                        getResolution(), getResolution());
                 io.setImageParameters(
-                        (int) (fopimage.getHorizontalResolution() * 10),
-                        (int) (fopimage.getVerticalResolution() * 10), fopimage
-                                .getWidth(), fopimage.getHeight());
+                    (int)(fopimage.getHorizontalResolution() * 10),
+                    (int)(fopimage.getVerticalResolution() * 10),
+                    fopimage.getWidth(),
+                    fopimage.getHeight()
+                );
                 if (tiffImage.getStripCount() == 1) {
                     int comp = tiffImage.getCompression();
                     if (comp == 3) {
                         if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
                             return;
                         }
-                        io.setImageEncoding((byte) 0x81);
+                        io.setImageEncoding((byte)0x81);
                         io.setImageData(fopimage.getRessourceBytes());
                     } else if (comp == 4) {
                         if (!fopimage.load(FopImage.ORIGINAL_DATA)) {
                             return;
                         }
-                        io.setImageEncoding((byte) 0x82);
+                        io.setImageEncoding((byte)0x82);
                         io.setImageData(fopimage.getRessourceBytes());
                     } else {
                         if (!fopimage.load(FopImage.BITMAP)) {
                             return;
                         }
-                        convertToGrayScaleImage(io, fopimage.getBitmaps(),
-                                fopimage.getWidth(), fopimage.getHeight(), this.bitsPerPixel);
+                        convertToGrayScaleImage(io, fopimage.getBitmaps(), 
+                                fopimage.getWidth(), fopimage.getHeight());
                     }
                 } else {
                     if (!fopimage.load(FopImage.BITMAP)) {
                         return;
                     }
-                    convertToGrayScaleImage(io, fopimage.getBitmaps(), fopimage
-                            .getWidth(), fopimage.getHeight(), this.bitsPerPixel);
+                    convertToGrayScaleImage(io, fopimage.getBitmaps(),
+                            fopimage.getWidth(), fopimage.getHeight());
                 }
             } else {
                 if (!fopimage.load(FopImage.BITMAP)) {
@@ -957,19 +1115,20 @@
                 int y = mpts2units(pos.getY() + currentBPPosition);
                 int w = mpts2units(pos.getWidth());
                 int h = mpts2units(pos.getHeight());
-                int res = getResolution();
-                ImageObject io = afpDataStream.getImageObject(x, y, w, h, res,
-                        res);
+                ImageObject io = afpDataStream.getImageObject(x, y, w, h,
+                        getResolution(), getResolution());
                 io.setImageParameters(
-                        (int) (fopimage.getHorizontalResolution() * 10),
-                        (int) (fopimage.getVerticalResolution() * 10), fopimage
-                                .getWidth(), fopimage.getHeight());
+                    (int)(fopimage.getHorizontalResolution() * 10),
+                    (int)(fopimage.getVerticalResolution() * 10),
+                    fopimage.getWidth(),
+                    fopimage.getHeight()
+                );
                 if (colorImages) {
-                    io.setImageIDESize((byte) 24);
+                    io.setImageIDESize((byte)24);
                     io.setImageData(fopimage.getBitmaps());
                 } else {
-                    convertToGrayScaleImage(io, fopimage.getBitmaps(), fopimage
-                            .getWidth(), fopimage.getHeight(), this.bitsPerPixel);
+                    convertToGrayScaleImage(io, fopimage.getBitmaps(),
+                            fopimage.getWidth(), fopimage.getHeight());
                 }
             }*/
         }
@@ -1036,25 +1195,23 @@
                         image.getWidth(), image.getHeight(), this.bitsPerPixel);
             }
         } catch (IOException ioe) {
-            log.error("Error while serializing bitmap: " + ioe.getMessage(),
-                    ioe);
+            log.error("Error while serializing bitmap: " + ioe.getMessage(), ioe);
         }
     }
 
     /**
-     * Establishes a new foreground or fill color. {@inheritDoc}
+     * Establishes a new foreground or fill color.
+     * {@inheritDoc}
      */
     public void updateColor(Color col, boolean fill) {
         if (fill) {
-            currentState.setColor(col);
+            currentColor = col;
         }
     }
 
     /**
      * Restores the state stack after a break out.
-     * 
-     * @param breakOutList
-     *            the state stack to restore.
+     * @param breakOutList the state stack to restore.
      */
     public void restoreStateStackAfterBreakOut(List breakOutList) {
 
@@ -1062,7 +1219,6 @@
 
     /**
      * Breaks out of the state stack to handle fixed block-containers.
-     * 
      * @return the saved state stack to recreate later
      */
     public List breakOutOfStateStack() {
@@ -1103,58 +1259,76 @@
     public void renderText(TextArea text) {
         renderInlineAreaBackAndBorders(text);
 
-        String internalFontName = getInternalFontNameForArea(text);
-        this.currentState.setFontName(internalFontName);
-        int currentFontSize = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
-        this.currentState.setFontSize(currentFontSize); 
-        AFPFont font = (AFPFont) fontInfo.getFonts().get(internalFontName);
+        String name = getInternalFontNameForArea(text);
+        currentFontSize = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
+        AFPFont tf = (AFPFont) fontInfo.getFonts().get(name);
 
         Color col = (Color) text.getTrait(Trait.COLOR);
 
-        int vsci = mpts2units(font.getWidth(' ', currentFontSize) / 1000
-                + text.getTextWordSpaceAdjust()
-                + text.getTextLetterSpaceAdjust());
+        int vsci = mpts2units(tf.getWidth(' ', currentFontSize) / 1000
+                                + text.getTextWordSpaceAdjust()
+                                + text.getTextLetterSpaceAdjust());
 
         // word.getOffset() = only height of text itself
         // currentBlockIPPosition: 0 for beginning of line; nonzero
-        // where previous line area failed to take up entire allocated space
+        //  where previous line area failed to take up entire allocated space
         int rx = currentIPPosition + text.getBorderAndPaddingWidthStart();
-        int bl = currentBPPosition + text.getOffset()
-                + text.getBaselineOffset();
+        int bl = currentBPPosition + text.getOffset() + text.getBaselineOffset();
 
         // Set letterSpacing
-        // float ls = fs.getLetterSpacing() / this.currentFontSize;
+        //float ls = fs.getLetterSpacing() / this.currentFontSize;
 
         String worddata = text.getText();
 
-        AFPPageFonts pageFonts = this.currentState.getPageFonts();
-        AFPFontAttributes afpFontAttributes = pageFonts.registerFont(
-                internalFontName, font, currentFontSize);
+        // Create an AFPFontAttributes object from the current font details
+        AFPFontAttributes afpFontAttributes = new AFPFontAttributes(name, tf, currentFontSize);
+
+        if (!currentPageFonts.containsKey(afpFontAttributes.getFontKey())) {
+            // Font not found on current page, so add the new one
+            pageFontCounter++;
+            afpFontAttributes.setFontReference(pageFontCounter);
+            currentPageFonts.put(
+               afpFontAttributes.getFontKey(),
+               afpFontAttributes);
+
+        } else {
+            // Use the previously stored font attributes
+            afpFontAttributes = (AFPFontAttributes) currentPageFonts.get(
+                    afpFontAttributes.getFontKey());
+        }
 
         // Try and get the encoding to use for the font
         String encoding = null;
 
         try {
-            encoding = font.getCharacterSet(currentFontSize).getEncoding();
+            encoding = tf.getCharacterSet(currentFontSize).getEncoding();
         } catch (Throwable ex) {
             encoding = AFPConstants.EBCIDIC_ENCODING;
-            log.warn("renderText():: Error getting encoding for font "
-                    + " - using default encoding " + encoding);
+            log.warn(
+                "renderText():: Error getting encoding for font "
+                + " - using default encoding "
+                + encoding);
         }
 
         try {
-            afpDataStream.createText(afpFontAttributes.getFontReference(),
-                    mpts2units(rx), pts2units(bl), col, vsci, mpts2units(text
-                            .getTextLetterSpaceAdjust()), worddata
-                            .getBytes(encoding));
+            afpDataStream.createText(
+                afpFontAttributes.getFontReference(),
+                mpts2units(rx),
+                mpts2units(bl),
+                col,
+                vsci,
+                mpts2units(text.getTextLetterSpaceAdjust()),
+                worddata.getBytes(encoding));
         } catch (UnsupportedEncodingException usee) {
-            log.error("renderText:: Font " + afpFontAttributes.getFontKey()
-                    + " caused UnsupportedEncodingException");
+            log.error(
+                "renderText:: Font "
+                + afpFontAttributes.getFontKey()
+                + " caused UnsupportedEncodingException");
         }
 
         super.renderText(text);
 
-        renderTextDecoration(font, currentFontSize, text, bl, rx);
+        renderTextDecoration(tf, currentFontSize, text, bl, rx);
     }
 
     /**
@@ -1192,41 +1366,88 @@
     }
 
     /**
-     * Render leader area. This renders a leader area which is an area with a
-     * rule.
-     * 
-     * @param area
-     *            the leader area to render
+     * Render leader area.
+     * This renders a leader area which is an area with a rule.
+     * @param area the leader area to render
      */
     public void renderLeader(Leader area) {
         renderInlineAreaBackAndBorders(area);
 
         int style = area.getRuleStyle();
-        float startx = (currentIPPosition + area
-                .getBorderAndPaddingWidthStart()) / 1000f;
+        float startx = (currentIPPosition + area.getBorderAndPaddingWidthStart()) / 1000f;
         float starty = (currentBPPosition + area.getOffset()) / 1000f;
-        float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart() + area
-                .getIPD()) / 1000f;
+        float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart()
+                        + area.getIPD()) / 1000f;
         float ruleThickness = area.getRuleThickness() / 1000f;
-        Color col = (Color) area.getTrait(Trait.COLOR);
+        Color col = (Color)area.getTrait(Trait.COLOR);
 
         switch (style) {
-        case EN_SOLID:
-        case EN_DASHED:
-        case EN_DOUBLE:
-        case EN_DOTTED:
-        case EN_GROOVE:
-        case EN_RIDGE:
-            drawBorderLine(startx, starty, endx, starty + ruleThickness, true,
-                    true, style, col);
-            break;
-        default:
-            throw new UnsupportedOperationException("rule style not supported");
+            case EN_SOLID:
+            case EN_DASHED:
+            case EN_DOUBLE:
+            case EN_DOTTED:
+            case EN_GROOVE:
+            case EN_RIDGE:
+                drawBorderLine(startx, starty, endx, starty + ruleThickness,
+                        true, true, style, col);
+                break;
+            default:
+                throw new UnsupportedOperationException("rule style not supported");
         }
         super.renderLeader(area);
     }
 
     /**
+     * Sets the AFPRenderer options
+     * @param options   the <code>Map</code> containing the options
+     */
+// UNUSED
+//     public void setOptions(Map options) {
+//    
+//         this.afpOptions = options;
+//    
+//     }
+    /**
+     * Determines the orientation from the string representation, this method
+     * guarantees to return a value of either 0, 90, 180 or 270.
+     *
+     * @return the orientation
+     */
+// UNUSED
+//     private int getOrientation(String orientationString) {
+//
+//        int orientation = 0;
+//        if (orientationString != null && orientationString.length() > 0) {
+//            try {
+//                orientation = Integer.parseInt(orientationString);
+//            } catch (NumberFormatException nfe) {
+//                log.error("Cannot use orientation of " + orientation
+//                        + " defaulting to zero.");
+//                orientation = 0;
+//            }
+//        } else {
+//            orientation = 0;
+//        }
+//        switch (orientation) {
+//        case 0:
+//            break;
+//        case 90:
+//            break;
+//        case 180:
+//            break;
+//        case 270:
+//            break;
+//        default:
+//            log.error("Cannot use orientation of " + orientation
+//                    + " defaulting to zero.");
+//            orientation = 0;
+//            break;
+//        }
+//
+//        return orientation;
+//
+//    }
+    /**
      * Sets the rotation to be used for portrait pages, valid values are 0
      * (default), 90, 180, 270.
      * 
@@ -1235,13 +1456,14 @@
      */
     public void setPortraitRotation(int rotation) {
 
-        if (rotation == 0 || rotation == 90 || rotation == 180
-                || rotation == 270) {
+        if (rotation == 0
+            || rotation == 90
+            || rotation == 180
+            || rotation == 270) {
             portraitRotation = rotation;
         } else {
-            throw new IllegalArgumentException(
-                    "The portrait rotation must be one"
-                            + " of the values 0, 90, 180, 270");
+            throw new IllegalArgumentException("The portrait rotation must be one"
+                + " of the values 0, 90, 180, 270");
 
         }
 
@@ -1250,19 +1472,20 @@
     /**
      * Sets the rotation to be used for landsacpe pages, valid values are 0, 90,
      * 180, 270 (default).
-     * 
+     *  
      * @param rotation
      *            The rotation in degrees.
      */
     public void setLandscapeRotation(int rotation) {
 
-        if (rotation == 0 || rotation == 90 || rotation == 180
-                || rotation == 270) {
+        if (rotation == 0
+            || rotation == 90
+            || rotation == 180
+            || rotation == 270) {
             landscapeRotation = rotation;
         } else {
-            throw new IllegalArgumentException(
-                    "The landscape rotation must be one"
-                            + " of the values 0, 90, 180, 270");
+            throw new IllegalArgumentException("The landscape rotation must be one"
+                + " of the values 0, 90, 180, 270");
         }
 
     }
@@ -1270,7 +1493,7 @@
     /**
      * Get the MIME type of the renderer.
      * 
-     * @return The MIME type of the renderer
+     * @return   The MIME type of the renderer
      */
     public String getMimeType() {
         return MimeConstants.MIME_AFP;
@@ -1280,8 +1503,7 @@
      * Method to render the page extension.
      * <p>
      * 
-     * @param pageViewport
-     *            the page object
+     * @param pageViewport the page object
      */
     private void renderPageObjectExtensions(PageViewport pageViewport) {
 
@@ -1292,7 +1514,7 @@
             // the s-p-m
             Iterator i = pageViewport.getExtensionAttachments().iterator();
             while (i.hasNext()) {
-                ExtensionAttachment attachment = (ExtensionAttachment) i.next();
+                ExtensionAttachment attachment = (ExtensionAttachment)i.next();
                 if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
                     AFPPageSetup aps = (AFPPageSetup) attachment;
                     String element = aps.getElementName();
@@ -1331,9 +1553,7 @@
 
     /**
      * Converts FOP mpt measurement to afp measurement units
-     * 
-     * @param mpt
-     *            the millipoints value
+     * @param mpt the millipoints value
      */
     private int mpts2units(int mpt) {
         return mpts2units((double) mpt);
@@ -1341,9 +1561,7 @@
 
     /**
      * Converts FOP pt measurement to afp measurement units
-     * 
-     * @param mpt
-     *            the millipoints value
+     * @param mpt the millipoints value
      */
     private int pts2units(float mpt) {
         return mpts2units(mpt * 1000d);
@@ -1357,8 +1575,7 @@
      * @return afp measurement unit value
      */
     private int mpts2units(double mpt) {
-        return (int) Math
-                .round(mpt / (DPI_CONVERSION_FACTOR / getResolution()));
+        return (int)Math.round(mpt / (DPI_CONVERSION_FACTOR / getResolution()));
     }
 
     /**
@@ -1422,7 +1639,7 @@
         io.setImageIDESize((byte) bitsPerPixel);
         io.setImageData(bw);
     }
-
+    
     private final class ViewPortPos {
         private int x = 0;
 
@@ -1531,8 +1748,7 @@
     private void popViewPortPos() {
         viewPortPositions.remove(viewPortPositions.size() - 1);
         if (viewPortPositions.size() > 0) {
-            ViewPortPos vpp = (ViewPortPos) viewPortPositions
-                    .get(viewPortPositions.size() - 1);
+            ViewPortPos vpp = (ViewPortPos)viewPortPositions.get(viewPortPositions.size() - 1);
             afpDataStream.setOffsets(vpp.x, vpp.y, vpp.rot);
         }
     }
@@ -1546,9 +1762,9 @@
     public void setBitsPerPixel(int bitsPerPixel) {
         this.bitsPerPixel = bitsPerPixel;
         switch (bitsPerPixel) {
-        case 1:
-        case 4:
-        case 8:
+            case 1:
+            case 4:
+            case 8:
             break;
         default:
             log.warn("Invalid bits_per_pixel value, must be 1, 4 or 8.");
@@ -1568,36 +1784,20 @@
     }
 
     /**
-     * Returns the AFPDataStream
-     * 
-     * @return the AFPDataStream
-     */
-    public AFPDataStream getAFPDataStream() {
-        return afpDataStream;
-    }
-
-    /**
      * Sets the output/device resolution
      * 
      * @param resolution
      *            the output resolution (dpi)
      */
     public void setResolution(int resolution) {
-        if (resolution == DPI_240_RESOLUTION
-                || resolution == DPI_1440_RESOLUTION) {
-            this.resolution = resolution;
-            if (log.isDebugEnabled()) {
-                log.debug("renderer-resolution set to: " + resolution + " dpi");
-            }
-        } else {
-            log.error("invalid resolution, can only be " + DPI_240_RESOLUTION
-                    + " or " + DPI_1440_RESOLUTION + " dpi");
+        if (log.isDebugEnabled()) {
+            log.debug("renderer-resolution set to: " + resolution + "dpi");
         }
+        this.resolution = resolution;
     }
-
+    
     /**
      * Returns the output/device resolution.
-     * 
      * @return the resolution in dpi
      */
     public int getResolution() {

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java Thu Mar  6 05:33:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.render.afp;
 
@@ -239,8 +239,7 @@
             
             Configuration rendererResolutionCfg = cfg.getChild("renderer-resolution", false);
             if (rendererResolutionCfg != null) {
-                afpRenderer.setResolution(rendererResolutionCfg.getValueAsInteger(
-                        AFPRenderer.DPI_240_RESOLUTION));
+                afpRenderer.setResolution(rendererResolutionCfg.getValueAsInteger(240));
             }
         }
     }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id



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