mirror of
https://github.com/apache/xmlgraphics-fop.git
synced 2024-08-29 05:58:54 +02:00
1.) Removed xsl file for property generation (no longer used, due to
Finn's work.) Removed build.xml entry. 2.) Disconnected the FOUserAgent from the SVGUserAgent. This will make the SVGUserAgent more portable although at the cost of a more complex constructor. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197467 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4669896af7
commit
aefe742054
@ -218,10 +218,7 @@ list of possible build targets.
|
||||
<property name="jai" value="JAIImage.java"/>
|
||||
|
||||
<property name="xslt" value="org.apache.xalan.xslt.Process"/>
|
||||
<property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/>
|
||||
<property name="src.propmaker.xsl" value="${src.codegen}/propmaker.xsl"/>
|
||||
|
||||
<property name="propinc.xsl" value="${src.codegen}/propinc.xsl"/>
|
||||
<property name="src.charlist.xsl" value="${src.codegen}/code-point-mapping.xsl"/>
|
||||
<property name="encodings.xml" value="${src.codegen}/encodings.xml"/>
|
||||
<property name="charlist.xsl" value="${src.codegen}/code-point-mapping.xsl"/>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,9 @@ import java.awt.geom.AffineTransform;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.svg.SVGDocument;
|
||||
|
||||
// Avalon
|
||||
import org.apache.avalon.framework.logger.Logger;
|
||||
|
||||
// Batik
|
||||
import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
|
||||
import org.apache.batik.dom.svg.SVGOMDocument;
|
||||
@ -87,7 +90,8 @@ public class SVGReader implements ImageReader {
|
||||
if (batik) {
|
||||
try {
|
||||
Loader loader = new Loader();
|
||||
return loader.getImage(uri, bis, ua);
|
||||
return loader.getImage(uri, bis, ua.getLogger(),
|
||||
ua.getPixelUnitToMillimeter());
|
||||
} catch (NoClassDefFoundError e) {
|
||||
batik = false;
|
||||
//ua.getLogger().error("Batik not in class path", e);
|
||||
@ -104,7 +108,7 @@ public class SVGReader implements ImageReader {
|
||||
*/
|
||||
class Loader {
|
||||
private FopImage.ImageInfo getImage(String uri, InputStream fis,
|
||||
FOUserAgent ua) {
|
||||
Logger logger, float pixelUnitToMM) {
|
||||
// parse document and get the size attributes of the svg element
|
||||
|
||||
try {
|
||||
@ -174,8 +178,8 @@ public class SVGReader implements ImageReader {
|
||||
|
||||
Element e = doc.getRootElement();
|
||||
String s;
|
||||
SVGUserAgent userAg =
|
||||
new SVGUserAgent(ua, new AffineTransform());
|
||||
SVGUserAgent userAg = new SVGUserAgent(logger, pixelUnitToMM,
|
||||
new AffineTransform());
|
||||
BridgeContext ctx = new BridgeContext(userAg);
|
||||
UnitProcessor.Context uctx =
|
||||
UnitProcessor.createContext(ctx, e);
|
||||
|
@ -220,7 +220,9 @@ public class PDFXMLHandler implements XMLHandler {
|
||||
int yOffset = pdfInfo.currentYPosition;
|
||||
|
||||
SVGUserAgent ua
|
||||
= new SVGUserAgent(context.getUserAgent(), new AffineTransform());
|
||||
= new SVGUserAgent(context.getUserAgent().getLogger(),
|
||||
context.getUserAgent().getPixelUnitToMillimeter(),
|
||||
new AffineTransform());
|
||||
|
||||
GVTBuilder builder = new GVTBuilder();
|
||||
BridgeContext ctx = new BridgeContext(ua);
|
||||
|
@ -257,8 +257,9 @@ public class PSXMLHandler implements XMLHandler {
|
||||
PSGenerator gen = psInfo.psGenerator;
|
||||
|
||||
SVGUserAgent ua
|
||||
= new SVGUserAgent(context.getUserAgent(), new AffineTransform());
|
||||
|
||||
= new SVGUserAgent(context.getUserAgent().getLogger(),
|
||||
context.getUserAgent().getPixelUnitToMillimeter(),
|
||||
new AffineTransform());
|
||||
|
||||
GVTBuilder builder = new GVTBuilder();
|
||||
BridgeContext ctx = new BridgeContext(ua);
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package org.apache.fop.svg;
|
||||
|
||||
import org.apache.fop.apps.FOUserAgent;
|
||||
import org.apache.fop.apps.FOFileHandler;
|
||||
import org.apache.batik.bridge.UserAgentAdapter;
|
||||
import org.apache.avalon.framework.logger.Logger;
|
||||
|
||||
@ -34,16 +34,20 @@ import java.awt.Dimension;
|
||||
*/
|
||||
public class SVGUserAgent extends UserAgentAdapter {
|
||||
private AffineTransform currentTransform = null;
|
||||
private FOUserAgent userAgent;
|
||||
private Logger logger;
|
||||
private float pixelUnitToMillimeter = 0.0f;
|
||||
|
||||
/**
|
||||
* Creates a new SVGUserAgent.
|
||||
* @param ua the FO user agent
|
||||
* @param log an Avalon logging instance
|
||||
* @param pixelUnitToMM The pixel to millimeter conversion factor
|
||||
* currently in effect
|
||||
* @param at the current transform
|
||||
*/
|
||||
public SVGUserAgent(FOUserAgent ua, AffineTransform at) {
|
||||
public SVGUserAgent(Logger log, float pixelUnitToMM, AffineTransform at) {
|
||||
logger = log;
|
||||
pixelUnitToMillimeter = pixelUnitToMM;
|
||||
currentTransform = at;
|
||||
userAgent = ua;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,7 +55,7 @@ public class SVGUserAgent extends UserAgentAdapter {
|
||||
* @return Logger the logger
|
||||
*/
|
||||
protected final Logger getLogger() {
|
||||
return this.userAgent.getLogger();
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +63,7 @@ public class SVGUserAgent extends UserAgentAdapter {
|
||||
* @param message the message to display
|
||||
*/
|
||||
public void displayError(String message) {
|
||||
getLogger().error(message);
|
||||
logger.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +71,7 @@ public class SVGUserAgent extends UserAgentAdapter {
|
||||
* @param ex the exception to display
|
||||
*/
|
||||
public void displayError(Exception ex) {
|
||||
getLogger().error("SVG Error" + ex.getMessage(), ex);
|
||||
logger.error("SVG Error" + ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +80,7 @@ public class SVGUserAgent extends UserAgentAdapter {
|
||||
* @param message the message to display
|
||||
*/
|
||||
public void displayMessage(String message) {
|
||||
getLogger().info(message);
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,7 +88,7 @@ public class SVGUserAgent extends UserAgentAdapter {
|
||||
* @param message the message to display
|
||||
*/
|
||||
public void showAlert(String message) {
|
||||
getLogger().warn(message);
|
||||
logger.warn(message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,7 +96,7 @@ public class SVGUserAgent extends UserAgentAdapter {
|
||||
* @return the pixel unit to millimeter conversion factor
|
||||
*/
|
||||
public float getPixelUnitToMillimeter() {
|
||||
return userAgent.getPixelUnitToMillimeter();
|
||||
return pixelUnitToMillimeter;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,7 +128,7 @@ public class SVGUserAgent extends UserAgentAdapter {
|
||||
* @return the XML parser class name
|
||||
*/
|
||||
public String getXMLParserClassName() {
|
||||
return org.apache.fop.apps.FOFileHandler.getParserClassName();
|
||||
return FOFileHandler.getParserClassName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user