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 je...@apache.org on 2005/11/10 11:15:51 UTC

svn commit: r332263 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps: PFMReader.java TTFReader.java

Author: jeremias
Date: Thu Nov 10 02:15:42 2005
New Revision: 332263

URL: http://svn.apache.org/viewcvs?rev=332263&view=rev
Log:
Bugzilla #37432:
Fix for TTFReader and PFMReader when they are used from an embedded application. The logger wasn't set in this case.
Submitted by: Timothy Gates <tgates.at.xplantechnology.com>

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/PFMReader.java   (contents, props changed)
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/TTFReader.java   (contents, props changed)

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/PFMReader.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/PFMReader.java?rev=332263&r1=332262&r2=332263&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/PFMReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/PFMReader.java Thu Nov 10 02:15:42 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
 import org.apache.commons.logging.LogFactory;
 
 //FOP
-import org.apache.fop.apps.Fop;
+import org.apache.fop.Version;
 import org.apache.fop.fonts.type1.PFMFile;
 import org.apache.fop.util.CommandLineLogger;
 
@@ -52,6 +52,18 @@
     protected static Log log;
 
     /**
+     * Main constructor.
+     */
+    public PFMReader() {
+        // Create logger if necessary here to allow embedding of PFMReader in
+        // other applications. There is a possible but harmless synchronization
+        // issue.
+        if (log == null) {
+            log = LogFactory.getLog(PFMReader.class);
+        }
+    }
+    
+    /**
      * Parse commandline arguments. put options in the HashMap and return
      * arguments in the String array
      * the arguments: -fn Perpetua,Bold -cn PerpetuaBold per.ttf Perpetua.xml
@@ -138,11 +150,10 @@
         } else {
             setLogLevel("info");
         }
-        log = LogFactory.getLog(PFMReader.class);
-
+        
         PFMReader app = new PFMReader();
 
-        log.info("PFM Reader for Apache FOP " + Fop.getVersion() + "\n");
+        log.info("PFM Reader for Apache FOP " + Version.getVersion() + "\n");
 
         if (options.get("-ef") != null) {
             embFile = (String)options.get("-ef");

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/PFMReader.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/TTFReader.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/TTFReader.java?rev=332263&r1=332262&r2=332263&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/TTFReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/TTFReader.java Thu Nov 10 02:15:42 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
 import org.apache.commons.logging.LogFactory;
 
 //FOP
-import org.apache.fop.apps.Fop;
+import org.apache.fop.Version;
 import org.apache.fop.fonts.truetype.FontFileReader;
 import org.apache.fop.fonts.truetype.TTFCmapEntry;
 import org.apache.fop.fonts.truetype.TTFFile;
@@ -53,6 +53,18 @@
     protected static Log log;
 
     /**
+     * Main constructor.
+     */
+    public TTFReader() {
+        // Create logger if necessary here to allow embedding of TTFReader in
+        // other applications. There is a possible but harmless synchronization
+        // issue.
+        if (log == null) {
+            log = LogFactory.getLog(TTFReader.class);
+        }
+    }
+    
+    /**
      * Parse commandline arguments. put options in the HashMap and return
      * arguments in the String array
      * the arguments: -fn Perpetua,Bold -cn PerpetuaBold per.ttf Perpetua.xml
@@ -154,11 +166,10 @@
         } else {
             setLogLevel("info");
         }
-        log = LogFactory.getLog(TTFReader.class);
 
         TTFReader app = new TTFReader();
 
-        log.info("TTF Reader for Apache FOP " + Fop.getVersion() + "\n");
+        log.info("TTF Reader for Apache FOP " + Version.getVersion() + "\n");
 
         if (options.get("-enc") != null) {
             String enc = (String)options.get("-enc");

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/TTFReader.java
------------------------------------------------------------------------------
    svn:keywords = Id



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