diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-11-10 10:15:42 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-11-10 10:15:42 +0000 |
commit | 0f5ba971cc8167fabded38e88543cb279f1df72d (patch) | |
tree | 2b1bf03c9f542dfc4f23f5373a758918da566621 /src/java/org/apache/fop | |
parent | 9373d427c43ec6be2fa35f199f26292fa9f05f5a (diff) | |
download | xmlgraphics-fop-0f5ba971cc8167fabded38e88543cb279f1df72d.tar.gz xmlgraphics-fop-0f5ba971cc8167fabded38e88543cb279f1df72d.zip |
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>
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@332263 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r-- | src/java/org/apache/fop/fonts/apps/PFMReader.java | 21 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/apps/TTFReader.java | 19 |
2 files changed, 31 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/fonts/apps/PFMReader.java b/src/java/org/apache/fop/fonts/apps/PFMReader.java index 83eb0879a..f5ca0e192 100644 --- a/src/java/org/apache/fop/fonts/apps/PFMReader.java +++ b/src/java/org/apache/fop/fonts/apps/PFMReader.java @@ -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.Log; 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 @@ public class PFMReader { 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 @@ public class PFMReader { } 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"); diff --git a/src/java/org/apache/fop/fonts/apps/TTFReader.java b/src/java/org/apache/fop/fonts/apps/TTFReader.java index 1755a491d..e63e7cd88 100644 --- a/src/java/org/apache/fop/fonts/apps/TTFReader.java +++ b/src/java/org/apache/fop/fonts/apps/TTFReader.java @@ -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.Log; 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 @@ public class TTFReader { 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 @@ public class TTFReader { } 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"); |