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/12/09 16:00:42 UTC

svn commit: r724729 [2/6] - in /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign: ./ conf/ lib/ src/documentation/content/xdocs/ src/documentation/content/xdocs/dev/svg/ src/documentation/content/xdocs/trunk/ src/java/META-INF/services/ src/java/org/apa...

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml Tue Dec  9 07:00:35 2008
@@ -421,7 +421,7 @@
             be controlled through the "target resolution" setting in the 
             <a href="configuration.html">configuration</a>.</p>
           <p>
-            Currently transparency is limited in PDF so many SVG images that
+            Currently transparency is limited in PDF so some SVG images that
             contain effects or graphics with transparent areas may not be displayed
             correctly.
           </p>
@@ -431,11 +431,15 @@
           <p>If possible, Batik will use normal PDF or PostScript text when inserting text. It does
             this by checking if the text can be drawn normally and the font is
             supported. This example svg <a href="../dev/svg/text.svg">text.svg</a> /
-            <!--link href="../dev/svg/text.pdf"-->text.pdf<!--/link-->
+            <a href="../dev/svg/text.pdf">text.pdf</a> / <a href="../dev/svg/text.png">text.png</a>
             shows how various types and effects with text are handled.
-            Note that tspan and outlined text are not yet implemented.</p>
+            Note that SVG font support is not yet implemented. Furthermore, text handling in
+            PostScript output is inferior to PDF output - more text will be painted as shapes in
+            PS than in PDF.
+          </p>
           <p>
-            Otherwise, text is converted and drawn as a set of shapes by Batik, using the
+            When there's no support to paint text using native text operations,
+            text is converted and drawn as a set of shapes by Batik, using the
             stroking text painter. This means that a typical character will
             have about 10 curves (each curve consists of at least 20 characters).
             This can make the output files large and when it is viewed the
@@ -451,7 +455,30 @@
             "smooth line art" and "smooth text" settings that may need to be set for SVG images 
             to be displayed nicely on your screen (see Edit / Preferences / Display).
             This setting will not affect the printing of your document, which should be OK in 
-            any case, but will only affect the quality of the screen display.</p>
+            any case, but will only affect the quality of the screen display.
+          </p>
+        </section>
+        <section id="svg-font-selection">
+          <title>Font selection notes</title>
+          <p>
+            Apache Batik uses the AWT/Java2D subsystem as font source while FOP has its on font
+            subsystem. Great care has been taken that font selection does the best possible choices.
+            But it must be noted when creating PDF or PostScript that a font used in SVG graphics
+            needs to be registered with the operating system as well as in FOP's configuration.
+            By using FOP's font auto-detection, you simply have to install the font in the operating
+            system and not care about anything else. This is less of an issue if you create
+            formats like TIFFs, PNGs or PCL because in these cases SVG graphics are usually rendered
+            to bitmaps which means that on both sides (Batik and FOP), AWT/Java2D is used as the
+            single font source.
+          </p>
+          <p>
+            Whenever an SVG is converted into a PDF or PostScript file, the font that has been used
+            inside Batik has to be mapped to a font used by the actual output format. Features like
+            font substitution in FOP may need to be taken into account but can also be an advantage
+            when working around font mapping issues. Like for XSL-FO content, you'll get a warning
+            if a particular font could not be found and had to be substituted, or if a particular
+            glyph is missing in a font.
+          </p> 
         </section>
         <section id="svg-scaling">
           <title>Scaling</title>

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/output.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/output.xml?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/output.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/output.xml Tue Dec  9 07:00:35 2008
@@ -479,7 +479,7 @@
     <section id="afp-configuration">
       <title>Configuration</title>
       <section id="afp-font-config">
-        <title>Fonts</title>
+      <title>Fonts</title>
       <p>The AFP Renderer requires special configuration particularly related to fonts.
       AFP Render configuration is done through the normal FOP configuration file. The MIME type
       for the AFP Renderer is application/x-afp which means the AFP Renderer section in the FOP configuration file
@@ -615,16 +615,33 @@
       <section id="afp-image-config">
         <title>Images</title>
         <p>By default the AFP Renderer converts all images to 8 bit grey level.
-        This can be overridden by the &lt;images&gt; configuration element. Example:</p>
+        This can be overridden by the &lt;images/&gt; configuration element. Example:</p>
       <source><![CDATA[
       <images mode="color" />
 ]]></source>
       <p>This will put images as RGB images into the AFP output stream. The default setting is:</p>
       <source><![CDATA[
-      <images mode="b+w" bits-per-pixel="8" />
+      <images mode="b+w" bits-per-pixel="8" native="true"/>
 ]]></source>
-      <p>Only the values "color" and "b+w" are allowed for the mode attribute. The bits-per-pixel
-      attribute is ignored if mode is "color". For "b+w" mode is must be 1, 4, or 8.</p>
+      <p>Only the values "color" and "b+w" are allowed for the mode attribute.</p>
+      <p>The bits-per-pixel attribute is ignored if mode is "color". For "b+w" mode is must be 1, 4, or 8.</p>
+      <source><![CDATA[
+      <images native="true"/>
+]]></source>
+      <p>When the native attribute is specified and set to "true", all image resources will be natively injected
+      into the datastream using an object container rather than being converted into an IOCA FS45 image.
+      Support for native image formats (e.g. JPEG, GIF) is not always available on printer implementations
+      so by default this configuration option is set to "false".</p>
+      </section>
+      <section id="afp-resource-group-file">
+      <title>Resource Group File</title>
+      <p>By default the AFP Renderer will place all data resource objects such as images within
+      the document of the main output datastream.  An external resource group file where document resources
+      may be specified with the &lt;resource-group-file/&gt; configuration element.  Example:</p>
+      <source><![CDATA[
+      <resource-group-file>external_resources.afp</resource-group-file>
+]]></source>
+      <note>Be careful when using this option not to overwrite existing resource files from previous rendering runs.</note>
       </section>
     </section>
     <section id="afp-extensions">
@@ -709,6 +726,43 @@
         </p>
       </section>
     </section>
