Author: acumiskey
Date: Wed Nov 26 05:45:04 2008
New Revision: 720850

URL: http://svn.apache.org/viewvc?rev=720850&view=rev
Log:
Merged revisions 719616,719629,719646,719654 via svnmerge from 
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk

........
  r719616 | jeremias | 2008-11-21 16:07:58 +0000 (Fri, 21 Nov 2008) | 1 line
  
  Added support for SVG 1.2 inside fo:instream-foreign-object. The code just 
used the basic SVGDOMImplementation for SVG 1.1. Now it delegates the DOM 
building to Batik code instead of to a normal DOM builder.
........
  r719629 | jeremias | 2008-11-21 16:33:33 +0000 (Fri, 21 Nov 2008) | 2 lines
  
  Fix for unit test failure in transcoder tests (NullPointerException):
  Have to pass the root PSGraphics2D to NativeTextHandler instead of the 
PSGenerator as this one hasn't been initialized in PSGraphics2D when the 
NativeTextHandler is built in AbstractPSTranscoder.
........
  r719646 | jeremias | 2008-11-21 17:24:32 +0000 (Fri, 21 Nov 2008) | 1 line
  
  Fixed possible ClassCastException that was caused by my earlier attempt to 
support SVG 1.2. Batik's SAXSVGDocumentFactory doesn't currently deal well with 
the case when namespaces are declared outside of its scope. Worked around that 
by doing the SVG version detection in FOP code. SVG12DOMImplementation is 
obtained by reflection in order to keep backwards compatilibility with earlier 
Batik versions that don't support SVG 1.2.
........
  r719654 | jeremias | 2008-11-21 17:44:08 +0000 (Fri, 21 Nov 2008) | 1 line
  
  This actually fixes a bug.
........

Added:
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java
      - copied unchanged from r719654, 
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java
Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/   (props changed)
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/XMLObj.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java
   (props changed)
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/NativeTextHandler.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 26 05:45:04 2008
@@ -1,2 +1,2 @@
 /xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
-/xmlgraphics/fop/trunk:693433-698670,699739,704008-704909,705529-706135,706272-706276,706319-707083,707627,707631-708012,708192-708851,711781,718309-718502,718557-718591,718666-719110
+/xmlgraphics/fop/trunk:693433-698670,699739,704008-704909,705529-706135,706272-706276,706319-707083,707627,707631-708012,708192-708851,711781,718309-718502,718557-718591,718666-719110,719616-719654

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Nov 26 05:45:04 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk:1-719274
+/xmlgraphics/fop/trunk:1-720845

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/XMLObj.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/XMLObj.java?rev=720850&r1=720849&r2=720850&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/XMLObj.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/XMLObj.java
 Wed Nov 26 05:45:04 2008
@@ -217,6 +217,7 @@
     /** [EMAIL PROTECTED] */
     public void notifyObjectBuilt(Object obj) {
         this.doc = (Document)obj;
+        this.element = this.doc.getDocumentElement();
     }
 
 }

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java?rev=720850&r1=720849&r2=720850&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
 Wed Nov 26 05:45:04 2008
@@ -20,35 +20,27 @@
 package org.apache.fop.fo.extensions.svg;
 
 // FOP
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.util.ContentHandlerFactory;
-import org.apache.fop.util.DOMBuilderContentHandlerFactory;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.net.URL;
+
+import org.w3c.dom.Element;
 
+import org.apache.batik.bridge.UnitProcessor;
+import org.apache.batik.dom.svg.SVGContext;
+import org.apache.batik.dom.svg.SVGDOMImplementation;
 import org.apache.batik.dom.svg.SVGOMDocument;
 import org.apache.batik.dom.svg.SVGOMElement;
-import org.apache.batik.dom.svg.SVGContext;
 import org.apache.batik.dom.util.XMLSupport;
-import org.w3c.dom.Element;
-import org.w3c.dom.svg.SVGDocument;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.apache.batik.bridge.UnitProcessor;
 import org.apache.batik.util.SVGConstants;
 
-import org.w3c.dom.DOMImplementation;
-
-import org.apache.batik.dom.svg.SVGDOMImplementation;
-
-import java.net.URL;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.util.ContentHandlerFactory;
 
 /**
- * class representing the SVG root element
- * for constructing an svg document.
+ * Class representing the SVG root element
+ * for constructing an SVG document.
  */
 public class SVGElement extends SVGObj {
 
@@ -61,21 +53,9 @@
         super(parent);
     }
 
