You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by me...@apache.org on 2012/08/10 17:10:57 UTC

svn commit: r1371734 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: cli/CommandLineOptions.java fonts/DefaultFontConfig.java

Author: mehdi
Date: Fri Aug 10 15:10:57 2012
New Revision: 1371734

URL: http://svn.apache.org/viewvc?rev=1371734&view=rev
Log:
Fixed a couple minor bugs in CLI and config parsing

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/DefaultFontConfig.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=1371734&r1=1371733&r2=1371734&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java Fri Aug 10 15:10:57 2012
@@ -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;
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/DefaultFontConfig.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/DefaultFontConfig.java?rev=1371734&r1=1371733&r2=1371734&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/DefaultFontConfig.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/DefaultFontConfig.java Fri Aug 10 15:10:57 2012
@@ -89,7 +89,7 @@ public final class DefaultFontConfig imp
             } 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();
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org