diff options
author | Mehdi Houshmand <mehdi@apache.org> | 2012-08-10 15:10:57 +0000 |
---|---|---|
committer | Mehdi Houshmand <mehdi@apache.org> | 2012-08-10 15:10:57 +0000 |
commit | 978313b554c9df235f5eb5bdefb2c79ecf798a0d (patch) | |
tree | e8f67b929f7029b3e2bf6418e53ce921476c6533 /src | |
parent | f7b41bf07e2d0c29d5955fe42c67051735bc86bc (diff) | |
download | xmlgraphics-fop-978313b554c9df235f5eb5bdefb2c79ecf798a0d.tar.gz xmlgraphics-fop-978313b554c9df235f5eb5bdefb2c79ecf798a0d.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/cli/CommandLineOptions.java | 21 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/DefaultFontConfig.java | 2 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java index 03a9cfa48..886e27527 100644 --- a/src/java/org/apache/fop/cli/CommandLineOptions.java +++ b/src/java/org/apache/fop/cli/CommandLineOptions.java @@ -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; } diff --git a/src/java/org/apache/fop/fonts/DefaultFontConfig.java b/src/java/org/apache/fop/fonts/DefaultFontConfig.java index 6c5cebb42..375db34df 100644 --- a/src/java/org/apache/fop/fonts/DefaultFontConfig.java +++ b/src/java/org/apache/fop/fonts/DefaultFontConfig.java @@ -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(); } } |