-    /**
-     * [EMAIL PROTECTED]
-     */
+    /** [EMAIL PROTECTED] */
     public ContentHandlerFactory getContentHandlerFactory() {
-        return new DOMBuilderContentHandlerFactory(getNamespaceURI(),
-                SVGDOMImplementation.getDOMImplementation());
-    }
-
-    /**
-     * [EMAIL PROTECTED]
-     */
-    public void processNode(String elementName, Locator locator,
-                            Attributes attlist, PropertyList propertyList) 
throws FOPException {
-        super.processNode(elementName, locator, attlist, propertyList);
-        init();
+        return new SVGDOMContentHandlerFactory();
     }
 
     /**
@@ -104,7 +84,6 @@
             log.error("Could not set base URL for svg", e);
         }
 
-        Element e = ((SVGDocument)doc).getRootElement();
         final float ptmm = getUserAgent().getSourcePixelUnitToMillimeter();
         // temporary svg context
         SVGContext dc = new SVGContext() {
@@ -157,7 +136,8 @@
             public void deselectAll() {
             }
         };
-        ((SVGOMElement)e).setSVGContext(dc);
+        SVGOMElement e = (SVGOMElement)svgRoot;
+        e.setSVGContext(dc);
 
         //if (!e.hasAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns")) {
             e.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
@@ -165,21 +145,11 @@
         //}
         int fontSize = 12;
         Point2D p2d = getSize(fontSize, svgRoot, 
getUserAgent().getSourcePixelUnitToMillimeter());
-       ((SVGOMElement)e).setSVGContext(null);
+        e.setSVGContext(null);
 
         return p2d;
     }
 
-    private void init() {
-        DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
-        String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
-        doc = impl.createDocument(svgNS, "svg", null);
-
-        element = doc.getDocumentElement();
-
-        buildTopLevel(doc, element);
-    }
-
     /**
      * Get the size of the SVG root element.
      * @param size the font size

Propchange: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 26 05:45:04 2008
@@ -1,2 +1,2 @@
 
/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java:684572,688085,688696
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java:693433-698670,699739,704008-704909,705529-706135,706272-706276,706319-707083,707627,711781,718309-718502,718557-718591,718666-719110
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java:693433-698670,699739,704008-704909,705529-706135,706272-706276,706319-707083,707627,711781,718309-718502,718557-718591,718666-719110,719616-719654

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java?rev=720850&r1=720849&r2=720850&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
 Wed Nov 26 05:45:04 2008
@@ -25,20 +25,23 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.svg.SVGLength;
+
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.batik.bridge.BridgeContext;
 import org.apache.batik.bridge.UnitProcessor;
 import org.apache.batik.transcoder.TranscoderException;
 import org.apache.batik.transcoder.TranscoderOutput;
 import org.apache.batik.transcoder.image.ImageTranscoder;
-import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.fonts.FontSetup;
-import org.apache.fop.svg.AbstractFOPTranscoder;
+
 import org.apache.xmlgraphics.java2d.TextHandler;
 import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D;
 import org.apache.xmlgraphics.ps.PSGenerator;
-import org.w3c.dom.Document;
-import org.w3c.dom.svg.SVGLength;
+
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.FontSetup;
+import org.apache.fop.svg.AbstractFOPTranscoder;
 
 /**
  * This class enables to transcode an input to a PostScript document.
@@ -99,7 +102,7 @@
             //TODO Do custom font configuration here somewhere/somehow
             FontSetup.setup(fontInfo);
             PSGenerator generator = graphics.getPSGenerator();
-            graphics.setCustomTextHandler(new NativeTextHandler(generator, 
fontInfo));
+            graphics.setCustomTextHandler(new NativeTextHandler(graphics, 
fontInfo));
         }
 
         super.transcode(document, uri, output);

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/NativeTextHandler.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/NativeTextHandler.java?rev=720850&r1=720849&r2=720850&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/NativeTextHandler.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/NativeTextHandler.java
 Wed Nov 26 05:45:04 2008
@@ -24,13 +24,14 @@
 import java.awt.geom.AffineTransform;
 import java.io.IOException;
 
+import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
+import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
+import org.apache.xmlgraphics.ps.PSGenerator;
+
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontSetup;
 import org.apache.fop.fonts.FontTriplet;
-import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
-import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
-import org.apache.xmlgraphics.ps.PSGenerator;
 
 /**
  * Specialized TextHandler implementation that the PSGraphics2D class 
delegates to to paint text
@@ -38,7 +39,7 @@
  */
 public class NativeTextHandler implements PSTextHandler {
 
-    private final PSGenerator gen;
+    private PSGraphics2D rootG2D;
 
     /** FontInfo containing all available fonts */
     protected FontInfo fontInfo;
@@ -60,8 +61,8 @@
      * @param g2d the PSGraphics2D instance this instances is used by
      * @param fontInfo the FontInfo object with all available fonts
      */
-    public NativeTextHandler(PSGenerator gen, FontInfo fontInfo) {
-        this.gen = gen;
+    public NativeTextHandler(PSGraphics2D g2d, FontInfo fontInfo) {
+        this.rootG2D = g2d;
         if (fontInfo != null) {
             this.fontInfo = fontInfo;
         } else {
@@ -84,7 +85,7 @@
     }
 
     private PSGenerator getPSGenerator() {
-        return this.gen;
+        return this.rootG2D.getPSGenerator();
     }
 
     /** [EMAIL PROTECTED] */

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java?rev=720850&r1=720849&r2=720850&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
 Wed Nov 26 05:45:04 2008
@@ -24,12 +24,18 @@
 import java.io.IOException;
 import java.util.Map;
 
+import org.w3c.dom.Document;
+
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.batik.bridge.BridgeContext;
 import org.apache.batik.bridge.GVTBuilder;
 import org.apache.batik.gvt.GraphicsNode;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
+import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
+import org.apache.xmlgraphics.ps.PSGenerator;
+
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.render.AbstractGenericSVGHandler;
 import org.apache.fop.render.Renderer;
@@ -37,9 +43,6 @@
 import org.apache.fop.render.RendererContextConstants;
 import org.apache.fop.svg.SVGEventProducer;
 import org.apache.fop.svg.SVGUserAgent;
-import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
-import org.apache.xmlgraphics.ps.PSGenerator;
-import org.w3c.dom.Document;
 
 /**
  * PostScript XML handler for SVG. Uses Apache Batik for SVG processing.
@@ -259,9 +262,8 @@
         NativeTextHandler nativeTextHandler = null;
         BridgeContext ctx = new BridgeContext(ua);
         if (!strokeText) {
-            PSGenerator generator = graphics.getPSGenerator();
             FontInfo fontInfo = psInfo.getFontInfo();
-            nativeTextHandler = new NativeTextHandler(generator, fontInfo);
+            nativeTextHandler = new NativeTextHandler(graphics, fontInfo);
             graphics.setCustomTextHandler(nativeTextHandler);
             PSTextPainter textPainter = new PSTextPainter(nativeTextHandler);
             ctx.setTextPainter(textPainter);

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java?rev=720850&r1=720849&r2=720850&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java
 Wed Nov 26 05:45:04 2008
@@ -21,6 +21,8 @@
 
 import java.io.IOException;
 
+import org.w3c.dom.Document;
+
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -71,4 +73,13 @@
         return super.resolveEntity(publicId, systemId);
     }
 
+    /**
+     * Returns the document built up by handling the incoming SAX events. This 
method will not
+     * return any instance for the first SAX events have been received.
+     * @return the DOM document
+     */
+    public Document getDocument() {
+        return this.document;
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml?rev=720850&r1=720849&r2=720850&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml Wed Nov 26 
05:45:04 2008
@@ -62,9 +62,12 @@
       <action context="Renderers" dev="AC" importance="high" type="add">
         AFP Output: Native image embedding support (e.g. JPEG, GIF, TIFF) 
using ObjectContainer and a MOD:CA Registry implementation.
       </action>
-      <action context="Fonts" dev="AC" importance="high" type="fix">
+      <action context="Fonts" dev="AC" type="fix">
         More robust AFP font parsing, although it is still in need of some 
rework in the future.
       </action>
+      <action context="Images" dev="JM" type="add" fixes-bug="41657">
+        Added support for SVG 1.2 functionality inside 
fo:instream-foreign-object.
+      </action>
       <action context="Layout" dev="AD" type="fix" fixes-bug="46240">
         Fixed a bug when combining break-before with a span change.
       </action>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to