keiron 02/05/13 03:29:53 Modified: lib Tag: fop-0_20_2-maintain batik.jar readme src/org/apache/fop/image/analyser Tag: fop-0_20_2-maintain SVGReader.java src/org/apache/fop/svg Tag: fop-0_20_2-maintain PDFAElementBridge.java PDFImageElementBridge.java PDFTranscoder.java SVGElement.java SVGUserAgent.java Log: updated to batik1.5beta2 and improved the useragent usage Revision Changes Path No revision No revision 1.5.2.3 +7456 -6745xml-fop/lib/batik.jar <<Binary file>> 1.4.2.2 +1 -1 xml-fop/lib/readme Index: readme =================================================================== RCS file: /home/cvs/xml-fop/lib/readme,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- readme 10 Feb 2002 02:01:15 -0000 1.4.2.1 +++ readme 13 May 2002 10:29:51 -0000 1.4.2.2 @@ -5,7 +5,7 @@ the test scripts. see build.xml in root for more information batik.jar the svg library from Batik at xml.apache.org - +version 1.5 beta2 buildtools.jar Ant tasks required for building FOP. Rebuild with build.sh -f buildtools.xml in the top level directory. No revision No revision 1.12.2.2 +3 -34 xml-fop/src/org/apache/fop/image/analyser/SVGReader.java Index: SVGReader.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/image/analyser/SVGReader.java,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -u -r1.12.2.1 -r1.12.2.2 --- SVGReader.java 3 Dec 2001 07:40:17 -0000 1.12.2.1 +++ SVGReader.java 13 May 2002 10:29:52 -0000 1.12.2.2 @@ -1,5 +1,5 @@ /* - * $Id: SVGReader.java,v 1.12.2.1 2001/12/03 07:40:17 keiron Exp $ + * $Id: SVGReader.java,v 1.12.2.2 2002/05/13 10:29:52 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -108,7 +108,7 @@ } } - protected class MUserAgent implements UserAgent { + protected class MUserAgent extends UserAgentAdapter { AffineTransform currentTransform = null; /** @@ -157,7 +157,7 @@ } public String getMedia() { - return ""; + return "print"; } public boolean isXMLParserValidating() { @@ -179,21 +179,6 @@ return org.apache.fop.apps.Driver.getParserClassName(); } - /** - * Opens a link in a new component. - * @param doc The current document. - * @param uri The document URI. - */ - public void openLink(SVGAElement elt) { - } - - public Point getClientAreaLocationOnScreen() { - return new Point(0, 0); - } - - public void setSVGCursor(java.awt.Cursor cursor) {} - - public AffineTransform getTransform() { return currentTransform; } @@ -201,22 +186,6 @@ public Dimension2D getViewportSize() { return new Dimension(100, 100); } - - public EventDispatcher getEventDispatcher() { - return null; - } - - public boolean supportExtension(String str) { - return false; - } - - public boolean hasFeature(String str) { - return false; - } - - public void registerExtension(BridgeExtension be) {} - - public void handleElement(Element elt, Object data) {} } No revision No revision 1.3.2.1 +1 -2 xml-fop/src/org/apache/fop/svg/PDFAElementBridge.java Index: PDFAElementBridge.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFAElementBridge.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- PDFAElementBridge.java 14 Aug 2001 14:50:30 -0000 1.3 +++ PDFAElementBridge.java 13 May 2002 10:29:52 -0000 1.3.2.1 @@ -1,5 +1,5 @@ /* - * $Id: PDFAElementBridge.java,v 1.3 2001/08/14 14:50:30 keiron Exp $ + * $Id: PDFAElementBridge.java,v 1.3.2.1 2002/05/13 10:29:52 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -12,7 +12,6 @@ import org.apache.batik.bridge.*; -import org.apache.batik.css.HiddenChildElementSupport; import org.apache.batik.gvt.CompositeGraphicsNode; import org.apache.batik.gvt.GraphicsNode; 1.1.2.1 +1 -2 xml-fop/src/org/apache/fop/svg/PDFImageElementBridge.java Index: PDFImageElementBridge.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFImageElementBridge.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- PDFImageElementBridge.java 12 Oct 2001 06:40:13 -0000 1.1 +++ PDFImageElementBridge.java 13 May 2002 10:29:52 -0000 1.1.2.1 @@ -1,5 +1,5 @@ /* - * $Id: PDFImageElementBridge.java,v 1.1 2001/10/12 06:40:13 keiron Exp $ + * $Id: PDFImageElementBridge.java,v 1.1.2.1 2002/05/13 10:29:52 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -12,7 +12,6 @@ import org.apache.batik.bridge.*; -import org.apache.batik.css.HiddenChildElementSupport; import org.apache.batik.gvt.CompositeGraphicsNode; import org.apache.batik.gvt.GraphicsNode; 1.11.2.2 +4 -75 xml-fop/src/org/apache/fop/svg/PDFTranscoder.java Index: PDFTranscoder.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFTranscoder.java,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -u -r1.11.2.1 -r1.11.2.2 --- PDFTranscoder.java 3 Dec 2001 07:40:17 -0000 1.11.2.1 +++ PDFTranscoder.java 13 May 2002 10:29:52 -0000 1.11.2.2 @@ -1,5 +1,5 @@ /* - * $Id: PDFTranscoder.java,v 1.11.2.1 2001/12/03 07:40:17 keiron Exp $ + * $Id: PDFTranscoder.java,v 1.11.2.2 2002/05/13 10:29:52 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -40,7 +40,6 @@ import org.apache.batik.bridge.UserAgent; import org.apache.batik.bridge.ViewBox; -import org.apache.batik.dom.svg.DefaultSVGContext; import org.apache.batik.dom.svg.SAXSVGDocumentFactory; import org.apache.batik.dom.svg.SVGDOMImplementation; import org.apache.batik.dom.svg.SVGOMDocument; @@ -95,9 +94,6 @@ import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGSVGElement; -// <!> FIXME : Those import clauses will change with new design -import org.apache.batik.gvt.renderer.StaticRendererFactory; - /** * This class enables to transcode an input to a pdf document. * @@ -123,7 +119,7 @@ * millimeter conversion factor. * * @author <a href="mailto:[EMAIL PROTECTED]">Keiron Liddle</a> - * @version $Id: PDFTranscoder.java,v 1.11.2.1 2001/12/03 07:40:17 keiron Exp $ + * @version $Id: PDFTranscoder.java,v 1.11.2.2 2002/05/13 10:29:52 keiron Exp $ */ public class PDFTranscoder extends XMLAbstractTranscoder { @@ -165,9 +161,6 @@ SVGSVGElement root = svgDoc.getRootElement(); // initialize the SVG document with the appropriate context String parserClassname = (String)hints.get(KEY_XML_PARSER_CLASSNAME); - DefaultSVGContext svgCtx = new DefaultSVGContext(); - svgCtx.setPixelToMM(userAgent.getPixelToMM()); - ((SVGOMDocument)document).setSVGContext(svgCtx); boolean stroke = true; if (hints.containsKey(KEY_STROKE_TEXT)) { @@ -176,7 +169,6 @@ // build the GVT tree GVTBuilder builder = new GVTBuilder(); - ImageRendererFactory rendFactory = new StaticRendererFactory(); BridgeContext ctx = new BridgeContext(userAgent); TextPainter textPainter = null; textPainter = new StrokingTextPainter(); @@ -311,7 +303,7 @@ /** * A user agent implementation for <tt>ImageTranscoder</tt>. */ - protected class ImageTranscoderUserAgent implements UserAgent { + protected class ImageTranscoderUserAgent extends UserAgentAdapter { public boolean isXMLParserValidating() { return true; @@ -383,10 +375,9 @@ } public String getMedia() { - return ""; + return "print"; } - /** * Returns the user stylesheet specified in the * <tt>TranscodingHints</tt> or null if any. @@ -406,68 +397,6 @@ } } - /** - * Unsupported operation. - */ - public EventDispatcher getEventDispatcher() { - return null; - } - - /** - * Unsupported operation. - */ - public void openLink(SVGAElement elt) {} - - /** - * Unsupported operation. - */ - public void setSVGCursor(Cursor cursor) {} - - /** - * Unsupported operation. - */ - public void runThread(Thread t) {} - - /** - * Unsupported operation. - */ - public AffineTransform getTransform() { - return null; - } - - /** - * Unsupported operation. - */ - public Point getClientAreaLocationOnScreen() { - return new Point(); - } - - /** - * Tells whether the given feature is supported by this - * user agent. - */ - public boolean hasFeature(String s) { - return FEATURES.contains(s); - } - - /** - * Tells whether the given extension is supported by this - * user agent. - */ - public boolean supportExtension(String s) { - return false; - } - - public void registerExtension(BridgeExtension be) {} - - public void handleElement(Element elt, Object data) {} - } - protected final static Set FEATURES = new HashSet(); - static { - FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_FEATURE); - FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_LANG_FEATURE); - FEATURES.add(SVGConstants.SVG_ORG_W3C_SVG_STATIC_FEATURE); - } } 1.16.2.1 +27 -34 xml-fop/src/org/apache/fop/svg/SVGElement.java Index: SVGElement.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGElement.java,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -r1.16 -r1.16.2.1 --- SVGElement.java 11 Oct 2001 09:16:24 -0000 1.16 +++ SVGElement.java 13 May 2002 10:29:52 -0000 1.16.2.1 @@ -1,5 +1,5 @@ /* - * $Id: SVGElement.java,v 1.16 2001/10/11 09:16:24 keiron Exp $ + * $Id: SVGElement.java,v 1.16.2.1 2002/05/13 10:29:52 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -37,6 +37,7 @@ import java.util.List; import java.util.ArrayList; import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; /** * class representing svg:svg pseudo flow object. @@ -107,37 +108,38 @@ final Element svgRoot = element; /* create an SVG area */ /* if width and height are zero, get the bounds of the content. */ - DefaultSVGContext dc = new DefaultSVGContext() { + final ForeignObjectArea foa = (ForeignObjectArea)area; + SVGContext dc = new SVGContext() { public float getPixelToMM() { // 72 dpi return 0.35277777777777777778f; } - public float getViewportWidth(Element e) throws IllegalStateException { - if(e == svgRoot) { - ForeignObjectArea foa = (ForeignObjectArea)area; - if(!foa.isContentWidthAuto()) { - return foa.getContentWidth(); - } - } - return super.getViewportWidth(e); - } - - public float getViewportHeight(Element e) throws IllegalStateException { - if(e == svgRoot) { - ForeignObjectArea foa = (ForeignObjectArea)area; - if(!foa.isContentHeightAuto()) { - return foa.getContentHeight(); - } - } - return super.getViewportHeight(e); + public Rectangle2D getBBox() { + return new Rectangle2D.Double(0, 0, foa.getContentWidth(), foa.getContentHeight()); } - public List getDefaultFontFamilyValue() { - return FONT_FAMILY; + public AffineTransform getCTM() { + return new AffineTransform(); + } + + public AffineTransform getGlobalTransform() { + return new AffineTransform(); + } + + public float getViewportWidth() { + return (float)foa.getContentWidth(); + } + + public float getViewportHeight() { + return (float)foa.getContentHeight(); + } + + public float getFontSize(){ + return fs.getFontSize() / 1000f; } }; - ((SVGOMDocument)doc).setSVGContext(dc); + ((SVGOMElement)svgRoot).setSVGContext(dc); try { String baseDir = Configuration.getStringValue("baseDir"); @@ -184,11 +186,12 @@ svg.end(); /* add the SVG area to the containing area */ - ForeignObjectArea foa = (ForeignObjectArea)area; foa.setObject(svg); foa.setIntrinsicWidth(svg.getWidth()); foa.setIntrinsicHeight(svg.getHeight()); + ((SVGOMElement)svgRoot).setSVGContext(null); + /* return status */ return new Status(Status.OK); } @@ -201,16 +204,6 @@ element = doc.getDocumentElement(); buildTopLevel(doc, element); - } - - public final static List FONT_FAMILY; - static { - FONT_FAMILY = new ArrayList(); - FONT_FAMILY.add("Helvetica"); - FONT_FAMILY.add("Times"); - FONT_FAMILY.add("Courier"); - FONT_FAMILY.add("sans-serif"); - FONT_FAMILY.add("serif"); } } 1.2.2.3 +3 -35 xml-fop/src/org/apache/fop/svg/SVGUserAgent.java Index: SVGUserAgent.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGUserAgent.java,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- SVGUserAgent.java 17 Mar 2002 23:37:08 -0000 1.2.2.2 +++ SVGUserAgent.java 13 May 2002 10:29:53 -0000 1.2.2.3 @@ -1,5 +1,5 @@ /* - * $Id: SVGUserAgent.java,v 1.2.2.2 2002/03/17 23:37:08 chrisg Exp $ + * $Id: SVGUserAgent.java,v 1.2.2.3 2002/05/13 10:29:53 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -34,7 +34,7 @@ import java.awt.RenderingHints; import java.awt.Dimension; -public class SVGUserAgent implements UserAgent { +public class SVGUserAgent extends UserAgentAdapter { AffineTransform currentTransform = null; Logger log; @@ -88,7 +88,7 @@ } public String getMedia() { - return ""; + return "print"; } /** @@ -106,21 +106,6 @@ return org.apache.fop.apps.Driver.getParserClassName(); } - /** - * Opens a link in a new component. - * @param doc The current document. - * @param uri The document URI. - */ - public void openLink(SVGAElement elt) { - } - - - public Point getClientAreaLocationOnScreen() { - return new Point(0, 0); - } - - public void setSVGCursor(java.awt.Cursor cursor) {} - public AffineTransform getTransform() { return currentTransform; } @@ -129,26 +114,9 @@ return new Dimension(100, 100); } - public EventDispatcher getEventDispatcher() { - return null; - } - - public boolean supportExtension(String str) { - return false; - } - - public boolean hasFeature(String str) { - return false; - } - public boolean isXMLParserValidating() { return true; } - - public void registerExtension(BridgeExtension be) {} - - public void handleElement(Element elt, Object data) {} - }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]