Browse Source

Fixed a couple minor bugs in CLI and config parsing


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1371734 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_0
Mehdi Houshmand 11 years ago
parent
commit
978313b554

+ 13
- 8
src/java/org/apache/fop/cli/CommandLineOptions.java View File

@@ -43,6 +43,7 @@ import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.FopConfParser;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FopFactoryBuilder;
import org.apache.fop.apps.FopFactoryConfig;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.pdf.PDFAMode;
import org.apache.fop.pdf.PDFEncryptionManager;
@@ -117,7 +118,7 @@ public class CommandLineOptions {
/* rendering options (for the user agent) */
private Map renderingOptions = new java.util.HashMap();
/* target resolution (for the user agent) */
private int targetResolution = 0;
private float targetResolution = FopFactoryConfig.DEFAULT_TARGET_RESOLUTION;

private boolean strictValidation = true;
/* control memory-conservation policy */
@@ -138,7 +139,7 @@ public class CommandLineOptions {

private boolean flushCache = false;

private URI baseURI = new File(".").toURI();
private URI baseURI = new File(".").getAbsoluteFile().toURI();

/**
* Construct a command line option object.
@@ -468,7 +469,7 @@ public class CommandLineOptions {
this.useStdIn = true;
} else {
fofile = new File(filename);
baseURI = fofile.toURI();
baseURI = getBaseURI(fofile);
}
return 1;
}
@@ -498,12 +499,16 @@ public class CommandLineOptions {
this.useStdIn = true;
} else {
xmlfile = new File(filename);
baseURI = xmlfile.toURI();
baseURI = getBaseURI(xmlfile);
}
return 1;
}
}

private URI getBaseURI(File file) {
return file.getAbsoluteFile().getParentFile().toURI();
}

private int parseAWTOutputOption(String[] args, int i) throws FOPException {
setOutputMode(MimeConstants.MIME_FOP_AWT_PREVIEW);
return 0;
@@ -730,7 +735,7 @@ public class CommandLineOptions {
this.useStdIn = true;
} else {
fofile = new File(filename);
baseURI = fofile.toURI();
baseURI = getBaseURI(fofile);
}
} else if (outputmode == null) {
outputmode = MimeConstants.MIME_PDF;
@@ -789,7 +794,7 @@ public class CommandLineOptions {
this.useStdIn = true;
} else {
areatreefile = new File(filename);
baseURI = areatreefile.toURI();
baseURI = getBaseURI(areatreefile);
}
return 1;
}
@@ -806,7 +811,7 @@ public class CommandLineOptions {
this.useStdIn = true;
} else {
iffile = new File(filename);
baseURI = iffile.toURI();
baseURI = getBaseURI(iffile);
}
return 1;
}
@@ -823,7 +828,7 @@ public class CommandLineOptions {
this.useStdIn = true;
} else {
imagefile = new File(filename);
baseURI = imagefile.toURI();
baseURI = getBaseURI(imagefile);
}
return 1;
}

+ 1
- 1
src/java/org/apache/fop/fonts/DefaultFontConfig.java View File

@@ -89,7 +89,7 @@ public final class DefaultFontConfig implements FontConfig {
} else {
this.strict = strict;
this.fontInfoCfg = cfg.getChild("fonts", false);
instance = new DefaultFontConfig(cfg.getChild("auto-detect", false) != null);
instance = new DefaultFontConfig(fontInfoCfg.getChild("auto-detect", false) != null);
parse();
}
}

Loading…
Cancel
Save