+    <section id="afp-foreign-attributes">
+      <title>Foreign Attributes</title>
+        <section id="afp-foreign-attributes-resource">
+        <title>Resource</title>
+        <p>The resource foreign attributes provides the ability to name and control where data object resources
+        (e.g. images/scalable vector graphics) will reside in the AFP output.
+        The afp foreign attributes are only used in conjuntion with &lt;fo:external-graphic/&gt; and &lt;instream-foreign-object/&gt;.
+        Example:</p>
+      <source><![CDATA[
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
+     xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp">
+     ...
+     <fo:block>
+      <fo:external-graphic width="2.0cm" content-width="2.0cm" height="1.8cm" content-height="1.8cm"
+        src="examples/fo/graphics/xml_feather.gif"
+        afp:resource-name="feather" afp:resource-level="external" afp:resource-group-file="resources.afp"/>
+     </fo:block>
+     <fo:block>
+      <fo:instream-foreign-object height="758.047pt" content-height="758.047pt" width="576.96pt" content-width="576.96pt"
+      afp:resource-name"circles" afp:resource-level="inline">
+       <svg xmlns="http://www.w3.org/2000/svg" width="12cm" height="12cm">
+        <g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
+         <circle cx="6cm" cy="2cm" r="100" style="fill:red;" transform="translate(0,50)" />
+         <circle cx="6cm" cy="2cm" r="100" style="fill:blue;" transform="translate(70,150)" />
+         <circle cx="6cm" cy="2cm" r="100" style="fill:green;" transform="translate(-70,150)"/>
+        </g>
+       </svg>
+      </fo:instream-foreign-object>
+     </fo:block>
+]]></source>
+        <p>The resource-level attribute where the resource object will reside in the AFP output datastream.
+        The possible values for this are "inline", "print-file" and "external".
+        When no resource-level attribute is provided, resources are by default placed at "print-file" level.
+        When "external" is used a resource-group-file attribute must also be specified.</p>
+        <p></p>
+      </section>
+    </section>
   </section>
 <section id="rtf">
   <title>RTF</title>

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  9 07:00:35 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:699793-719661
+/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:699793-724689

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/apps/MimeConstants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/apps/MimeConstants.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/apps/MimeConstants.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/apps/MimeConstants.java Tue Dec  9 07:00:35 2008
@@ -22,50 +22,7 @@
 /**
  * Frequently used MIME types for various file formats used when working with Apache FOP.
  */
-public interface MimeConstants {
-
-    /** Portable Document Format */
-    String MIME_PDF             = "application/pdf";
-
-    /** PostScript */
-    String MIME_POSTSCRIPT      = "application/postscript";
-    /** Encapsulated PostScript (same MIME type as PostScript) */
-    String MIME_EPS             = MIME_POSTSCRIPT;
-
-    /** HP's PCL */
-    String MIME_PCL             = "application/x-pcl";
-    /** HP's PCL (alternative MIME type) */
-    String MIME_PCL_ALT         = "application/vnd.hp-PCL";
-
-    /** IBM's AFP */
-    String MIME_AFP             = "application/x-afp";
-    /** IBM's AFP (alternative MIME type) */
-    String MIME_AFP_ALT         = "application/vnd.ibm.modcap";
-
-    /** Plain text */
-    String MIME_PLAIN_TEXT      = "text/plain";
-
-    /** Rich text format */
-    String MIME_RTF             = "application/rtf";
-    /** Rich text format (alternative 1) */
-    String MIME_RTF_ALT1        = "text/richtext";
-    /** Rich text format (alternative 2) */
-    String MIME_RTF_ALT2        = "text/rtf";
-
-    /** FrameMaker's MIF */
-    String MIME_MIF             = "application/mif";
-
-    /** Scalable Vector Graphics */
-    String MIME_SVG             = "image/svg+xml";
-
-    /** GIF images */
-    String MIME_GIF             = "image/gif";
-    /** PNG images */
-    String MIME_PNG             = "image/png";
-    /** JPEG images */
-    String MIME_JPEG            = "image/jpeg";
-    /** TIFF images */
-    String MIME_TIFF            = "image/tiff";
+public interface MimeConstants extends org.apache.xmlgraphics.util.MimeConstants {
 
     /** Apache FOP's AWT preview (non-standard MIME type) */
     String MIME_FOP_AWT_PREVIEW = "application/X-fop-awt-preview";
@@ -75,7 +32,4 @@
     String MIME_FOP_AREA_TREE   = "application/X-fop-areatree";
     /** Apache FOP's intermediate format XML */
     String MIME_FOP_IF          = "application/X-fop-intermediate-format";
-    /** Proposed but non-registered MIME type for XSL-FO */
-    String MIME_XSL_FO          = "text/xsl";
-
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Area.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Area.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Area.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Area.java Tue Dec  9 07:00:35 2008
@@ -119,8 +119,10 @@
     public static final int CLASS_MAX = CLASS_SIDE_FLOAT + 1;
 
     private int areaClass = CLASS_NORMAL;
+    
     /** the area's inline-progression-dimension */
     protected int ipd;
+
     /** the area's block-progression-dimension */
     protected int bpd;
 
@@ -141,7 +143,7 @@
      * @return the area class
      */
     public int getAreaClass() {
-        return areaClass;
+        return this.areaClass;
     }
 
     /**
@@ -157,11 +159,11 @@
      * Set the inline progression dimension of content rectangle
      * for this area.
      *
-     * @param i the new inline progression dimension
-     * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">ipd</a>
+     * @param ipd the new inline progression dimension
+     * @see <a href="http://www.w3.org/TR/xsl/#inline-progression-dimension">ipd</a>
      */
-    public void setIPD(int i) {
-        ipd = i;
+    public void setIPD(int ipd) {
+        this.ipd = ipd;
     }
 
     /**
@@ -169,10 +171,10 @@
      * for this area.
      *
      * @return the inline progression dimension
-     * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">ipd</a>
+     * @see <a href="http://www.w3.org/TR/xsl/#inline-progression-dimension">ipd</a>
      */
     public int getIPD() {
-        return ipd;
+        return this.ipd;
     }
 
     /**
@@ -180,7 +182,7 @@
      * for this area.
      *
      * @param b the new block progression dimension
-     * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">bpd</a>
+     * @see <a href="http://www.w3.org/TR/xsl/#block-progression-dimension">bpd</a>
      */
     public void setBPD(int b) {
         bpd = b;
@@ -191,7 +193,7 @@
      * for this area.
      *
      * @return the block progression dimension
-     * @see <a href="http://www.w3.org/TR/xsl/slice4.html#area-common">bpd</a>
+     * @see <a href="http://www.w3.org/TR/xsl/#block-progression-dimension">bpd</a>
      */
     public int getBPD() {
         return bpd;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeHandler.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeHandler.java Tue Dec  9 07:00:35 2008
@@ -101,12 +101,12 @@
 
         setupModel(userAgent, outputFormat, stream);
 
-        lmMaker = userAgent.getFactory().getLayoutManagerMakerOverride();
+        this.lmMaker = userAgent.getFactory().getLayoutManagerMakerOverride();
         if (lmMaker == null) {
             lmMaker = new LayoutManagerMapping();
         }
 
-        idTracker = new IDTracker();
+        this.idTracker = new IDTracker();
 
         if (log.isDebugEnabled()) {
             statistics = new Statistics();
@@ -124,7 +124,7 @@
      */
     protected void setupModel(FOUserAgent userAgent, String outputFormat,
             OutputStream stream) throws FOPException {
-        model = new RenderPagesModel(userAgent, outputFormat, fontInfo, stream);
+        this.model = new RenderPagesModel(userAgent, outputFormat, fontInfo, stream);
     }
 
     /**
@@ -133,7 +133,7 @@
      * @return AreaTreeModel the model being used for this area tree
      */
     public AreaTreeModel getAreaTreeModel() {
-        return model;
+        return this.model;
     }
 
     /**
@@ -143,7 +143,7 @@
      *         area tree
      */
     public LayoutManagerMaker getLayoutManagerMaker() {
-        return lmMaker;
+        return this.lmMaker;
     }
 
     /**
@@ -152,7 +152,7 @@
      * @return IDTracker used to track reference ids for items in this area tree
      */
     public IDTracker getIDTracker() {
-        return idTracker;
+        return this.idTracker;
     }
 
     /**
@@ -207,9 +207,9 @@
     }
 
     private void wrapAndAddExtensionAttachments(List list) {
-        Iterator i = list.iterator();
-        while (i.hasNext()) {
-            ExtensionAttachment attachment = (ExtensionAttachment) i.next();
+        Iterator it = list.iterator();
+        while (it.hasNext()) {
+            ExtensionAttachment attachment = (ExtensionAttachment) it.next();
             addOffDocumentItem(new OffDocumentExtensionAttachment(attachment));
         }
     }
@@ -357,7 +357,7 @@
      *
      * @param id the property ID of the area
      * @param pv a page viewport that contains the area with this ID
-     * @deprecated use getIdTracker().associateIDWithPageViewport(id, pv) instead
+     * @deprecated use getIDTracker().associateIDWithPageViewport(id, pv) instead
      */
     public void associateIDWithPageViewport(String id, PageViewport pv) {
         idTracker.associateIDWithPageViewport(id, pv);
@@ -369,7 +369,7 @@
      * know when an id can be resolved.
      *
      * @param id the id of the object being processed
-     * @deprecated use getIdTracker().signalPendingID(id) instead
+     * @deprecated use getIDTracker().signalPendingID(id) instead
      */
     public void signalPendingID(String id) {
         idTracker.signalPendingID(id);
@@ -381,7 +381,7 @@
      * ref-ids can be resolved.
      *
      * @param id the id of the formatting object which was just finished
-     * @deprecated use getIdTracker().signalIDProcessed(id) instead
+     * @deprecated use getIDTracker().signalIDProcessed(id) instead
      */
     public void signalIDProcessed(String id) {
         idTracker.signalIDProcessed(id);
@@ -392,7 +392,7 @@
      *
      * @param id the id to check
      * @return true if the ID has been resolved
-     * @deprecated use getIdTracker().alreadyResolvedID(id) instead
+     * @deprecated use getIDTracker().alreadyResolvedID(id) instead
      */
     public boolean alreadyResolvedID(String id) {
         return idTracker.alreadyResolvedID(id);
@@ -402,7 +402,7 @@
      * Tries to resolve all unresolved ID references on the given page.
      *
      * @param pv page viewport whose ID refs to resolve
-     * @deprecated use getIdTracker().tryIDResolution(pv) instead
+     * @deprecated use getIDTracker().tryIDResolution(pv) instead
      */
     public void tryIDResolution(PageViewport pv) {
         idTracker.tryIDResolution(pv);
@@ -413,7 +413,7 @@
      *
      * @param id the id to lookup
      * @return the list of PageViewports
-     * @deprecated use getIdTracker().getPageViewportsContainingID(id) instead
+     * @deprecated use getIDTracker().getPageViewportsContainingID(id) instead
      */
     public List getPageViewportsContainingID(String id) {
         return idTracker.getPageViewportsContainingID(id);
@@ -424,7 +424,7 @@
      *
      * @param idref the idref whose target id has not yet been located
      * @param res the Resolvable object needing the idref to be resolved
-     * @deprecated use getIdTracker().addUnresolvedIDRef(idref, res) instead
+     * @deprecated use getIDTracker().addUnresolvedIDRef(idref, res) instead
      */
     public void addUnresolvedIDRef(String idref, Resolvable res) {
         idTracker.addUnresolvedIDRef(idref, res);

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeModel.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeModel.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeModel.java Tue Dec  9 07:00:35 2008
@@ -36,11 +36,11 @@
  * the life of the area tree model.
  */
 public class AreaTreeModel {
-    private List pageSequenceList = null;
+    private List/*<PageSequence>*/ pageSequenceList = null;
     private int currentPageSequenceIndex = -1;
     /** the current page sequence */
     protected PageSequence currentPageSequence;
-    private List offDocumentItems = new java.util.ArrayList();
+//    private List offDocumentItems = new java.util.ArrayList();
     /** logger instance */
     protected static Log log = LogFactory.getLog(AreaTreeModel.class);
 
@@ -48,7 +48,7 @@
      * Create a new store pages model
      */
     public AreaTreeModel() {
-        pageSequenceList = new java.util.ArrayList();
+        pageSequenceList = new java.util.ArrayList/*<PageSequence>*/();
     }
 
     /**
@@ -83,13 +83,13 @@
      * Handle an OffDocumentItem
      * @param ext the extension to handle
      */
-    public void handleOffDocumentItem(OffDocumentItem ext) {};
+    public void handleOffDocumentItem(OffDocumentItem ext) { };
 
     /**
      * Signal the end of the document for any processing.
      * @throws SAXException if a problem was encountered.
      */
-    public void endDocument() throws SAXException {};
+    public void endDocument() throws SAXException { };
 
     /**
      * Returns the currently active page-sequence.

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeObject.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/AreaTreeObject.java Tue Dec  9 07:00:35 2008
@@ -21,6 +21,7 @@
 
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.xmlgraphics.util.QName;
@@ -33,6 +34,9 @@
     /** Foreign attributes */
     protected Map foreignAttributes = null;
 
+    /** Extension attachments */
+    protected List/*<ExtensionAttachment>*/ extensionAttachments = null;
+    
     /**
      * Sets a foreign attribute.
      * @param name the qualified name of the attribute
@@ -83,6 +87,21 @@
             return Collections.EMPTY_MAP;
         }
     }
+    
+    /**
+     * Set extension attachments from a List 
+     * @param extensionAttachments a List with extension attachments
+     */
+    public void setExtensionAttachments(List extensionAttachments) {
+        this.extensionAttachments = extensionAttachments;
+    }
 
-
+    /** @return the extension attachments associated with this area */
+    public List getExtensionAttachments() {
+        if (this.foreignAttributes != null) {
+            return Collections.unmodifiableList(this.extensionAttachments);
+        } else {
+            return Collections.EMPTY_LIST;
+        }
+    }    
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/IDTracker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/IDTracker.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/IDTracker.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/IDTracker.java Tue Dec  9 07:00:35 2008
@@ -20,8 +20,6 @@
 package org.apache.fop.area;
 
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -36,20 +34,20 @@
  */
 public class IDTracker {
 
-    private static Log log = LogFactory.getLog(IDTracker.class);
+    private static final Log log = LogFactory.getLog(IDTracker.class);
 
     // HashMap of ID's whose area is located on one or more consecutive
     // PageViewports. Each ID has an arraylist of PageViewports that
     // form the defined area of this ID
-    private Map idLocations = new HashMap();
+    private Map idLocations = new java.util.HashMap();
 
     // idref's whose target PageViewports have yet to be identified
     // Each idref has a HashSet of Resolvable objects containing that idref
-    private Map unresolvedIDRefs = new HashMap();
+    private Map unresolvedIDRefs = new java.util.HashMap();
 
-    private Set unfinishedIDs = new HashSet();
+    private Set unfinishedIDs = new java.util.HashSet();
 
-    private Set alreadyResolvedIDs = new HashSet();
+    private Set alreadyResolvedIDs = new java.util.HashSet();
 
     /**
      * Tie a PageViewport with an ID found on a child area of the PV. Note that
@@ -198,7 +196,7 @@
     public void addUnresolvedIDRef(String idref, Resolvable res) {
         Set todo = (Set) unresolvedIDRefs.get(idref);
         if (todo == null) {
-            todo = new HashSet();
+            todo = new java.util.HashSet();
             unresolvedIDRefs.put(idref, todo);
         }
         // add Resolvable object to this HashSet

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/PageViewport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/PageViewport.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/PageViewport.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/PageViewport.java Tue Dec  9 07:00:35 2008
@@ -89,7 +89,7 @@
 
     //Arbitrary attachments to the page from extensions that need to pass information
     //down to the renderers.
-    private List extensionAttachments = null;
+    private List/*<ExtensionAttachment>*/ extensionAttachments = null;
 
     /**
      * logging instance
@@ -122,7 +122,8 @@
      */
     public PageViewport(PageViewport original) {
         if (original.extensionAttachments != null) {
-            this.extensionAttachments = new java.util.ArrayList(original.extensionAttachments);
+            this.extensionAttachments
+                = new java.util.ArrayList/*<ExtensionAttachment>*/(original.extensionAttachments);
         }
         this.pageIndex = original.pageIndex;
         this.pageNumber = original.pageNumber;
@@ -588,7 +589,7 @@
      */
     public void addExtensionAttachment(ExtensionAttachment attachment) {
         if (this.extensionAttachments == null) {
-            this.extensionAttachments = new java.util.ArrayList();
+            this.extensionAttachments = new java.util.ArrayList/*<ExtensionAttachment>*/();
         }
         extensionAttachments.add(attachment);
     }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RegionReference.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RegionReference.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RegionReference.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RegionReference.java Tue Dec  9 07:00:35 2008
@@ -160,4 +160,13 @@
         return rr;
     }
 
+    /** {@inheritDoc} */
+    public String toString() {
+        StringBuffer sb = new StringBuffer(super.toString());
+        sb.append(" {regionName=").append(regionName);
+        sb.append(", regionClass=").append(regionClass);
+        sb.append(", ctm=").append(ctm);
+        sb.append("}");
+        return sb.toString();
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RenderPagesModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RenderPagesModel.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RenderPagesModel.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/RenderPagesModel.java Tue Dec  9 07:00:35 2008
@@ -50,9 +50,9 @@
     /**
      * Pages that have been prepared but not rendered yet.
      */
-    protected List prepared = new java.util.ArrayList();
-    private List pendingODI = new java.util.ArrayList();
-    private List endDocODI = new java.util.ArrayList();
+    protected List/*<PageViewport>*/ prepared = new java.util.ArrayList/*<PageViewport>*/();
+    private List/*<OffDocumentItem>*/ pendingODI = new java.util.ArrayList/*<OffDocumentItem>*/();
+    private List/*<OffDocumentItem>*/ endDocODI = new java.util.ArrayList/*<OffDocumentItem>*/();
 
     /**
      * Create a new render pages model with the given renderer.
@@ -66,7 +66,7 @@
         FontInfo fontInfo, OutputStream stream) throws FOPException {
 
         super();
-        renderer = userAgent.getRendererFactory().createRenderer(
+        this.renderer = userAgent.getRendererFactory().createRenderer(
                 userAgent, outputFormat);
 
         try {

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/FilledArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/FilledArea.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/FilledArea.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/FilledArea.java Tue Dec  9 07:00:35 2008
@@ -70,10 +70,10 @@
     /**
      * Set the unit width for the areas to fill the full width.
      *
-     * @param w the unit width
+     * @param width the unit width
      */
-    public void setUnitWidth(int w) {
-        unitWidth = w;
+    public void setUnitWidth(int width) {
+        this.unitWidth = width;
     }
 
     /**
@@ -82,7 +82,7 @@
      * @return the unit width
      */
     public int getUnitWidth() {
-        return unitWidth;
+        return this.unitWidth;
     }
 
     /**
@@ -117,7 +117,7 @@
     }
 
     /**
-     * recursively apply the variation factor to all descendant areas
+     * Recursively apply the variation factor to all descendant areas
      * @param variationFactor the variation factor that must be applied to adjustments
      * @param lineStretch     the total stretch of the line
      * @param lineShrink      the total shrink of the line

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Image.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Image.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Image.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Image.java Tue Dec  9 07:00:35 2008
@@ -28,14 +28,14 @@
  */
 public class Image extends Area {
     private String url;
-
+    
     /**
      * Create a new image with the given url.
      *
-     * @param u the url of the image
+     * @param url the url of the image
      */
-    public Image(String u) {
-        url = u;
+    public Image(String url) {
+        this.url = url;
     }
 
     /**
@@ -45,7 +45,7 @@
      * @return the url of this image
      */
     public String getURL() {
-        return url;
+        return this.url;
     }
 }
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/InlineArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/InlineArea.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/InlineArea.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/InlineArea.java Tue Dec  9 07:00:35 2008
@@ -221,7 +221,7 @@
         notifyIPDVariation(ipdVariation);
     }
 
-        /**
+    /**
      * notify the parent area about the ipd variation of this area
      * or of a descendant area
      * @param ipdVariation the difference between new and old ipd

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/TextArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/TextArea.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/TextArea.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/TextArea.java Tue Dec  9 07:00:35 2008
@@ -63,6 +63,7 @@
      *
      * @param word   the word string
      * @param offset the offset for the next area
+     * @param letterAdjust the letter adjustment array (may be null)
      */
     public void addWord(String word, int offset, int[] letterAdjust) {
         WordArea wordArea = new WordArea(word, offset, letterAdjust);
@@ -98,7 +99,7 @@
         StringBuffer text = new StringBuffer();
         InlineArea child;
         // assemble the text
-        for (int i = 0; i < inlines.size(); i ++) {
+        for (int i = 0; i < inlines.size(); i++) {
             child = (InlineArea) inlines.get(i);
             if (child instanceof WordArea) {
                 text.append(((WordArea) child).getWord());
@@ -109,5 +110,9 @@
         return text.toString();
     }
 
+    /** {@inheritDoc} */
+    public String toString() {
+        return "TextArea{text=" + getText() + "}";
+    }
 }
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Viewport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Viewport.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Viewport.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/inline/Viewport.java Tue Dec  9 07:00:35 2008
@@ -45,7 +45,7 @@
      * @param child the child content area of this viewport
      */
     public Viewport(Area child) {
-        content = child;
+        this.content = child;
     }
 
     /**
@@ -54,7 +54,7 @@
      * @param c true if this viewport should clip
      */
     public void setClip(boolean c) {
-        clip = c;
+        this.clip = c;
     }
 
     /**
@@ -63,7 +63,7 @@
      * @return true if this viewport should clip
      */
     public boolean getClip() {
-        return clip;
+        return this.clip;
     }
 
     /**
@@ -72,7 +72,7 @@
      * @param cp the position and size to place the content
      */
     public void setContentPosition(Rectangle2D cp) {
-        contentPosition = cp;
+        this.contentPosition = cp;
     }
 
     /**
@@ -81,7 +81,7 @@
      * @return the position and size to place the content
      */
     public Rectangle2D getContentPosition() {
-        return contentPosition;
+        return this.contentPosition;
     }
 
     /**
@@ -98,7 +98,7 @@
      * @return the content area
      */
     public Area getContent() {
-        return content;
+        return this.content;
     }
 
     private void writeObject(java.io.ObjectOutputStream out)
@@ -123,9 +123,9 @@
                                                     in.readFloat(),
                                                     in.readFloat());
         }
-        clip = in.readBoolean();
-        props = (HashMap) in.readObject();
-        content = (Area) in.readObject();
+        this.clip = in.readBoolean();
+        this.props = (HashMap) in.readObject();
+        this.content = (Area) in.readObject();
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/InputHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/InputHandler.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/InputHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/cli/InputHandler.java Tue Dec  9 07:00:35 2008
@@ -51,6 +51,9 @@
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.render.awt.viewer.Renderable;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
 
 /**
  * Class for handling files input from command line

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/events/EventFormatter.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/events/EventFormatter.xml?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/events/EventFormatter.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/events/EventFormatter.xml Tue Dec  9 07:00:35 2008
@@ -23,6 +23,7 @@
   <message key="rule.childOfSPM">The element must be a child of fo:simple-page-master.</message>
   <message key="rule.childOfDeclarations">The element must be a child of fo:declarations.</message>
   <message key="rule.childOfSPMorDeclarations">The element must be a child of fo:declarations or fo:simple-page-master.</message>
+  <message key="rule.childOfInstreamForeignObjectorExternalGraphic">The element must be a child of fo:instream-foreign-object or fo:external-graphic.</message>
   <message key="rule.wrapperInvalidChildForParent">An fo:wrapper is only permitted to have children that would be permitted for its parent.</message>
   <message key="org.apache.fop.fo.FOValidationEventProducer.tooManyNodes">For "{elementName}", only one "{offendingNode}" may be declared.{{locator}}</message>
   <message key="org.apache.fop.fo.FOValidationEventProducer.nodeOutOfOrder">For "{elementName}", "{tooLateNode}" must be declared before "{tooEarlyNode}"!{{locator}}</message>
@@ -99,4 +100,7 @@
   <message key="org.apache.fop.fonts.FontEventAdapter.fontSubstituted">Font "{requested}" not found. Substituting with "{effective}".</message>
   <message key="org.apache.fop.fonts.FontEventAdapter.fontLoadingErrorAtAutoDetection">Unable to load font file: {fontURL}.[ Reason: {e}]</message>
   <message key="org.apache.fop.fonts.FontEventAdapter.glyphNotAvailable">Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}".</message>
+<message key="org.apache.fop.afp.AFPEventProducer.warnDefaultFontSetup"/>
+<message key="org.apache.fop.afp.AFPEventProducer.warnMissingDefaultFont"/>
+<message key="org.apache.fop.afp.AFPEventProducer.characterSetEncodingError"/>
 </catalogue>

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/ElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/ElementMapping.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/ElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/ElementMapping.java Tue Dec  9 07:00:35 2008
@@ -39,6 +39,7 @@
 
     /** The HashMap table of formatting objects defined by the ElementMapping */
     protected HashMap foObjs = null;
+    //Please don't change that to java.util.Map as that can break extensions.
 
     /** The namespace for the ElementMapping */
     protected String namespaceURI = null;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/FObj.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/FObj.java Tue Dec  9 07:00:35 2008
@@ -573,6 +573,11 @@
         }
     }
 
+    /** @return true if this FObj has extension attachments */ 
+    public boolean hasExtensionAttachments() {
+        return extensionAttachments != null;
+    }
+    
     /**
      * Adds a foreign attribute to this FObj.
      * @param attributeName the attribute name as a QName instance

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/Marker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/Marker.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/Marker.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/Marker.java Tue Dec  9 07:00:35 2008
@@ -34,6 +34,7 @@
 import org.apache.fop.fo.PropertyListMaker;
 import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.properties.Property;
+import org.apache.fop.fo.properties.PropertyCache;
 
 /**
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_marker">
@@ -334,10 +335,10 @@
     }
 
     /** Convenience inner class */
-    private static final class MarkerAttribute {
+    public static final class MarkerAttribute {
 
-        private static Map attributeCache =
-            Collections.synchronizedMap(new java.util.WeakHashMap());
+        private static PropertyCache attributeCache =
+                new PropertyCache(MarkerAttribute.class);
 
         protected String namespace;
         protected String qname;
@@ -373,18 +374,26 @@
         private static MarkerAttribute getInstance(
                                             String namespace, String qname,
                                             String name, String value) {
-            MarkerAttribute newInstance =
-                new MarkerAttribute(namespace, qname, name, value);
-            if (attributeCache.containsKey(newInstance)) {
-                return (MarkerAttribute) attributeCache.get(newInstance);
-            } else {
-                attributeCache.put(newInstance, newInstance);
-                return newInstance;
-            }
+            return attributeCache.fetch(
+                    new MarkerAttribute(namespace, qname, name, value));
+        }
+
+        /** {@inheritDoc} */
+        public int hashCode() {
+            int hash = 17;
+            hash = (37 * hash) + (this.namespace == null ? 0 : this.namespace.hashCode());
+            hash = (37 * hash) + (this.qname == null ? 0 : this.qname.hashCode());
+            hash = (37 * hash) + (this.name == null ? 0 : this.name.hashCode());
+            hash = (37 * hash) + (this.value == null ? 0 : this.value.hashCode());
+            return hash;
         }
 
         /** {@inheritDoc} */
         public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+
             if (o instanceof MarkerAttribute) {
                 MarkerAttribute attr = (MarkerAttribute) o;
                 return ((attr.namespace == this.namespace)

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PropertyCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PropertyCache.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PropertyCache.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PropertyCache.java Tue Dec  9 07:00:35 2008
@@ -19,6 +19,8 @@
 
 package org.apache.fop.fo.properties;
 
+import org.apache.fop.fo.flow.Marker;
+
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 
@@ -53,7 +55,7 @@
 
     private Class runtimeType;
 
-    private boolean[] votesForRehash = new boolean[SEGMENT_COUNT];
+    private final boolean[] votesForRehash = new boolean[SEGMENT_COUNT];
 
     /* same hash function as used by java.util.HashMap */
     private static int hash(Object x) {
@@ -381,6 +383,19 @@
         return (CommonBorderPaddingBackground.BorderInfo) fetch((Object) bi);
     }
 
+    /**
+     *  Checks if the given {@link Marker.MarkerAttribute} is present
+     *  in the cache - if so, returns a reference to the cached instance.
+     *  Otherwise the given object is added to the cache and returned.
+     *
+     *  @param ma the MarkerAttribute instance to check for
+     *  @return the cached instance
+     */
+    public Marker.MarkerAttribute fetch(
+            Marker.MarkerAttribute ma) {
+        return (Marker.MarkerAttribute) fetch((Object) ma);
+    }
+
     /** {@inheritDoc} */
     public String toString() {
         return super.toString() + "[runtimeType=" + this.runtimeType + "]";

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Base14Font.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Base14Font.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Base14Font.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Base14Font.java Tue Dec  9 07:00:35 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.fonts;
 
+
 /**
  * Base class for all Base 14 fonts.
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CIDFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CIDFont.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CIDFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CIDFont.java Tue Dec  9 07:00:35 2008
@@ -76,4 +76,4 @@
         return true;
     }
 
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java Tue Dec  9 07:00:35 2008
@@ -26,6 +26,7 @@
 
 import javax.xml.transform.Source;
 
+
 /**
  * Abstract base class for custom fonts loaded from files, for example.
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java Tue Dec  9 07:00:35 2008
@@ -23,6 +23,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.fop.fonts.CodePointMapping;
 
 /**
  * This class holds font state information and provides access to the font

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCollection.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCollection.java Tue Dec  9 07:00:35 2008
@@ -24,6 +24,7 @@
  * Sets up a set of fonts
  */
 public interface FontCollection {
+
     /**
      * Sets up fonts in a font info object.
      *

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java Tue Dec  9 07:00:35 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.fonts;
 
+
 /**
  * This interface enhances the font metrics interface with access methods to
  * value needed to register fonts in various target formats like PDF or

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontEventListener.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontEventListener.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontEventListener.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontEventListener.java Tue Dec  9 07:00:35 2008
@@ -19,7 +19,6 @@
 
 package org.apache.fop.fonts;
 
-
 /**
  * Event listener interface for font-related events.
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontInfo.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontInfo.java Tue Dec  9 07:00:35 2008
@@ -110,6 +110,19 @@
     }
 
     /**
+     * Adds a series of new font triplets given an array of font family names.
+     * @param name internal key
+     * @param families an array of font family names
+     * @param style font style (normal, italic, oblique...)
+     * @param weight font weight
+     */
+    public void addFontProperties(String name, String[] families, String style, int weight) {
+        for (int i = 0; i < families.length; i++) {
+            addFontProperties(name, families[i], style, weight);
+        }
+    }
+
+    /**
      * Adds a new font triplet.
      * @param internalFontKey internal font key
      * @param triplet the font triplet to associate with the internal key
@@ -193,7 +206,8 @@
     private FontTriplet fontLookup(String family, String style,
                              int weight, boolean substitutable) {
         if (log.isTraceEnabled()) {
-            log.trace("Font lookup: " + family + " " + style + " " + weight);
+            log.trace("Font lookup: " + family + " " + style + " " + weight
+                    + (substitutable ? " substitutable" : ""));
         }
 
         FontTriplet startKey = createFontKey(family, style, weight);
@@ -215,7 +229,7 @@
     }
 
     private FontTriplet fuzzyFontLookup(String family, String style,
-            int weight, FontTriplet startKey, boolean substFont) {
+            int weight, FontTriplet startKey, boolean substitutable) {
         FontTriplet key;
         String internalFontKey = null;
         if (!family.equals(startKey.getName())) {
@@ -232,7 +246,8 @@
             internalFontKey = getInternalFontKey(key);
         }
 
-        if (!substFont && internalFontKey == null) {
+        // return null if not found and not substitutable
+        if (!substitutable && internalFontKey == null) {
             return null;
         }
 
@@ -263,18 +278,18 @@
 
         // fallback 2: try the same font-family with default style and weight
         /* obsolete: replaced by the loop above
-        if (f == null) {
+        if (internalFontKey == null) {
             key = createFontKey(family, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
-            f = getInternalFontKey(key);
+            internalFontKey = getInternalFontKey(key);
         }*/
 
-        // fallback 3: try any family with orig style/weight
+        // fallback 3: try any family with original style/weight
         if (internalFontKey == null) {
             return fuzzyFontLookup("any", style, weight, startKey, false);
         }
 
         // last resort: use default
-        if (internalFontKey == null) {
+        if (key == null && internalFontKey == null) {
             key = Font.DEFAULT_FONT;
             internalFontKey = getInternalFontKey(key);
         }
@@ -303,6 +318,7 @@
 
     /**
      * Retrieves a (possibly cached) Font instance based on a FontTriplet and a font size.
+     *
      * @param triplet the font triplet designating the requested font
      * @param fontSize the font size
      * @return the requested Font instance
@@ -326,6 +342,57 @@
         return font;
     }
 
+    private List/*<FontTriplet>*/ getTripletsForName(String fontName) {
+        List/*<FontTriplet>*/ matchedTriplets = new java.util.ArrayList/*<FontTriplet>*/();
+        Iterator it = triplets.keySet().iterator();
+        while (it.hasNext()) {
+            FontTriplet triplet = (FontTriplet)it.next();
+            String tripletName = triplet.getName();
+            if (tripletName.toLowerCase().equals(fontName.toLowerCase())) {
+                matchedTriplets.add(triplet);
+            }
+        }
+        return matchedTriplets;
+    }
+
+    /**
+     * Returns a suitable internal font given an AWT Font instance.
+     *
+     * @param awtFont the AWT font
+     * @return a best matching internal Font
+     */
+    public Font getFontInstanceForAWTFont(java.awt.Font awtFont) {
+        String awtFontName = awtFont.getName();
+        String awtFontFamily = awtFont.getFamily();
+        String awtFontStyle = awtFont.isItalic() ? Font.STYLE_ITALIC : Font.STYLE_NORMAL;
+        int awtFontWeight = awtFont.isBold() ? Font.WEIGHT_BOLD : Font.WEIGHT_NORMAL;
+
+        FontTriplet matchedTriplet = null;
+        List/*<FontTriplet>*/ triplets = getTripletsForName(awtFontName);
+        if (!triplets.isEmpty()) {
+            Iterator it = triplets.iterator();
+            while (it.hasNext()) {
+                FontTriplet triplet = (FontTriplet)it.next();
+                boolean styleMatched = triplet.getStyle().equals(awtFontStyle);
+                boolean weightMatched = triplet.getWeight() == awtFontWeight;
+                if (styleMatched && weightMatched) {
+                    matchedTriplet = triplet;
+                    break;
+                }
+            }
+        }
+
+        // not matched on font name so do a lookup using family
+        if (matchedTriplet == null) {
+            if (awtFontFamily.equals("sanserif")) {
+                awtFontFamily = "sans-serif";
+            }
+            matchedTriplet = fontLookup(awtFontFamily, awtFontStyle, awtFontWeight);
+        }
+        int fontSize = Math.round(awtFont.getSize2D() * 1000);
+        return getFontInstance(matchedTriplet, fontSize);
+    }
+
     /**
      * Lookup a font.
      * <br>
@@ -345,7 +412,7 @@
 
     private List/*<FontTriplet>*/ fontLookup(String[] families, String style,
             int weight, boolean substitutable) {
-        List matchingTriplets = new java.util.ArrayList();
+        List/*<FontTriplet>*/ matchingTriplets = new java.util.ArrayList/*<FontTriplet>*/();
         FontTriplet triplet = null;
         for (int i = 0; i < families.length; i++) {
             triplet = fontLookup(families[i], style, weight, substitutable);
@@ -555,7 +622,7 @@
         List/*<FontTriplet>*/ foundTriplets = new java.util.ArrayList();
         for (Iterator iter = triplets.entrySet().iterator(); iter.hasNext();) {
             Map.Entry tripletEntry = (Map.Entry) iter.next();
-            if (fontName.equals(((String)tripletEntry.getValue()))) {
+            if (fontName.equals((tripletEntry.getValue()))) {
                 foundTriplets.add(tripletEntry.getKey());
             }
         }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontMetrics.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontMetrics.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontMetrics.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontMetrics.java Tue Dec  9 07:00:35 2008
@@ -23,6 +23,7 @@
 import java.util.Set;
 
 
+
 /**
  * Main interface for access to font metrics.
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontTriplet.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontTriplet.java Tue Dec  9 07:00:35 2008
@@ -21,6 +21,7 @@
 
 import java.io.Serializable;
 
+
 /**
  * FontTriplet contains information on name, style and weight of one font
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontType.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontType.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontType.java Tue Dec  9 07:00:35 2008
@@ -19,12 +19,10 @@
 
 package org.apache.fop.fonts;
 
-import org.apache.avalon.framework.ValuedEnum;
-
 /**
  * This class enumerates all supported font types.
  */
-public class FontType extends ValuedEnum {
+public class FontType {
 
     /**
      * Collective identifier for "other" font types
@@ -51,12 +49,16 @@
      */
     public static final FontType TRUETYPE    = new FontType("TrueType", 5);
 
+    private final String name;
+    private final int value;
+
 
     /**
      * @see org.apache.avalon.framework.Enum#Enum(String)
      */
     protected FontType(String name, int value) {
-        super(name, value);
+        this.name = name;
+        this.value = value;
     }
 
 
@@ -107,4 +109,22 @@
         }
     }
 
+    /**
+     * Returns the name
+     *
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the value
+     *
+     * @return the value
+     */
+    public int getValue() {
+        return value;
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontUtil.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontUtil.java Tue Dec  9 07:00:35 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.fonts;
 
+
 /**
  * Font utilities.
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MultiByteFont.java Tue Dec  9 07:00:35 2008
@@ -23,6 +23,7 @@
 import java.text.DecimalFormat;
 import java.util.Map;
 
+
 /**
  * Generic MultiByte (CID) font
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MutableFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MutableFont.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MutableFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/MutableFont.java Tue Dec  9 07:00:35 2008
@@ -23,6 +23,7 @@
 import java.util.Set;
 
 
+
 /**
  * This interface is used to set the values of a font during configuration time.
  */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Typeface.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Typeface.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Typeface.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Typeface.java Tue Dec  9 07:00:35 2008
@@ -139,4 +139,9 @@
             }
         }
     }
+    
+    /** {@inheritDoc} */
+    public String toString() {
+        return getFullName();
+    }   
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/package.html?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/package.html (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/package.html Tue Dec  9 07:00:35 2008
@@ -1,3 +1,20 @@
+<!--
+  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.html 643433 2008-04-01 15:08:24Z acumiskey $ -->
 <HTML>
 <TITLE>org.apache.fop.fonts Package</TITLE>
 <BODY>

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/BatikUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/BatikUtil.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/BatikUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/BatikUtil.java Tue Dec  9 07:00:35 2008
@@ -19,6 +19,11 @@
 
 package org.apache.fop.image.loader.batik;
 
+import org.w3c.dom.Document;
+
+import org.apache.batik.dom.AbstractDocument;
+import org.apache.batik.dom.util.DOMUtilities;
+
 /**
  * Helper utilities for Apache Batik.
  */
@@ -38,4 +43,18 @@
         return false;
     }
 
+    /**
+     * Clones an SVG DOM document. This is used for making SVG production thread-safe when the
+     * SVG document is cached and re-used.
+     * @param doc the SVG DOM to be cloned
+     * @return the cloned SVG DOM
+     */
+    public static Document cloneSVGDocument(Document doc) {
+        Document clonedDoc = DOMUtilities.deepCloneDocument(doc, doc.getImplementation());
+        if (clonedDoc instanceof AbstractDocument) {
+            ((AbstractDocument)clonedDoc).setDocumentURI(((AbstractDocument)doc).getDocumentURI());
+        }
+        return clonedDoc;
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java Tue Dec  9 07:00:35 2008
@@ -20,11 +20,11 @@
 package org.apache.fop.image.loader.batik;
 
 import java.awt.Dimension;
-import java.awt.Graphics2D;
 import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
 import java.util.Map;
 
+import org.w3c.dom.Document;
+
 import org.apache.batik.bridge.BridgeContext;
 import org.apache.batik.bridge.GVTBuilder;
 import org.apache.batik.bridge.UserAgent;
@@ -32,10 +32,11 @@
 import org.apache.batik.gvt.GraphicsNode;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.svg.SimpleSVGUserAgent;
+
 import org.apache.xmlgraphics.image.loader.Image;
 import org.apache.xmlgraphics.image.loader.ImageException;
 import org.apache.xmlgraphics.image.loader.ImageFlavor;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
 import org.apache.xmlgraphics.image.loader.ImageProcessingHints;
 import org.apache.xmlgraphics.image.loader.XMLNamespaceEnabledImageFlavor;
 import org.apache.xmlgraphics.image.loader.impl.AbstractImageConverter;
@@ -44,6 +45,8 @@
 import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
 import org.apache.xmlgraphics.util.UnitConv;
 
+import org.apache.fop.svg.SimpleSVGUserAgent;
+
 /**
  * This ImageConverter converts SVG images to Java2D.
  * <p>
@@ -58,7 +61,7 @@
     private static Log log = LogFactory.getLog(ImageConverterSVG2G2D.class);
 
     /** {@inheritDoc} */
-    public Image convert(Image src, Map hints) throws ImageException {
+    public Image convert(final Image src, Map hints) throws ImageException {
         checkSourceFlavor(src);
         final ImageXMLDOM svg = (ImageXMLDOM)src;
         if (!SVGDOMImplementation.SVG_NAMESPACE_URI.equals(svg.getRootNamespace())) {
@@ -76,37 +79,28 @@
         GVTBuilder builder = new GVTBuilder();
         final BridgeContext ctx = new BridgeContext(ua);
 
+        Document doc = svg.getDocument();
+        //Cloning SVG DOM as Batik attaches non-thread-safe facilities (like the CSS engine)
+        //to it.
+        Document clonedDoc = BatikUtil.cloneSVGDocument(doc);
+
         //Build the GVT tree
         final GraphicsNode root;
         try {
-            root = builder.build(ctx, svg.getDocument());
+            root = builder.build(ctx, clonedDoc);
         } catch (Exception e) {
             throw new ImageException("GVT tree could not be built for SVG graphic", e);
         }
 
         //Create the painter
-        Graphics2DImagePainter painter = new Graphics2DImagePainter() {
-
-            public void paint(Graphics2D g2d, Rectangle2D area) {
-                // If no viewbox is defined in the svg file, a viewbox of 100x100 is
-                // assumed, as defined in SVGUserAgent.getViewportSize()
-                float iw = (float) ctx.getDocumentSize().getWidth();
-                float ih = (float) ctx.getDocumentSize().getHeight();
-                float w = (float) area.getWidth();
-                float h = (float) area.getHeight();
-                g2d.translate(area.getX(), area.getY());
-                g2d.scale(w / iw, h / ih);
-
-                root.paint(g2d);
-            }
-
-            public Dimension getImageSize() {
-                return new Dimension(svg.getSize().getWidthMpt(), svg.getSize().getHeightMpt());
-            }
-
-        };
-
-        ImageGraphics2D g2dImage = new ImageGraphics2D(src.getInfo(), painter);
+        int width = svg.getSize().getWidthMpt();
+        int height = svg.getSize().getHeightMpt();
+        Dimension imageSize = new Dimension(width, height);
+        Graphics2DImagePainter painter = createPainter(ctx, root, imageSize);
+
+        //Create g2d image
+        ImageInfo imageInfo = src.getInfo();
+        ImageGraphics2D g2dImage = new ImageGraphics2D(imageInfo, painter);
         return g2dImage;
     }
 
@@ -129,6 +123,19 @@
         };
     }
 
+    /**
+     * Creates a Graphics 2D image painter
+     *
+     * @param ctx the bridge context
+     * @param root the graphics node root
+     * @param imageSize the image size
+     * @return the newly created graphics 2d image painter
+     */
+    protected Graphics2DImagePainter createPainter(
+            BridgeContext ctx, GraphicsNode root, Dimension imageSize) {
+        return new Graphics2DImagePainterImpl(root, ctx, imageSize);
+    }
+
     /** {@inheritDoc} */
     public ImageFlavor getSourceFlavor() {
         return XMLNamespaceEnabledImageFlavor.SVG_DOM;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/TraitSetter.java Tue Dec  9 07:00:35 2008
@@ -29,6 +29,7 @@
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.fo.properties.CommonMarginBlock;
+import org.apache.fop.fo.properties.CommonMarginBlock;
 import org.apache.fop.fo.properties.CommonTextDecoration;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo;
 import org.apache.fop.fonts.Font;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java?rev=724729&r1=724728&r2=724729&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java Tue Dec  9 07:00:35 2008
@@ -20,12 +20,12 @@
 package org.apache.fop.layoutmgr.inline;
 
 import org.apache.fop.fo.flow.PageNumber;
-import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.area.inline.TextArea;
-import org.apache.fop.area.Trait;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.area.inline.TextArea;
+import org.apache.fop.area.Trait;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.traits.MinOptMax;



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