Index: fop.bat
===================================================================
--- fop.bat	(revision 517602)
+++ fop.bat	(working copy)
@@ -70,6 +70,8 @@
 set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\fop-hyph.jar
 set LOCALCLASSPATH=%LOCALCLASSPATH%;%FOP_HYPHENATION_PATH%
 
+set JAVAOPTS=-Denv.windir=%WINDIR%
+
 if "%JAVA_HOME%" == "" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
 if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
@@ -80,5 +82,4 @@
 
 :runFop
 rem ECHO "%JAVACMD%"
-"%JAVACMD%" %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
-
+"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
Index: fop.cmd
===================================================================
--- fop.cmd	(revision 517602)
+++ fop.cmd	(working copy)
@@ -58,6 +58,8 @@
 set LOCALCLASSPATH=%FOP_HYPHENATION_PATH%
 for %%l in (%LOCAL_FOP_HOME%build\*.jar %LIBDIR%\*.jar) do set LOCALCLASSPATH=!LOCALCLASSPATH!;%%l
 
+set JAVAOPTS=-Denv.windir=%WINDIR%
+
 if "%JAVA_HOME%" == "" goto noJavaHome
 if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
 if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
@@ -68,6 +70,6 @@
 
 :runFop
 rem echo "%JAVACMD%" %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
-"%JAVACMD%" %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
+"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.cli.Main %FOP_CMD_LINE_ARGS%
 
 ENDLOCAL
Index: src/java/org/apache/fop/config/BaseConfig.java
===================================================================
--- src/java/org/apache/fop/config/BaseConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/BaseConfig.java	(revision 0)
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
+import org.apache.avalon.framework.configuration.DefaultConfigurationSerializer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.apps.FopFactory;
+
+/**
+ * Fop configuration base class used as base
+ * for all configuration classes
+ * 
+ * @author Adrian Cumiskey
+ */
+abstract public class BaseConfig {
+    /** logger instance */
+    protected static Log log = LogFactory.getLog(FopConfig.class);
+    
+    /** configuration builder */
+    protected static DefaultConfigurationBuilder cfgBuilder = null;
+
+    /** configuration serializer */
+    protected static DefaultConfigurationSerializer cfgSerializer = null;
+    
+    /** avalon configuration */
+    protected static Configuration cfg = null;
+
+    /** fop factory configuration */
+    protected static FopFactory factory = null;
+
+    /**
+     * returns config builder instance, instantiating on demand
+     * @return default configuration builder
+     */
+    protected static DefaultConfigurationBuilder getBuilder() {
+        if (cfgBuilder == null) {
+            cfgBuilder = new DefaultConfigurationBuilder();
+        }
+        return cfgBuilder;
+    }
+
+    /**
+     * returns config serializer instance, instantiating on demand
+     * @return default configuration serializer
+     */
+    protected static DefaultConfigurationSerializer getSerializer() {
+        if (cfgSerializer == null) {
+            cfgSerializer = new DefaultConfigurationSerializer();
+        }
+        return cfgSerializer;
+    }
+}

Property changes on: src\java\org\apache\fop\config\BaseConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/CacheConfig.java
===================================================================
--- src/java/org/apache/fop/config/CacheConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/CacheConfig.java	(revision 0)
@@ -0,0 +1,438 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.ConfigurationUtil;
+import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.CachedFontInfo;
+import org.apache.fop.fonts.FontInfoCache;
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.fonts.FontUtil;
+import org.apache.fop.util.FileUtil;
+import org.apache.fop.util.LogUtil;
+
+public class CacheConfig extends BaseConfig {
+
+    /** font cache name */
+    private static final String CACHE_NAME = "fop-cache";
+
+    /** font cache file path */
+    private static final String DEFAULT_CACHE_FILENAME = "fop.cache";
+
+    /** default conf directory */
+    private static final String CONF_DIR = "conf/";
+
+    /** cache file */
+    private static File cacheFile = null;
+        
+    /** font cache config */
+    private static DefaultConfiguration cacheConfig = null;
+
+    /** number of fonts info cached */
+    private static int numFontsCached = 0;
+
+    /** number of failed (load) fonts */
+    private static int numFailedFonts = 0;
+
+    /**
+     * determines where cache file should be based upon configuration
+     * tries to use base dir first, then current working directory
+     * @return File cache File representation
+     */
+    private static File getCacheFile() {
+        if (cacheFile == null) {
+            // use current working directory
+            File confDir = new File(CONF_DIR);
+            if (confDir.isDirectory()) {
+                /// use conf dir underneath current working directory
+                cacheFile = new File(confDir, DEFAULT_CACHE_FILENAME);
+            } else {
+                String base = factory.getBaseURL();
+                if (base != null) {
+                    confDir = new File(base, CONF_DIR);
+                    if (confDir.isDirectory()) {
+                        cacheFile = new File(confDir, DEFAULT_CACHE_FILENAME);
+                    }
+                }            
+                // just use cache file in current working directory
+                cacheFile = new File(DEFAULT_CACHE_FILENAME);
+            }
+        }
+        return cacheFile;
+    }
+    
+    /**
+     * builds or returns the font cache config
+     * @return
+     * @throws FOPException
+     */
+    private static Configuration getConfiguration() throws FOPException {
+        if (cacheConfig == null) {
+            File cacheFile = getCacheFile();
+            if (!cacheFile.exists()) {
+                cacheConfig = new DefaultConfiguration(CACHE_NAME, cacheFile.getAbsolutePath());
+                cacheConfig.setAttribute("version", "1.0" /*org.apache.fop.Version.getVersion()*/);
+            } else {
+                try {
+                    if (FileUtil.validFile(cacheFile)) {
+                        cacheConfig = new DefaultConfiguration(
+                            getBuilder().buildFromFile(cacheFile));
+                    }
+                } catch (Exception e) {
+                    throw new FOPException(e);
+                }
+            }
+            if (cacheConfig == null) {
+                LogUtil.handleError(log,
+                        "failed to create or access fop cache file '" +
+                        cacheFile.getAbsolutePath() + "'",
+                        factory.validateUserConfigStrictly());
+            }
+        }
+        return cacheConfig;
+    }
+       
+    /**
+     * Adds to a font list from a font node Configuration definition
+     * 
+     * @param fontCfg Configuration object (font node)
+     * @param strict validate configuration strictly
+     * @return font info
+     * @throws FOPException if something's wrong with the config data
+     */
+    public static CachedFontInfo getFontInfoFromCache(Configuration fontCfg, boolean strict)
+    throws FOPException {
+        String metricsUrl = fontCfg.getAttribute("metrics-url", null);
+        String embedUrl = fontCfg.getAttribute("embed-url", null);
+        boolean useKerning = fontCfg.getAttributeAsBoolean("kerning", false);
+        
+        long lastModified = -1;
+        try {
+            lastModified = fontCfg.getAttributeAsLong("modified");
+        } catch (ConfigurationException e1) {
+            // failed to get modified date
+        }        
+
+        long cached = -1;
+        try {
+            cached = fontCfg.getAttributeAsLong("cached");
+        } catch (ConfigurationException e1) {
+            // failed to get cached date
+        }        
+
+        Configuration[] triple = fontCfg.getChildren("font-triplet");
+        List tripleList = new java.util.ArrayList();
+        for (int j = 0; j < triple.length; j++) {
+            try {
+                String name = triple[j].getAttribute("name");
+                if (name == null) {
+                    LogUtil.handleError(log, "font-triplet without name", strict);
+                    continue;
+                }
+                String weightStr = triple[j].getAttribute("weight");
+                if (weightStr == null) {
+                    LogUtil.handleError(log, "font-triplet without weight", strict);
+                    continue;
+                }
+                int weight = FontUtil.parseCSS2FontWeight(weightStr);
+                String style = triple[j].getAttribute("style");
+                if (style == null) {
+                    LogUtil.handleError(log, "font-triplet without style", strict);
+                    continue;
+                }
+                tripleList.add(FontInfo.createFontKey(name, style, weight));
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, strict);
+            }
+        }
+        CachedFontInfo fontInfo = new CachedFontInfo(
+                metricsUrl, useKerning, tripleList, embedUrl, lastModified, cached);
+            
+        if (log.isDebugEnabled()) {
+            log.debug("Adding font " + fontInfo.getEmbedFile()
+                    + ", metric file " + fontInfo.getMetricsFile());
+            for (int j = 0; j < tripleList.size(); ++j) {
+                FontTriplet triplet = (FontTriplet) tripleList.get(j);
+                log.debug("Font triplet "
+                        + triplet.getName() + ", "
+                        + triplet.getStyle() + ", "
+                        + triplet.getWeight());
+            }
+        }            
+        return fontInfo;
+    }
+
+    /**
+     * serializes cache config to file
+     * @throws FOPException
+     */
+    public static void save() throws FOPException {
+        // save font info/fail cache
+        try {
+            getSerializer().serializeToFile(cacheFile, cacheConfig);
+        } catch (Exception e) {
+            LogUtil.handleException(log, e, true);
+        }
+    }
+
+    /**
+     * sets the cache file
+     * @param cacheFile
+     */
+    public static void setCacheFile(File cacheFile) {
+        CacheConfig.cacheFile = cacheFile;
+    }
+
+    /**
+     * returns font info map from cache file
+     * 
+     * @param renderer 
+     * @return list of previously detected fonts
+     */
+    public static Map getFonts() {
+        if (!factory.cacheFonts()) {
+            return null;
+        }
+        Map fontInfoMap = Collections.synchronizedMap(new java.util.HashMap());
+        try {
+            getConfiguration();
+        } catch (FOPException e) {
+            log.error("Failed to get cache configuration :" + e.getMessage());
+            return Collections.synchronizedMap(new java.util.HashMap());
+        }
+        boolean strict = factory.validateUserConfigStrictly();
+        Configuration[] fontsCfg = cacheConfig.getChild("fonts").getChildren("font");
+        for (numFontsCached = 0; numFontsCached < fontsCfg.length; numFontsCached++) {
+            Configuration fontCfg = fontsCfg[numFontsCached];
+            CachedFontInfo fontInfo = null;
+            try {
+                fontInfo = getFontInfoFromCache(fontCfg, strict);
+            } catch (FOPException e) {
+                log.error("Error with parsing cache configuration: " + e.getMessage());
+                continue;
+            }
+            String embedUrl = FontInfoCache.getCacheKey(fontInfo);
+            URI u = null;
+            try {
+                u = new URI(embedUrl);
+            } catch (URISyntaxException e) {
+                log.error("Error with cache configuration uri syntax '" + embedUrl + "' : "
+                        + e.getMessage());
+                continue;
+            }
+            File fontFile = new File(u);
+            if (fontFile.isFile()) {
+                // cache font info item is up to date and still reflects font file.
+                // it is valid we can keep it in the cache
+                if (fontInfo.lastModified() == fontFile.lastModified()) {
+                    fontInfoMap.put(FontInfoCache.getCacheKey(fontInfo), fontInfo);                    
+                }
+            }
+        }
+        return fontInfoMap;
+    }
+
+    /**
+     * returns mapping of failed parsed/loadeed fonts
+     * embedUrl -> last modified date
+     * @return
+     */
+    public static Map getFailedFonts() {
+        if (!factory.cacheFonts()) {
+            return null;
+        }
+        Map fontFailMap = Collections.synchronizedMap(new java.util.HashMap());
+        try {
+            getConfiguration();
+        } catch (FOPException e) {
+            log.error("Failed to get cache configuration :" + e.getMessage());
+            return Collections.synchronizedMap(new java.util.HashMap());
+        }
+        Configuration[] fontsCfg = cacheConfig.getChild("failed").getChild("fonts").getChildren("font");
+        for (numFailedFonts = 0; numFailedFonts < fontsCfg.length; numFailedFonts++) {
+            Configuration fontCfg = fontsCfg[numFailedFonts];
+            String fontUrl = fontCfg.getAttribute("embed-url", null);
+            long lastModified = -1;
+            try {
+                lastModified = fontCfg.getAttributeAsLong("modified");
+            } catch (ConfigurationException e1) {
+                // failed to get modified date
+            }
+            fontFailMap.put(fontUrl, new Long(lastModified));
+        }
+        return fontFailMap;
+    }    
+
+    /**
+     * updates the font info map from the font cache
+     * 
+     * @param fontInfoMap font info map to serialize
+     * @throws FOPException fop exception
+     */
+    public static void updateFonts(Map fontInfoMap) throws FOPException {
+        // cache has not grown so we don't need to save
+        if (numFontsCached == fontInfoMap.size()) {
+            return;
+        }
+
+        if (getConfiguration() == null) {
+            return;
+        }
+
+        // create new fonts parent node
+        DefaultConfiguration fontsCfg = null;
+        Configuration origFontsCfg = cacheConfig.getChild("fonts");
+        try {
+            fontsCfg = new DefaultConfiguration(origFontsCfg);
+        } catch (ConfigurationException e) {
+            // shouldn't happen
+            LogUtil.handleException(log, e, factory.validateStrictly());
+        }
+        
+        long cached = System.currentTimeMillis();
+        // add new font info nodes to fonts parent node
+        for (Iterator it = fontInfoMap.values().iterator(); it.hasNext();) {
+            CachedFontInfo fontInfo = (CachedFontInfo)it.next();
+            String fontUrl = FontInfoCache.getCacheKey(fontInfo);
+            Configuration[] fontCfgs = fontsCfg.getChildren("font");
+            boolean found = false;
+            for (int i = 0; i < fontCfgs.length; i++) {
+                Configuration fontCfg = fontCfgs[i];
+                String cfgFontUrl = null;
+                try {
+                    cfgFontUrl = fontCfg.getAttribute("embed-url");
+                } catch (ConfigurationException e) {
+                    try {
+                        cfgFontUrl = fontCfg.getAttribute("metrics-url");
+                    } catch (ConfigurationException e1) {
+                        log.error(ConfigurationUtil.toString(fontCfg));
+                        LogUtil.handleException(log, e, factory.validateStrictly());
+                        continue;
+                    }
+                }
+                if(fontUrl.equals(cfgFontUrl)) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                // add to cache
+                DefaultConfiguration fontCfg = new DefaultConfiguration("font");
+                fontCfg.setAttribute("metrics-url", fontInfo.getMetricsFile());
+                fontCfg.setAttribute("embed-url", fontInfo.getEmbedFile());
+                fontCfg.setAttribute("kerning", String.valueOf(fontInfo.getKerning()));
+                fontCfg.setAttribute("cached", cached);
+                
+                // add associated font triplet list for this font info
+                List fontTriplets = fontInfo.getFontTriplets();
+                for (Iterator iter = fontTriplets.iterator(); iter.hasNext();) {
+                    FontTriplet fontTriplet = (FontTriplet)iter.next();
+                    DefaultConfiguration fontTripletCfg = new DefaultConfiguration("font-triplet");
+                    fontTripletCfg.setAttribute("name", fontTriplet.getName());
+                    fontTripletCfg.setAttribute("style", fontTriplet.getStyle());
+                    fontTripletCfg.setAttribute("weight", String.valueOf(fontTriplet.getWeight()));
+                    fontCfg.addChild(fontTripletCfg);
+                }
+                long lastModified = fontInfo.lastModified();
+                if (lastModified >= 0) {
+                    fontCfg.setAttribute("modified", String.valueOf(lastModified));
+                }
+                fontsCfg.addChild(fontCfg);
+            }
+        }
+        // remove old fonts parent node and add new one
+        cacheConfig.removeChild(origFontsCfg);
+        cacheConfig.addChild(fontsCfg);
+    }
+
+    /**
+     * updates the failed font map from the font cache
+     * 
+     * @param fontInfoMap font info map to serialize
+     * @throws FOPException fop exception
+     */
+    public static void updateFailedFonts(Map fontFailMap) throws FOPException {
+        // cache has not grown so we don't need to save
+        if (numFailedFonts == fontFailMap.size()) {
+            return;
+        }
+        
+        if (getConfiguration() == null) {
+            return;
+        }
+
+        Configuration origFailed = cacheConfig.getChild("failed");
+        DefaultConfiguration failedFontsCfg = null;
+        try {
+            failedFontsCfg = new DefaultConfiguration(origFailed.getChild("fonts"));
+        } catch (ConfigurationException e) {
+            // shouldn't happen
+            LogUtil.handleException(log, e, factory.validateStrictly());
+        }
+
+        // iterate over failed font map from font cache 
+        // adding any new failed fonts to cache
+        long cached = System.currentTimeMillis();
+        for (Iterator it = fontFailMap.keySet().iterator(); it.hasNext();) {
+            String embedUrl = (String)it.next();
+            Configuration[] fontCfgs = failedFontsCfg.getChildren("font");
+            boolean found = false;
+            for (int i = 0; i < fontCfgs.length; i++) {
+                String cacheEmbedUrl = null;
+                try {
+                    cacheEmbedUrl = fontCfgs[i].getAttribute("embed-url");
+                } catch (ConfigurationException e) {
+                    // shouldn't happen
+                    log.error(ConfigurationUtil.toString(fontCfgs[i]));
+                    LogUtil.handleException(log, e, factory.validateStrictly());
+                }
+                if (cacheEmbedUrl.equals(embedUrl)) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                // add to cache
+                long lastModified = ((Long)fontFailMap.get(embedUrl)).longValue();
+                DefaultConfiguration fontCfg = new DefaultConfiguration("font");
+                fontCfg.setAttribute("embed-url", embedUrl);
+                fontCfg.setAttribute("modified", lastModified );
+                fontCfg.setAttribute("cached", cached);
+                failedFontsCfg.addChild(fontCfg);
+            }
+        }
+        // remove old failed fonts parent node and add new one
+        cacheConfig.removeChild(origFailed);
+        DefaultConfiguration failedCfg = new DefaultConfiguration("failed");
+        failedCfg.addChild(failedFontsCfg);
+        cacheConfig.addChild(failedCfg);
+    }        
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\config\CacheConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/FopConfig.java
===================================================================
--- src/java/org/apache/fop/config/FopConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/FopConfig.java	(revision 0)
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.Collections;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.fonts.FontInfoCache;
+import org.apache.fop.util.LogUtil;
+import org.xml.sax.SAXException;
+
+/**
+ * 
+ * Master Fop Configuration object
+ * @author Adrian Cumiskey
+ *
+ */
+public class FopConfig extends BaseConfig {
+    
+    /** Defines if FOP should use an alternative rule to determine text indents */
+    public static final boolean DEFAULT_BREAK_INDENT_INHERITANCE = false;
+
+    /** Defines if FOP should validate the user config strictly */
+    public static final boolean DEFAULT_STRICT_USERCONFIG_VALIDATION = true;
+
+    /** Defines if FOP should use strict validation for FO and user config */
+    public static final boolean DEFAULT_STRICT_FO_VALIDATION = true;
+
+    /** Defines the default page-width */
+    public static final String DEFAULT_PAGE_WIDTH = "8.26in";
+
+    /** Defines the default page-height */
+    public static final String DEFAULT_PAGE_HEIGHT = "11in";
+
+    /** Defines the default source resolution (72dpi) for FOP */
+    public static final float DEFAULT_SOURCE_RESOLUTION = 72.0f; //dpi
+
+    /** Defines the default target resolution (72dpi) for FOP */
+    public static final float DEFAULT_TARGET_RESOLUTION = 72.0f; //dpi
+
+    /** Cache detected font triplet info */
+    public static final boolean DEFAULT_CACHE_FONT_INFO = true;
+
+    private static final Class[] METHOD_ARGS = {Object.class};
+
+    private static Map classMethodMap = Collections.synchronizedMap(new java.util.HashMap());
+    
+    /**
+     * Default constructor invoked from FopFactory constructor
+     * @param factory - fop factory
+     */
+    public FopConfig(FopFactory factory) {
+        BaseConfig.factory = factory;
+    }
+
+    /**
+     * given an object returns invokes appropriate configuration method
+     * @param obj object
+     * @throws FOPException fop exception
+     */
+    public static void configure(Object obj) throws FOPException {
+        if (log.isDebugEnabled()) {
+            log.debug(obj);
+        }
+
+        if (BaseConfig.cfg == null) {
+            if (log.isDebugEnabled()) {
+                log.debug("userconfig is null");
+            }            
+            return;
+        }
+        
+        String className = obj.getClass().getName();
+        className = className.substring(className.lastIndexOf('.') + 1);
+        try {
+            Class clazz = Class.forName("org.apache.fop.config." + className + "Config");
+            Method method = null;
+            if (!classMethodMap.containsKey(clazz)) {
+                method = clazz.getDeclaredMethod("configure", METHOD_ARGS);
+                classMethodMap.put(clazz, method);
+            } else {
+                method = (Method)classMethodMap.get(clazz);
+            }
+            method.invoke(null, new Object[] {obj});
+        } catch (Exception e) {
+            LogUtil.handleException(log, e, true);
+        }
+    }
+    
+    /**
+     * Set the user configuration.
+     * @param userConfigFile the configuration file
+     * @throws IOException if an I/O error occurs
+     * @throws SAXException if a parsing error occurs
+     */
+    public void setUserConfig(File userConfigFile) throws SAXException, IOException {
+        try {
+            setUserConfig(getBuilder().buildFromFile(userConfigFile));
+        } catch (ConfigurationException e) {
+            throw new FOPException(e);
+        }
+    }
+    
+    /**
+     * Set the user configuration from an URI.
+     * @param uri the URI to the configuration file
+     * @throws IOException if an I/O error occurs
+     * @throws SAXException if a parsing error occurs
+     */
+    public void setUserConfig(String uri) throws SAXException, IOException {
+        try {
+            setUserConfig(getBuilder().build(uri));
+        } catch (ConfigurationException e) {
+            throw new FOPException(e);
+        }
+    }
+    
+    /**
+     * Set the user configuration.
+     * @param cfg avalon configuration
+     * @throws FOPException if a configuration problem occurs 
+     */
+    public void setUserConfig(Configuration cfg) throws FOPException {
+        BaseConfig.cfg = cfg;
+        FopFactoryConfig.configure(BaseConfig.factory);
+    }
+
+    /**
+     * Get the avalon user configuration.
+     * @return the user configuration
+     */
+    public Configuration getUserConfig() {
+        return BaseConfig.cfg;
+    }
+    
+    /**
+     * sets the cache file
+     * @param cacheFile
+     */
+    public void setCacheFile(File cacheFile) {
+        CacheConfig.setCacheFile(cacheFile);
+    }    
+}

Property changes on: src\java\org\apache\fop\config\FopConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/FopFactoryConfig.java
===================================================================
--- src/java/org/apache/fop/config/FopFactoryConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/FopFactoryConfig.java	(revision 0)
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import java.net.MalformedURLException;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.util.LogUtil;
+
+/**
+ * FopFactory Configurer
+ * @author Adrian Cumiskey
+ */
+public class FopFactoryConfig extends BaseConfig {
+
+    /**
+     * Initializes user agent settings from the user configuration
+     * file, if present: baseURL, resolution, default page size,...
+     * @see BaseConfig#configure(Object)
+     */
+    public static void configure(Object obj) throws FOPException {
+        if (log.isInfoEnabled()) {
+            log.info("Initializing FopFactory Configuration");        
+        }
+
+        BaseConfig.factory = (FopFactory)obj;
+        
+        // strict configuration
+        if (cfg.getChild("strict-configuration", false) != null) {
+            try {
+                factory.setStrictUserConfigValidation(
+                        cfg.getChild("strict-configuration").getValueAsBoolean());
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, false);
+            }
+        }        
+        boolean strict = factory.validateUserConfigStrictly();
+        
+        // strict fo validation
+        if (cfg.getChild("strict-validation", false) != null) {
+            try {
+                factory.setStrictValidation(
+                        cfg.getChild("strict-validation").getValueAsBoolean());
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, strict);
+            }
+        }
+
+        // base definitions for relative path resolution
+        if (cfg.getChild("base", false) != null) {
+            try {
+                factory.setBaseURL(
+                        cfg.getChild("base").getValue(null));
+            } catch (MalformedURLException mfue) {
+                LogUtil.handleException(log, mfue, strict);
+            }
+        }
+        if (cfg.getChild("font-base", false) != null) {
+            try {
+                factory.setFontBaseURL(
+                        cfg.getChild("font-base").getValue(null));
+            } catch (MalformedURLException mfue) {
+                LogUtil.handleException(log, mfue, strict);
+            }
+        }
+        if (cfg.getChild("hyphenation-base", false) != null) {
+            try {
+                factory.setHyphenBaseURL(
+                        cfg.getChild("hyphenation-base").getValue(null));
+            } catch (MalformedURLException mfue) {
+                LogUtil.handleException(log, mfue, strict);
+            }
+        }
+        
+        // renderer options
+        if (cfg.getChild("source-resolution", false) != null) {
+            factory.setSourceResolution(
+                    cfg.getChild("source-resolution").getValueAsFloat(
+                            FopConfig.DEFAULT_SOURCE_RESOLUTION));
+            if (log.isInfoEnabled()) {
+                log.info("source-resolution set to: " + factory.getSourceResolution() 
+                    + "dpi (px2mm=" + factory.getSourcePixelUnitToMillimeter() + ")");
+            }
+        }
+        if (cfg.getChild("target-resolution", false) != null) {
+            factory.setTargetResolution(
+                    cfg.getChild("target-resolution").getValueAsFloat(
+                            FopConfig.DEFAULT_TARGET_RESOLUTION));
+            if (log.isInfoEnabled()) {
+                log.info("target-resolution set to: " + factory.getTargetResolution() 
+                        + "dpi (px2mm=" + factory.getTargetPixelUnitToMillimeter() + ")");                
+            }
+        }
+        if (cfg.getChild("break-indent-inheritance", false) != null) {
+            try {
+                factory.setBreakIndentInheritanceOnReferenceAreaBoundary(
+                        cfg.getChild("break-indent-inheritance").getValueAsBoolean());
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, strict);
+            }
+        }     
+        Configuration pageConfig = cfg.getChild("default-page-settings");
+        if (pageConfig.getAttribute("height", null) != null) {
+            factory.setPageHeight(pageConfig.getAttribute("height", FopConfig.DEFAULT_PAGE_HEIGHT));
+            if (log.isInfoEnabled()) {
+                log.info("Default page-height set to: " + factory.getPageHeight());        
+            }
+        }
+        if (pageConfig.getAttribute("width", null) != null) {
+            factory.setPageWidth(pageConfig.getAttribute("width", FopConfig.DEFAULT_PAGE_WIDTH));
+            if (log.isInfoEnabled()) {
+                log.info("Default page-width set to: " + factory.getPageWidth());
+            }
+        }
+
+        // caching (fonts)
+        if (cfg.getChild("cache-fonts", false) != null) {
+            try {
+                factory.setCacheFonts(
+                        cfg.getChild("cache-fonts").getValueAsBoolean());
+            } catch (ConfigurationException mfue) {
+                LogUtil.handleException(log, mfue, strict);
+            }
+        }
+        if (cfg.getChild("cache-file", false) != null) {
+            factory.setCacheFile(cfg.getChild("cache-file").getValue(null));
+        }
+    }    
+}

Property changes on: src\java\org\apache\fop\config\FopFactoryConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/Java2DRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/Java2DRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/Java2DRendererConfig.java	(revision 0)
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.render.java2d.Java2DRenderer;
+
+/**
+ * Configurerer for Java 2D renderer
+ * @author acumiskey
+ */
+public class Java2DRendererConfig extends RendererConfig {
+    
+    /**
+     * Configure the Java 2D renderer.
+     */
+    public static void configure(Object object) throws FOPException {
+        Java2DRenderer renderer = (Java2DRenderer)object;
+
+        Configuration cfg = RendererConfig.getRendererConfig(renderer);
+        if (cfg != null) {
+            String s = cfg.getChild(Java2DRenderer.JAVA2D_TRANSPARENT_PAGE_BACKGROUND, true).getValue(null);
+            if (s != null) {
+                renderer.setTransparentPageBackground("true".equalsIgnoreCase(s));
+            }
+        }
+    }
+}

Property changes on: src\java\org\apache\fop\config\Java2DRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/PCLRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/PCLRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/PCLRendererConfig.java	(revision 0)
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.render.pcl.PCLRenderer;
+
+public class PCLRendererConfig extends RendererConfig {
+    /**
+     * Configure the TIFF renderer. Get the configuration to be used for
+     * compression
+     * @see BaseConfig#configure(Object)
+     */
+    public static void configure(Object object) throws FOPException {
+        PCLRenderer renderer = (PCLRenderer)object;
+
+        Configuration cfg = RendererConfig.getRendererConfig(renderer);
+        if (cfg != null) {
+            String rendering = cfg.getChild("rendering").getValue(null);
+            if ("quality".equalsIgnoreCase(rendering)) {
+                renderer.setQualityBeforeSpeed(true);
+            } else if ("speed".equalsIgnoreCase(rendering)) {
+                renderer.setQualityBeforeSpeed(false);
+            } else if (rendering != null) {
+                throw new FOPException(
+                        "Valid values for 'rendering' are 'quality' and 'speed'. Value found: " 
+                            + rendering);
+            }
+            String textRendering = cfg.getChild("text-rendering").getValue(null);
+            if ("bitmap".equalsIgnoreCase(textRendering)) {
+                renderer.setAllTextAsBitmaps(true);
+            } else if ("auto".equalsIgnoreCase(textRendering)) {
+                renderer.setAllTextAsBitmaps(false);
+            } else if (textRendering != null) {
+                throw new FOPException(
+                        "Valid values for 'text-rendering' are 'auto' and 'bitmap'. Value found: " 
+                            + textRendering);
+            }
+        }
+    }
+}

Property changes on: src\java\org\apache\fop\config\PCLRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/PDFRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/PDFRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/PDFRendererConfig.java	(revision 0)
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.pdf.PDFAMode;
+import org.apache.fop.pdf.PDFFilterList;
+import org.apache.fop.pdf.PDFXMode;
+import org.apache.fop.render.pdf.PDFRenderer;
+import org.apache.fop.util.LogUtil;
+
+public class PDFRendererConfig extends RendererConfig {
+
+    /**
+     * Configure the PDF renderer.
+     * Get the configuration to be used for pdf stream filters,
+     * fonts etc.
+     */
+    public static void configure(Object object) throws FOPException {
+        PDFRenderer renderer = (PDFRenderer)object;
+
+        Configuration rendererCfg = RendererConfig.getRendererConfig(renderer);
+        if (rendererCfg != null) {
+            //PDF filters
+            try {
+                Map filterMap = buildFilterMapFromConfiguration(rendererCfg);
+                if (filterMap != null) {
+                    renderer.setFilterMap(filterMap);
+                }
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, false);
+            }
+    
+            RendererConfig.configure(object);
+    
+            String s = rendererCfg.getChild(PDFRenderer.PDF_A_MODE, true).getValue(null);
+            if (s != null) {
+                renderer.setAMode(PDFAMode.valueOf(s));
+            }
+            s = rendererCfg.getChild(PDFRenderer.PDF_X_MODE, true).getValue(null);
+            if (s != null) {
+                renderer.setXMode(PDFXMode.valueOf(s));
+            }
+            s = rendererCfg.getChild(PDFRenderer.KEY_OUTPUT_PROFILE, true).getValue(null);
+            if (s != null) {
+                renderer.setOutputProfileURI(s);
+            }
+        }
+    }
+
+    /**
+     * Builds a filter map from an Avalon Configuration object.
+     * @param cfg the Configuration object
+     * @return Map the newly built filter map
+     * @throws ConfigurationException if a filter list is defined twice
+     */
+    public static Map buildFilterMapFromConfiguration(Configuration cfg) 
+                throws ConfigurationException {
+        Map filterMap = new java.util.HashMap();
+        Configuration[] filterLists = cfg.getChildren("filterList");
+        for (int i = 0; i < filterLists.length; i++) {
+            Configuration filters = filterLists[i];
+            String type = filters.getAttribute("type", null);
+            Configuration[] filt = filters.getChildren("value");
+            List filterList = new java.util.ArrayList();
+            for (int j = 0; j < filt.length; j++) {
+                String name = filt[j].getValue();
+                filterList.add(name);
+            }
+            
+            if (type == null) {
+                type = PDFFilterList.DEFAULT_FILTER;
+            }
+    
+            if (!filterList.isEmpty() && log.isDebugEnabled()) {
+                StringBuffer debug = new StringBuffer("Adding PDF filter");
+                if (filterList.size() != 1) {
+                    debug.append("s");
+                }
+                debug.append(" for type ").append(type).append(": ");
+                for (int j = 0; j < filterList.size(); j++) {
+                    if (j != 0) {
+                        debug.append(", ");
+                    }
+                    debug.append(filterList.get(j));
+                }
+                log.debug(debug.toString());
+            }
+            
+            if (filterMap.get(type) != null) {
+                throw new ConfigurationException("A filterList of type '" 
+                    + type + "' has already been defined");
+            }
+            filterMap.put(type, filterList);
+        }
+        return filterMap;                
+    }
+}

Property changes on: src\java\org\apache\fop\config\PDFRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/PSRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/PSRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/PSRendererConfig.java	(revision 0)
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.render.ps.PSRenderer;
+
+public class PSRendererConfig extends RendererConfig {
+
+    /**
+     * Configure the PS renderer.
+     * @see BaseConfig#configure(Object)
+     */
+    public static void configure(Object object) throws FOPException {
+        PSRenderer renderer = (PSRenderer)object;
+
+        Configuration cfg = RendererConfig.getRendererConfig(renderer);
+        if (cfg != null) {
+            RendererConfig.configure(renderer);
+
+            renderer.setAutoRotateLandscape(
+                cfg.getChild("auto-rotate-landscape").getValueAsBoolean(false));
+        }
+    }
+}

Property changes on: src\java\org\apache\fop\config\PSRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/RendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/RendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/RendererConfig.java	(revision 0)
@@ -0,0 +1,307 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.CachedFontInfo;
+import org.apache.fop.fonts.EmbedFontInfo;
+import org.apache.fop.fonts.FontInfoCache;
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.FontResolver;
+import org.apache.fop.fonts.FontSetup;
+import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.fonts.FontUtil;
+import org.apache.fop.fonts.autodetect.FontFileFinder;
+import org.apache.fop.fonts.autodetect.NativeFontFileFinder;
+import org.apache.fop.fonts.autodetect.FontInfoFinder;
+import org.apache.fop.render.PrintRenderer;
+import org.apache.fop.render.Renderer;
+import org.apache.fop.util.LogUtil;
+
+/**
+ * configures renderer fonts
+ * @author Adrian Cumiskey
+ */
+abstract public class RendererConfig extends BaseConfig {
+
+    /** have we already autodetected system fonts? */
+    static boolean autodetected = false;
+
+    /**
+     * Builds a list of EmbedFontInfo objects for use with the setup() method.
+     * 
+     * @param object calling Renderer object
+     * @throws FOPException if something's wrong with the config data
+     */
+    public static void configure(Object object) throws FOPException {
+        PrintRenderer renderer = (PrintRenderer)object;
+
+        Configuration cfg = RendererConfig.getRendererConfig(renderer);
+        if (cfg == null) {
+            return;
+        }
+
+        FontResolver fontResolver = renderer.getFontResolver();
+        if (fontResolver == null) {
+            //Ensure that we have minimal font resolution capabilities
+            fontResolver = FontSetup.createMinimalFontResolver();
+        }
+
+        boolean strict = factory.validateUserConfigStrictly();
+        boolean cacheFonts = factory.cacheFonts();
+
+        List fontInfoList = new java.util.ArrayList();
+
+        Configuration fonts = cfg.getChild("fonts");
+        if (fonts != null) {
+            // native o/s search (autodetect) configuration
+            boolean autodetect = (fonts.getChild("auto-detect", false) != null);
+            if (!RendererConfig.autodetected && autodetect) {
+                // search in font base if it is defined and
+                // is a directory but don't recurse
+                String fontBaseURL = renderer.getUserAgent().getFontBaseURL();
+                if (fontBaseURL != null) {
+                    File fontBaseDir = new File(fontBaseURL);
+                    // only examine font base if it is a directory
+                    if (fontBaseDir.isDirectory()) {
+                        addFontInfoListFromFileList(
+                                FontFileFinder.find(fontBaseDir, fontResolver, false, strict),
+                                fontInfoList,
+                                fontResolver,
+                                cacheFonts
+                        );
+                    }
+                }
+
+                // native o/s font directory finder
+                addFontInfoListFromFileList(
+                        NativeFontFileFinder.find(fontResolver, strict),
+                        fontInfoList,
+                        fontResolver,
+                        cacheFonts
+                );
+                RendererConfig.autodetected = true;
+            }
+
+            // directory (multiple font) configuration
+            Configuration[] directories = fonts.getChildren("directory");
+            for (int i = 0; i < directories.length; i++) {
+                boolean recursive = directories[i].getAttributeAsBoolean("recursive", false);
+                String directory = null;
+                try {
+                    directory = directories[i].getValue();
+                } catch (ConfigurationException e) {
+                    LogUtil.handleException(log, e, strict);
+                    continue;
+                }
+                if (directory == null) {
+                    LogUtil.handleException(log,
+                            new FOPException("directory defined without value"), strict);
+                    continue;
+                }
+                addFontInfoListFromFileList(
+                        FontFileFinder.find(new File(directory), fontResolver, recursive, strict),
+                        fontInfoList,
+                        fontResolver,
+                        cacheFonts
+                );
+            }
+            
+            // font file (singular) configuration
+            Configuration[] font = fonts.getChildren("font");
+            for (int i = 0; i < font.length; i++) {
+                EmbedFontInfo fontInfo = getFontInfoFromConfiguration(
+                        font[i], fontResolver, strict, cacheFonts);
+                if (fontInfo != null) {
+                    fontInfoList.add(fontInfo);
+                }
+            }
+        }
+        if (factory.cacheFonts() && FontInfoCache.hasChanged()) {
+            FontInfoCache.write();
+        }
+        renderer.addFontList(fontInfoList);
+    }
+
+    /**
+     * iterates over font file list adding font info to list
+     * @param fontFileList font file list
+     * @param fontInfoList font info list
+     * @param resolver font resolver
+     */
+    private static void addFontInfoListFromFileList(
+            List fontFileList, List fontInfoList, FontResolver resolver, boolean cacheFonts) {
+        for (Iterator iter = fontFileList.iterator(); iter.hasNext();) {
+            File fontFile = (File)iter.next();
+            // parse font to ascertain font info
+            EmbedFontInfo fontInfo = FontInfoFinder.find(fontFile, resolver, cacheFonts);
+            if (fontInfo != null) {
+                fontInfoList.add(fontInfo);                
+            }
+        }
+    }
+        
+    /**
+     * Returns a font info from a font node Configuration definition
+     * 
+     * @param fontCfg Configuration object (font node)
+     * @param fontResolver font resolver used to resolve font
+     * @param strict validate configuration strictly
+     * @return font info
+     * @throws FOPException if something's wrong with the config data
+     */
+    public static EmbedFontInfo getFontInfoFromConfiguration(
+            Configuration fontCfg, FontResolver fontResolver, boolean strict, boolean cacheFonts)
+    throws FOPException {
+        String metricsUrl = fontCfg.getAttribute("metrics-url", null);
+        String embedUrl = fontCfg.getAttribute("embed-url", null);
+
+        if (metricsUrl == null && embedUrl == null) {
+            LogUtil.handleError(log, "Font configuration without metric-url or embed-url", strict);
+            return null;
+        }
+        if (embedUrl != null) {
+            StreamSource source = (StreamSource)fontResolver.resolve(embedUrl);
+            if (source == null) {
+                LogUtil.handleError(log,
+                        "Failed to resolve font with embed-url '" + embedUrl + "'", strict);
+                return null;
+            }
+            embedUrl = source.getSystemId(); // absolute path/url
+        }
+        if (metricsUrl != null) {
+            StreamSource source = (StreamSource)fontResolver.resolve(metricsUrl);
+            if (source == null) {
+                LogUtil.handleError(log,
+                        "Failed to resolve font metric-url '" + metricsUrl + "'", strict);
+                return null;
+            }
+            metricsUrl = source.getSystemId(); // absolute path/url
+        }
+        boolean useKerning = fontCfg.getAttributeAsBoolean("kerning", false);
+                        
+        EmbedFontInfo fontInfo = null;
+        Configuration[] tripletCfg = fontCfg.getChildren("font-triplet");
+        // no font triplet info
+        if (tripletCfg.length == 0) {
+            LogUtil.handleError(log, "font without font-triplet", strict);
+
+            // if not strict try to determine font info from the embed/metrics url
+            File fontFile = CachedFontInfo.getFontFileFromUrls(new String[] {embedUrl, metricsUrl});
+            if (fontFile != null) {
+                return FontInfoFinder.find(fontFile, fontResolver, cacheFonts);
+            } else {
+                return null;
+            }
+        } else {
+            List tripleList = new java.util.ArrayList();
+            for (int j = 0; j < tripletCfg.length; j++) {
+                try {
+                    String name = tripletCfg[j].getAttribute("name");
+                    if (name == null) {
+                        LogUtil.handleError(log, "font-triplet without name", strict);
+                        continue;
+                    }
+                    String weightStr = tripletCfg[j].getAttribute("weight");
+                    if (weightStr == null) {
+                        LogUtil.handleError(log, "font-triplet without weight", strict);
+                        continue;
+                    }
+                    int weight = FontUtil.parseCSS2FontWeight(weightStr);
+                    String style = tripletCfg[j].getAttribute("style");
+                    if (style == null) {
+                        LogUtil.handleError(log, "font-triplet without style", strict);
+                        continue;
+                    }
+                    tripleList.add(FontInfo.createFontKey(name, style, weight));
+                } catch (ConfigurationException e) {
+                    LogUtil.handleException(log, e, strict);
+                }
+            }
+            
+            fontInfo = new EmbedFontInfo(metricsUrl, useKerning, tripleList, embedUrl);
+            
+            if (cacheFonts) {
+                FontInfoCache.add(fontInfo);
+            }
+
+            if (log.isDebugEnabled()) {
+                log.debug("Adding font " + fontInfo.getEmbedFile()
+                        + ", metric file " + fontInfo.getMetricsFile());
+                for (int j = 0; j < tripleList.size(); ++j) {
+                    FontTriplet triplet = (FontTriplet) tripleList.get(j);
+                    log.debug("Font triplet "
+                            + triplet.getName() + ", "
+                            + triplet.getStyle() + ", "
+                            + triplet.getWeight());
+                }
+            }            
+        }
+        return fontInfo;
+    }
+    
+    /**
+     * Returns the configuration subtree for a specific renderer.
+     * @param renderer the renderer
+     * @return the requested configuration subtree, null if there's no configuration
+     */
+    protected static Configuration getRendererConfig(Renderer renderer) {
+        if (cfg == null) {
+            if (BaseConfig.log.isDebugEnabled()) {
+                BaseConfig.log.debug("userconfig is null");
+            }
+            return null;            
+        }
+    
+        String mimeType = renderer.getMimeType();
+        if (mimeType == null) {
+            if (BaseConfig.log.isInfoEnabled()) {
+                BaseConfig.log.info("renderer mimeType is null");
+            }
+            return null;
+        }
+        
+        Configuration userRendererConfig = null;
+    
+        Configuration[] cfgs
+            = cfg.getChild("renderers").getChildren("renderer");
+        for (int i = 0; i < cfgs.length; ++i) {
+            Configuration child = cfgs[i];
+            try {
+                if (child.getAttribute("mime").equals(mimeType)) {
+                    userRendererConfig = child;
+                    break;
+                }
+            } catch (ConfigurationException e) {
+                // silently pass over configurations without mime type
+            }
+        }
+        BaseConfig.log.debug((userRendererConfig == null ? "No u" : "U")
+                  + "ser configuration found for MIME type " + mimeType);
+        return userRendererConfig;
+    }
+}

Property changes on: src\java\org\apache\fop\config\RendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/RendererContextInfoConfig.java
===================================================================
--- src/java/org/apache/fop/config/RendererContextInfoConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/RendererContextInfoConfig.java	(revision 0)
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.render.RendererContext;
+import org.apache.fop.render.RendererContextConstants;
+import org.apache.fop.render.RendererContextInfo;
+
+public class RendererContextInfoConfig extends BaseConfig {
+
+    /**
+     * Returns the configuration subtree for a specific renderer.
+     * @param cfg the renderer configuration
+     * @param namespace the namespace (i.e. the XMLHandler) for which the configuration should
+     *                  be returned
+     * @return the requested configuration subtree, null if there's no configuration
+     */
+    private static Configuration getHandlerConfig(Configuration cfg, String namespace) {
+        if (cfg == null || namespace == null) {
+            return null;
+        }
+        Configuration handlerConfig = null;
+
+        Configuration[] children = cfg.getChildren("xml-handler");
+        for (int i = 0; i < children.length; ++i) {
+            try {
+                if (children[i].getAttribute("namespace").equals(namespace)) {
+                    handlerConfig = children[i];
+                    break;
+                }
+            } catch (ConfigurationException e) {
+                // silently pass over configurations without namespace
+            }
+        }
+        if (log.isDebugEnabled()) {
+            log.debug((handlerConfig == null ? "No" : "")
+                    + "XML handler configuration found for namespace " + namespace);
+        }
+        return handlerConfig;
+    }
+
+    /**
+     * Configures renderer context 
+     * @param obj
+     * @throws FOPConfigException
+     */
+    public static void configure(Object obj) throws FOPException {
+        RendererContextInfo info = (RendererContextInfo)obj;
+        
+        //Optional XML handler configuration
+        Configuration cfg = RendererConfig.getRendererConfig(info.getRenderer());
+        if (cfg != null) {
+            cfg = getHandlerConfig(cfg, info.getNamespace());
+            if (cfg != null) {
+                RendererContext ctx = info.getRendererContext();
+                ctx.setProperty(RendererContextConstants.HANDLER_CONFIGURATION, cfg);
+            }
+        }
+    }
+}

Property changes on: src\java\org\apache\fop\config\RendererContextInfoConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/TIFFRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/TIFFRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/TIFFRendererConfig.java	(revision 0)
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import java.awt.image.BufferedImage;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.render.bitmap.TIFFRenderer;
+
+public class TIFFRendererConfig extends RendererConfig {
+
+    /**
+     * Configure the TIFF renderer. Get the configuration to be used for
+     * compression
+     * @see BaseConfig#configure(Object)
+     */
+    public static void configure(Object object) throws FOPException {
+        TIFFRenderer renderer = (TIFFRenderer)object;
+        
+        Configuration cfg = RendererConfig.getRendererConfig(renderer);
+        if (cfg != null) {
+            //set compression
+            String name = cfg.getChild("compression").getValue(TIFFRenderer.COMPRESSION_PACKBITS);
+            //Some compression formats need a special image format:
+            if (name.equalsIgnoreCase(TIFFRenderer.COMPRESSION_CCITT_T6)) {
+                renderer.setBufferedImageType(BufferedImage.TYPE_BYTE_BINARY);
+            } else if (name.equalsIgnoreCase(TIFFRenderer.COMPRESSION_CCITT_T4)) {
+                renderer.setBufferedImageType(BufferedImage.TYPE_BYTE_BINARY);
+            } else {
+                renderer.setBufferedImageType(BufferedImage.TYPE_INT_ARGB);
+            }
+            if (!"NONE".equalsIgnoreCase(name)) {
+                renderer.getWriterParams().setCompressionMethod(name);
+            }
+            if (log.isInfoEnabled()) {
+                log.info("TIFF compression set to " + name);
+            }
+        }
+    }
+}

Property changes on: src\java\org\apache\fop\config\TIFFRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/TXTRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/TXTRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/TXTRendererConfig.java	(revision 0)
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.render.txt.TXTRenderer;
+
+public class TXTRendererConfig extends RendererConfig {
+
+    /**
+     * Configure the PS renderer.
+     * @see BaseConfig#configure(Object)
+     */
+    public static void configure(Object object) throws FOPException {
+        TXTRenderer renderer = (TXTRenderer)object;
+
+        Configuration cfg = RendererConfig.getRendererConfig(renderer);
+        if (cfg != null) {
+            renderer.setEncoding(cfg.getChild("encoding", true).getValue(null));
+        }
+    }
+}

Property changes on: src\java\org\apache\fop\config\TXTRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/XMLRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/XMLRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/XMLRendererConfig.java	(revision 0)
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+/**
+ * 
+ * Just uses basic renderer config
+ * @author Adrian Cumiskey
+ *
+ */
+public class XMLRendererConfig extends RendererConfig {
+
+}

Property changes on: src\java\org\apache\fop\config\XMLRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/config/AFPRendererConfig.java
===================================================================
--- src/java/org/apache/fop/config/AFPRendererConfig.java	(revision 0)
+++ src/java/org/apache/fop/config/AFPRendererConfig.java	(revision 0)
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import java.util.List;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.fonts.FontUtil;
+import org.apache.fop.fonts.Typeface;
+import org.apache.fop.render.afp.AFPRenderer;
+import org.apache.fop.render.afp.fonts.AFPFontInfo;
+import org.apache.fop.render.afp.fonts.CharacterSet;
+import org.apache.fop.render.afp.fonts.FopCharacterSet;
+import org.apache.fop.render.afp.fonts.OutlineFont;
+import org.apache.fop.render.afp.fonts.RasterFont;
+import org.apache.fop.util.LogUtil;
+
+public class AFPRendererConfig extends RendererConfig {
+    /**
+     */
+    private static AFPFontInfo buildFont(Configuration fontCfg, String _path)
+        throws ConfigurationException {
+
+        Configuration[] triple = fontCfg.getChildren("font-triplet");
+        List tripleList = new java.util.ArrayList();
+        if (triple.length == 0) {
+            log.error("Mandatory font configuration element '<font-triplet...' is missing");
+            return null;
+        }
+        for (int j = 0; j < triple.length; j++) {
+            int weight = FontUtil.parseCSS2FontWeight(triple[j].getAttribute("weight"));
+            tripleList.add(new FontTriplet(triple[j].getAttribute("name"),
+                                           triple[j].getAttribute("style"),
+                                           weight));
+        }
+
+        //build the fonts
+        Configuration afpFontCfg = fontCfg.getChild("afp-font");
+        if (afpFontCfg == null) {
+            log.error("Mandatory font configuration element '<afp-font...' is missing");
+            return null;
+        }
+        String path = afpFontCfg.getAttribute("path", _path);
+        String type = afpFontCfg.getAttribute("type");
+        if (type == null) {
+            log.error("Mandatory afp-font configuration attribute 'type=' is missing");
+            return null;
+        }
+        String codepage = afpFontCfg.getAttribute("codepage");
+        if (codepage == null) {
+            log.error("Mandatory afp-font configuration attribute 'code=' is missing");
+            return null;
+        }
+        String encoding = afpFontCfg.getAttribute("encoding");
+        if (encoding == null) {
+            log.error("Mandatory afp-font configuration attribute 'encoding=' is missing");
+            return null;
+        }
+
+        if ("raster".equalsIgnoreCase(type)) {
+
+            String name = afpFontCfg.getAttribute("name", "Unknown");
+
+            // Create a new font object
+            RasterFont font = new RasterFont(name);
+
+            Configuration[] rasters = afpFontCfg.getChildren("afp-raster-font");
+            if (rasters.length == 0) {
+                log.error(
+                        "Mandatory font configuration elements '<afp-raster-font...' are missing");
+                return null;
+            }
+            for (int j = 0; j < rasters.length; j++) {
+                Configuration rasterCfg = rasters[j];
+
+                String characterset = rasterCfg.getAttribute("characterset");
+                if (characterset == null) {
+                    log.error(
+                    "Mandatory afp-raster-font configuration attribute 'characterset=' is missing");
+                    return null;
+                }
+                int size = rasterCfg.getAttributeAsInteger("size");
+                String base14 = rasterCfg.getAttribute("base14-font", null);
+
+                if (base14 != null) {
+                    try {
+                        Class clazz = Class.forName("org.apache.fop.fonts.base14."
+                            + base14);
+                        try {
+                            Typeface tf = (Typeface)clazz.newInstance();
+                            font.addCharacterSet(size, new FopCharacterSet(
+                                codepage, encoding, characterset, size, tf));
+                        } catch (Exception ie) {
+                            String msg = "The base 14 font class " + clazz.getName()
+                                + " could not be instantiated";
+                            log.error(msg);
+                        }
+                    } catch (ClassNotFoundException cnfe) {
+                        String msg = "The base 14 font class for " + characterset
+                            + " could not be found";
+                        log.error(msg);
+                    }
+                } else {
+                    font.addCharacterSet(size, new CharacterSet(
+                        codepage, encoding, characterset, path));
+                }
+            }
+            return new AFPFontInfo(font, tripleList);
+
+        } else if ("outline".equalsIgnoreCase(type)) {
+
+            String characterset = afpFontCfg.getAttribute("characterset");
+            if (characterset == null) {
+                log.error("Mandatory afp-font configuration attribute 'characterset=' is missing");
+                return null;
+            }
+            String name = afpFontCfg.getAttribute("name", characterset);
+
+            CharacterSet characterSet = null;
+
+            String base14 = afpFontCfg.getAttribute("base14-font", null);
+
+            if (base14 != null) {
+                try {
+                    Class clazz = Class.forName("org.apache.fop.fonts.base14."
+                        + base14);
+                    try {
+                        Typeface tf = (Typeface)clazz.newInstance();
+                        characterSet = new FopCharacterSet(
+                                codepage, encoding, characterset, 1, tf);
+                    } catch (Exception ie) {
+                        String msg = "The base 14 font class " + clazz.getName()
+                            + " could not be instantiated";
+                        log.error(msg);
+                    }
+                } catch (ClassNotFoundException cnfe) {
+                    String msg = "The base 14 font class for " + characterset
+                        + " could not be found";
+                    log.error(msg);
+                }
+            } else {
+                characterSet = new CharacterSet(codepage, encoding, characterset, path);
+            }
+            // Create a new font object
+            OutlineFont font = new OutlineFont(name, characterSet);
+            return new AFPFontInfo(font, tripleList);
+        } else {
+            log.error("No or incorrect type attribute");
+        }
+        return null;
+    }
+
+    
+    /**
+     * Builds a list of AFPFontInfo objects for use with the setup() method.
+     * @param cfg Configuration object
+     * @return List the newly created list of fonts
+     * @throws ConfigurationException if something's wrong with the config data
+     */
+    private static List buildFontListFromConfiguration(Configuration cfg)
+            throws ConfigurationException {
+        List fontList = new java.util.ArrayList();
+        Configuration[] font = cfg.getChild("fonts").getChildren("font");
+        for (int i = 0; i < font.length; i++) {
+            AFPFontInfo afi = buildFont(font[i], null);
+            if (afi != null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Adding font " + afi.getAFPFont().getFontName());
+                    for (int j = 0; j < afi.getFontTriplets().size(); ++j) {
+                        FontTriplet triplet = (FontTriplet) afi.getFontTriplets().get(j);
+                        log.debug("Font triplet "
+                                  + triplet.getName() + ", "
+                                  + triplet.getStyle() + ", "
+                                  + triplet.getWeight());
+                    }
+                }
+
+                fontList.add(afi);
+            }
+        }
+        return fontList;
+    }
+
+    /**
+     * Configure the AFP renderer.
+     * @see BaseConfig#configure(Object)
+     */
+    public static void configure(Object object) throws FOPException {
+        AFPRenderer renderer = (AFPRenderer)object;
+
+        Configuration cfg = RendererConfig.getRendererConfig(renderer);
+        if (cfg != null) {        
+            try {
+                List fontList = AFPRendererConfig.buildFontListFromConfiguration(cfg);
+                renderer.setFontList(fontList);
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, factory.validateUserConfigStrictly());
+            }
+            
+            Configuration images = cfg.getChild("images");
+            if (!"color".equalsIgnoreCase(images.getAttribute("mode", "b+w"))) {
+                renderer.setBitsPerPixel(images.getAttributeAsInteger("bits-per-pixel", 8));
+            } else {
+                renderer.setColorImages(true);
+            }
+        }
+    }
+}

Property changes on: src\java\org\apache\fop\config\AFPRendererConfig.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/render/RendererContextInfo.java
===================================================================
--- src/java/org/apache/fop/render/RendererContextInfo.java	(revision 0)
+++ src/java/org/apache/fop/render/RendererContextInfo.java	(revision 0)
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.render;
+
+import org.w3c.dom.Document;
+
+/**
+ * 
+ * Renderer information for the purposes of configuration
+ * @author Adrian Cumiskey
+ *
+ */
+public class RendererContextInfo {
+
+    private RendererContext rendererContext;
+    private Document document;
+    private String namespace;
+    private AbstractRenderer renderer;
+
+    /**
+     * Default constructor
+     * @param renderer 
+     * 
+     * @param ctx renderer context
+     * @param doc document
+     * @param namespace namespace
+     */
+    public RendererContextInfo(AbstractRenderer renderer, RendererContext ctx, Document doc, String namespace) {
+        this.renderer = renderer;
+        this.rendererContext = ctx;
+        this.document = doc;
+        this.namespace = namespace;
+    }
+
+    public AbstractRenderer getRenderer() {
+        return renderer;
+    }
+
+    /**
+     * returns the renderer context
+     * @return renderer context
+     */
+    public RendererContext getRendererContext() {
+        return rendererContext;
+    }
+
+    /**
+     * returns the document
+     * @return document
+     */
+    public Document getDocument() {
+        return document;
+    }
+
+    /**
+     * returns the namespace
+     * @return namespace
+     */
+    public String getNamespace() {
+        return namespace;
+    }
+}

Property changes on: src\java\org\apache\fop\render\RendererContextInfo.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/render/txt/TXTRenderer.java
===================================================================
--- src/java/org/apache/fop/render/txt/TXTRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/txt/TXTRenderer.java	(working copy)
@@ -115,12 +115,6 @@
     public String getMimeType() {
         return "text/plain";
     }
-
-    /** @see org.apache.fop.render.AbstractRenderer */
-    public void configure(Configuration conf) throws ConfigurationException {
-        super.configure(conf);
-        this.encoding = conf.getChild("encoding", true).getValue(null);
-    }
     
     /**
      * Sets the encoding of the target file.
Index: src/java/org/apache/fop/render/ps/PSRenderer.java
===================================================================
--- src/java/org/apache/fop/render/ps/PSRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/ps/PSRenderer.java	(working copy)
@@ -146,24 +146,6 @@
     private Map formResources;
     
     /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        super.configure(cfg);
-        this.autoRotateLandscape = cfg.getChild(AUTO_ROTATE_LANDSCAPE).getValueAsBoolean(false);
-        this.languageLevel = cfg.getChild(LANGUAGE_LEVEL).getValueAsInteger(this.languageLevel);
-        this.twoPassGeneration = cfg.getChild(OPTIMIZE_RESOURCES).getValueAsBoolean(false);
-
-        //Font configuration
-        List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg, this);
-        if (this.fontList == null) {
-            this.fontList = cfgFonts;
-        } else {
-            this.fontList.addAll(cfgFonts);
-        }
-    }
-
-    /**
      * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
      */
     public void setUserAgent(FOUserAgent agent) {
Index: src/java/org/apache/fop/render/ps/PSTextPainter.java
===================================================================
--- src/java/org/apache/fop/render/ps/PSTextPainter.java	(revision 517602)
+++ src/java/org/apache/fop/render/ps/PSTextPainter.java	(working copy)
@@ -367,8 +367,8 @@
     private int getWeight(AttributedCharacterIterator aci) {
         Float taWeight = (Float)aci.getAttribute(TextAttribute.WEIGHT);
         return ((taWeight != null) &&  (taWeight.floatValue() > 1.0)) 
-                       ? Font.BOLD
-                       : Font.NORMAL;
+                       ? Font.WEIGHT_BOLD
+                       : Font.WEIGHT_NORMAL;
     }
 
     private Font makeFont(AttributedCharacterIterator aci) {
@@ -402,7 +402,7 @@
                 }
             }
         }
-        FontTriplet triplet = fontInfo.fontLookup("any", style, Font.NORMAL);
+        FontTriplet triplet = fontInfo.fontLookup("any", style, Font.WEIGHT_NORMAL);
         int fsize = (int)(fontSize.floatValue() * 1000);
         return fontInfo.getFontInstance(triplet, fsize);
     }
@@ -411,7 +411,7 @@
         final String style = getStyle(aci);
         final int weight = getWeight(aci);
         int fStyle = java.awt.Font.PLAIN;
-        if (weight == Font.BOLD) {
+        if (weight == Font.WEIGHT_BOLD) {
             fStyle |= java.awt.Font.BOLD;
         }
         if ("italic".equals(style)) {
Index: src/java/org/apache/fop/render/ps/NativeTextHandler.java
===================================================================
--- src/java/org/apache/fop/render/ps/NativeTextHandler.java	(revision 517602)
+++ src/java/org/apache/fop/render/ps/NativeTextHandler.java	(working copy)
@@ -159,7 +159,7 @@
         }
         int fontSize = 1000 * f.getSize();
         String style = f.isItalic() ? "italic" : "normal";
-        int weight = f.isBold() ? Font.BOLD : Font.NORMAL;
+        int weight = f.isBold() ? Font.WEIGHT_BOLD : Font.WEIGHT_NORMAL;
                 
         FontTriplet triplet = fontInfo.findAdjustWeight(fontFamily, style, weight);
         if (triplet == null) {
Index: src/java/org/apache/fop/render/awt/AWTRenderer.java
===================================================================
--- src/java/org/apache/fop/render/awt/AWTRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/awt/AWTRenderer.java	(working copy)
@@ -41,6 +41,7 @@
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.PageViewport;
+import org.apache.fop.config.FopConfig;
 import org.apache.fop.render.awt.viewer.PreviewDialog;
 import org.apache.fop.render.awt.viewer.StatusListener;
 import org.apache.fop.render.awt.viewer.Renderable;
@@ -149,10 +150,10 @@
         pageWidth = (int) Math.round(bounds.getWidth() / 1000f);
         pageHeight = (int) Math.round(bounds.getHeight() / 1000f);
         double scaleX = scaleFactor 
-                * (25.4 / FOUserAgent.DEFAULT_TARGET_RESOLUTION)
+                * (25.4 / FopConfig.DEFAULT_TARGET_RESOLUTION)
                 / userAgent.getTargetPixelUnitToMillimeter();
         double scaleY = scaleFactor 
-                * (25.4 / FOUserAgent.DEFAULT_TARGET_RESOLUTION)
+                * (25.4 / FopConfig.DEFAULT_TARGET_RESOLUTION)
                 / userAgent.getTargetPixelUnitToMillimeter();
         int bitmapWidth = (int) ((pageWidth * scaleX) + 0.5);
         int bitmapHeight = (int) ((pageHeight * scaleY) + 0.5);
Index: src/java/org/apache/fop/render/RendererContext.java
===================================================================
--- src/java/org/apache/fop/render/RendererContext.java	(revision 517602)
+++ src/java/org/apache/fop/render/RendererContext.java	(working copy)
@@ -23,7 +23,6 @@
 import java.util.Map;
 
 //FOP
-import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.fop.apps.FOUserAgent;
 
 /**
@@ -156,17 +155,10 @@
             return ((Integer)context.getProperty(RendererContextConstants.HEIGHT)).intValue();
         }
 
-        /** @return the handler configuration */
-        public Configuration getHandlerConfiguration() {
-            return (Configuration)context.getProperty(
-                    RendererContextConstants.HANDLER_CONFIGURATION);
-        }
-
         /** @return the foreign attributes */
         public Map getForeignAttributes() {
             return (Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
-        }
-        
+        }        
     }    
 }
 
Index: src/java/org/apache/fop/render/xml/XMLRenderer.java
===================================================================
--- src/java/org/apache/fop/render/xml/XMLRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/xml/XMLRenderer.java	(working copy)
@@ -41,8 +41,6 @@
 import org.xml.sax.ext.LexicalHandler;
 import org.xml.sax.helpers.AttributesImpl;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.fop.util.QName;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
@@ -81,7 +79,6 @@
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
 import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.fonts.FontSetup;
 import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.render.PrintRenderer;
 import org.apache.fop.render.Renderer;
@@ -138,22 +135,6 @@
     }
 
     /**
-     * Configure the XML renderer.
-     * Get the configuration to be used for fonts etc.
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        super.configure(cfg);
-        //Font configuration
-        List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg, this);
-        if (this.fontList == null) {
-            this.fontList = cfgFonts;
-        } else {
-            this.fontList.addAll(cfgFonts);
-        }
-    }
-
-    /**
      * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
      */
     public void setUserAgent(FOUserAgent agent) {
Index: src/java/org/apache/fop/render/PrintRenderer.java
===================================================================
--- src/java/org/apache/fop/render/PrintRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/PrintRenderer.java	(working copy)
@@ -46,8 +46,27 @@
 
     /** list of fonts */
     protected List fontList = null;
+   
+    /**
+     * adds a font list to current list of fonts
+     * @param fontInfoList font list
+     */
+    public void addFontList(List fontInfoList) {
+        if (this.fontList == null) {
+            setFontList(fontInfoList);
+        } else {
+            this.fontList.addAll(fontInfoList);
+        }
+    }
     
     /**
+     * @param fontList list of available fonts
+     */
+    public void setFontList(List fontList) {
+        this.fontList = fontList;
+    }
+
+    /**
      * Set up the font info
      *
      * @param inFontInfo  font info to set up
Index: src/java/org/apache/fop/render/afp/AFPRenderer.java
===================================================================
--- src/java/org/apache/fop/render/afp/AFPRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/afp/AFPRenderer.java	(working copy)
@@ -33,8 +33,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.MimeConstants;
@@ -57,8 +55,6 @@
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.fonts.FontTriplet;
-import org.apache.fop.fonts.FontUtil;
-import org.apache.fop.fonts.Typeface;
 import org.apache.fop.fonts.base14.Courier;
 import org.apache.fop.fonts.base14.Helvetica;
 import org.apache.fop.fonts.base14.TimesRoman;
@@ -76,7 +72,6 @@
 import org.apache.fop.render.afp.fonts.CharacterSet;
 import org.apache.fop.render.afp.fonts.FopCharacterSet;
 import org.apache.fop.render.afp.fonts.OutlineFont;
-import org.apache.fop.render.afp.fonts.RasterFont;
 import org.apache.fop.render.afp.modca.AFPConstants;
 import org.apache.fop.render.afp.modca.AFPDataStream;
 import org.apache.fop.render.afp.modca.ImageObject;
@@ -303,195 +298,6 @@
     }
 
     /**
-     */
-    private AFPFontInfo buildFont(Configuration fontCfg, String _path)
-        throws ConfigurationException {
-
-        Configuration[] triple = fontCfg.getChildren("font-triplet");
-        List tripleList = new java.util.ArrayList();
-        if (triple.length == 0) {
-            log.error("Mandatory font configuration element '<font-triplet...' is missing");
-            return null;
-        }
-        for (int j = 0; j < triple.length; j++) {
-            int weight = FontUtil.parseCSS2FontWeight(triple[j].getAttribute("weight"));
-            tripleList.add(new FontTriplet(triple[j].getAttribute("name"),
-                                           triple[j].getAttribute("style"),
-                                           weight));
-        }
-
-        //build the fonts
-        Configuration afpFontCfg = fontCfg.getChild("afp-font");
-        if (afpFontCfg == null) {
-            log.error("Mandatory font configuration element '<afp-font...' is missing");
-            return null;
-        }
-        String path = afpFontCfg.getAttribute("path", _path);
-        String type = afpFontCfg.getAttribute("type");
-        if (type == null) {
-            log.error("Mandatory afp-font configuration attribute 'type=' is missing");
-            return null;
-        }
-        String codepage = afpFontCfg.getAttribute("codepage");
-        if (codepage == null) {
-            log.error("Mandatory afp-font configuration attribute 'code=' is missing");
-            return null;
-        }
-        String encoding = afpFontCfg.getAttribute("encoding");
-        if (encoding == null) {
-            log.error("Mandatory afp-font configuration attribute 'encoding=' is missing");
-            return null;
-        }
-
-        if ("raster".equalsIgnoreCase(type)) {
-
-            String name = afpFontCfg.getAttribute("name", "Unknown");
-
-            // Create a new font object
-            RasterFont font = new RasterFont(name);
-
-            Configuration[] rasters = afpFontCfg.getChildren("afp-raster-font");
-            if (rasters.length == 0) {
-                log.error("Mandatory font configuration elements '<afp-raster-font...' are missing");
-                return null;
-            }
-            for (int j = 0; j < rasters.length; j++) {
-                Configuration rasterCfg = rasters[j];
-
-                String characterset = rasterCfg.getAttribute("characterset");
-                if (characterset == null) {
-                    log.error("Mandatory afp-raster-font configuration attribute 'characterset=' is missing");
-                    return null;
-                }
-                int size = rasterCfg.getAttributeAsInteger("size");
-                String base14 = rasterCfg.getAttribute("base14-font", null);
-
-                if (base14 != null) {
-                    try {
-                        Class clazz = Class.forName("org.apache.fop.fonts.base14."
-                            + base14);
-                        try {
-                            Typeface tf = (Typeface)clazz.newInstance();
-                            font.addCharacterSet(size, new FopCharacterSet(
-                                codepage, encoding, characterset, size, tf));
-                        } catch (Exception ie) {
-                            String msg = "The base 14 font class " + clazz.getName()
-                                + " could not be instantiated";
-                            log.error(msg);
-                        }
-                    } catch (ClassNotFoundException cnfe) {
-                        String msg = "The base 14 font class for " + characterset
-                            + " could not be found";
-                        log.error(msg);
-                    }
-                } else {
-                    font.addCharacterSet(size, new CharacterSet(
-                        codepage, encoding, characterset, path));
-                }
-            }
-            return new AFPFontInfo(font, tripleList);
-
-        } else if ("outline".equalsIgnoreCase(type)) {
-
-            String characterset = afpFontCfg.getAttribute("characterset");
-            if (characterset == null) {
-                log.error("Mandatory afp-font configuration attribute 'characterset=' is missing");
-                return null;
-            }
-            String name = afpFontCfg.getAttribute("name", characterset);
-
-            CharacterSet characterSet = null;
-
-            String base14 = afpFontCfg.getAttribute("base14-font", null);
-
-            if (base14 != null) {
-                try {
-                    Class clazz = Class.forName("org.apache.fop.fonts.base14."
-                        + base14);
-                    try {
-                        Typeface tf = (Typeface)clazz.newInstance();
-                        characterSet = new FopCharacterSet(
-                                codepage, encoding, characterset, 1, tf);
-                    } catch (Exception ie) {
-                        String msg = "The base 14 font class " + clazz.getName()
-                            + " could not be instantiated";
-                        log.error(msg);
-                    }
-                } catch (ClassNotFoundException cnfe) {
-                    String msg = "The base 14 font class for " + characterset
-                        + " could not be found";
-                    log.error(msg);
-                }
-            } else {
-                characterSet = new CharacterSet(codepage, encoding, characterset, path);
-            }
-            // Create a new font object
-            OutlineFont font = new OutlineFont(name, characterSet);
-            return new AFPFontInfo(font, tripleList);
-        } else {
-            log.error("No or incorrect type attribute");
-        }
-        return null;
-    }
-
-    /**
-     * Builds a list of AFPFontInfo objects for use with the setup() method.
-     * @param cfg Configuration object
-     * @return List the newly created list of fonts
-     * @throws ConfigurationException if something's wrong with the config data
-     */
-    public List buildFontListFromConfiguration(Configuration cfg)
-            throws ConfigurationException {
-        List fontList = new java.util.ArrayList();
-        Configuration[] font = cfg.getChild("fonts").getChildren("font");
-        for (int i = 0; i < font.length; i++) {
-            AFPFontInfo afi = buildFont(font[i], null);
-            if (afi != null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Adding font " + afi.getAFPFont().getFontName());
-                    for (int j = 0; j < afi.getFontTriplets().size(); ++j) {
-                        FontTriplet triplet = (FontTriplet) afi.getFontTriplets().get(j);
-                        log.debug("Font triplet "
-                                  + triplet.getName() + ", "
-                                  + triplet.getStyle() + ", "
-                                  + triplet.getWeight());
-                    }
-                }
-
-                fontList.add(afi);
-            }
-        }
-        return fontList;
-    }
-
-    /**
-     * Configure the AFP renderer.
-     * Get the configuration to be used for fonts etc.
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        //Font configuration
-        this.fontList = buildFontListFromConfiguration(cfg);
-        Configuration images = cfg.getChild("images");
-        if (!"color".equalsIgnoreCase(images.getAttribute("mode", "b+w"))) {
-            bitsPerPixel = images.getAttributeAsInteger("bits-per-pixel", 8);
-            switch (bitsPerPixel) {
-                case 1:
-                case 4:
-                case 8:
-                    break;
-                default:
-                    log.warn("Invalid bits_per_pixel value, must be 1, 4 or 8.");
-                    bitsPerPixel = 8;
-                    break;
-            }
-        } else {
-            colorImages = true;
-        }
-
-    }
-
-    /**
      * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
      */
     public void setUserAgent(FOUserAgent agent) {
@@ -1765,5 +1571,22 @@
         }
     }
 
+    public void setBitsPerPixel(int bitsPerPixel) {
+        this.bitsPerPixel = bitsPerPixel;
+        switch (bitsPerPixel) {
+            case 1:
+            case 4:
+            case 8:
+            break;
+        default:
+            log.warn("Invalid bits_per_pixel value, must be 1, 4 or 8.");
+            bitsPerPixel = 8;
+            break;
+        }
+    }
+
+    public void setColorImages(boolean colorImages) {
+        this.colorImages = colorImages;
+    }
 }
 
Index: src/java/org/apache/fop/render/java2d/FontSetup.java
===================================================================
--- src/java/org/apache/fop/render/java2d/FontSetup.java	(revision 517602)
+++ src/java/org/apache/fop/render/java2d/FontSetup.java	(working copy)
@@ -139,52 +139,52 @@
         // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic());
 
         /* any is treated as serif */
-        fontInfo.addFontProperties("F5", "any", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "any", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "any", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F8", "any", "oblique", Font.BOLD);
+        fontInfo.addFontProperties("F5", "any", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "any", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "any", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "any", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "any", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "any", "oblique", Font.WEIGHT_BOLD);
 
-        fontInfo.addFontProperties("F1", "sans-serif", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F3", "sans-serif", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F5", "serif", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "serif", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F9", "monospace", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F11", "monospace", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "italic", Font.BOLD);
+        fontInfo.addFontProperties("F1", "sans-serif", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F3", "sans-serif", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F5", "serif", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "serif", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "serif", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "serif", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F9", "monospace", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F11", "monospace", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "italic", Font.WEIGHT_BOLD);
 
-        fontInfo.addFontProperties("F1", "Helvetica", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F3", "Helvetica", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F5", "Times", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "Times", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F9", "Courier", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F11", "Courier", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F13", "Symbol", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Font.NORMAL);
+        fontInfo.addFontProperties("F1", "Helvetica", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F3", "Helvetica", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F5", "Times", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "Times", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F9", "Courier", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F11", "Courier", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F13", "Symbol", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Font.WEIGHT_NORMAL);
 
         // Custom type 1 fonts step 2/2
         // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL);
@@ -192,20 +192,20 @@
         // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", FontInfo.BOLD);
 
         /* for compatibility with PassiveTex */
-        fontInfo.addFontProperties("F5", "Times-Roman", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "Times-Roman", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F5", "Times Roman", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "Times Roman", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "italic", Font.BOLD);
+        fontInfo.addFontProperties("F5", "Times-Roman", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "Times-Roman", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F5", "Times Roman", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "Times Roman", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "italic", Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
-                                   "normal", Font.NORMAL);
+                                   "normal", Font.WEIGHT_NORMAL);
         
         configureInstalledAWTFonts(fontInfo, graphics, LAST_PREDEFINED_FONT_NUMBER + 1);
     }
@@ -252,9 +252,9 @@
         FontMetricsMapper metric = new FontMetricsMapper(family, fontStyle, graphics);
         fontInfo.addMetrics(fontKey, metric);
         
-        int weight = Font.NORMAL;
+        int weight = Font.WEIGHT_NORMAL;
         if ((fontStyle & java.awt.Font.BOLD) != 0) {
-            weight = Font.BOLD;
+            weight = Font.WEIGHT_BOLD;
         }
         String style = "normal";
         if ((fontStyle & java.awt.Font.ITALIC) != 0) {
Index: src/java/org/apache/fop/render/java2d/Java2DRenderer.java
===================================================================
--- src/java/org/apache/fop/render/java2d/Java2DRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/java2d/Java2DRenderer.java	(working copy)
@@ -53,8 +53,6 @@
 
 import org.w3c.dom.Document;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.CTM;
@@ -66,6 +64,7 @@
 import org.apache.fop.area.inline.SpaceArea;
 import org.apache.fop.area.inline.TextArea;
 import org.apache.fop.area.inline.WordArea;
+import org.apache.fop.config.FopConfig;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
@@ -73,7 +72,6 @@
 import org.apache.fop.image.FopImage;
 import org.apache.fop.image.ImageFactory;
 import org.apache.fop.image.XMLImage;
-import org.apache.fop.pdf.PDFAMode;
 import org.apache.fop.render.AbstractPathOrientedRenderer;
 import org.apache.fop.render.Graphics2DAdapter;
 import org.apache.fop.render.RendererContext;
@@ -151,19 +149,6 @@
     }
 
     /**
-     * @see org.apache.fop.render.AbstractRenderer#configure(
-     *          org.apache.avalon.framework.configuration.Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        super.configure(cfg);
-
-        String s = cfg.getChild(JAVA2D_TRANSPARENT_PAGE_BACKGROUND, true).getValue(null);
-        if (s != null) {
-            this.transparentPageBackground = "true".equalsIgnoreCase(s);
-        }
-    }
-
-    /**
      * @see org.apache.fop.render.Renderer#setUserAgent(org.apache.fop.apps.FOUserAgent)
      */
     public void setUserAgent(FOUserAgent foUserAgent) {
@@ -305,10 +290,10 @@
                             + pageHeight + ")");
 
             double scaleX = scaleFactor 
-                * (25.4 / FOUserAgent.DEFAULT_TARGET_RESOLUTION) 
+                * (25.4 / FopConfig.DEFAULT_TARGET_RESOLUTION) 
                 / userAgent.getTargetPixelUnitToMillimeter();
             double scaleY = scaleFactor
-                * (25.4 / FOUserAgent.DEFAULT_TARGET_RESOLUTION)
+                * (25.4 / FopConfig.DEFAULT_TARGET_RESOLUTION)
                 / userAgent.getTargetPixelUnitToMillimeter();
             int bitmapWidth = (int) ((pageWidth * scaleX) + 0.5);
             int bitmapHeight = (int) ((pageHeight * scaleY) + 0.5);
@@ -1023,4 +1008,8 @@
         //not necessary in Java2D
     }
 
+    public void setTransparentPageBackground(boolean transparentPageBackground) {
+        this.transparentPageBackground = transparentPageBackground;
+    }
+
 }
Index: src/java/org/apache/fop/render/pdf/PDFRenderer.java
===================================================================
--- src/java/org/apache/fop/render/pdf/PDFRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/pdf/PDFRenderer.java	(working copy)
@@ -40,8 +40,6 @@
 import org.w3c.dom.Document;
 
 // Avalon
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.commons.io.IOUtils;
 
 // FOP
@@ -65,7 +63,6 @@
 import org.apache.fop.area.inline.SpaceArea;
 import org.apache.fop.fonts.Typeface;
 import org.apache.fop.fonts.Font;
-import org.apache.fop.fonts.FontSetup;
 import org.apache.fop.image.FopImage;
 import org.apache.fop.image.ImageFactory;
 import org.apache.fop.image.XMLImage;
@@ -232,38 +229,6 @@
     public PDFRenderer() {
     }
 
-    /**
-     * Configure the PDF renderer.
-     * Get the configuration to be used for pdf stream filters,
-     * fonts etc.
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        //PDF filters
-        this.filterMap = PDFFilterList.buildFilterMapFromConfiguration(cfg);
-
-        //Font configuration
-        List cfgFonts = FontSetup.buildFontListFromConfiguration(cfg, this);
-        if (this.fontList == null) {
-            this.fontList = cfgFonts;
-        } else {
-            this.fontList.addAll(cfgFonts);
-        }
-        
-        String s = cfg.getChild(PDF_A_MODE, true).getValue(null);
-        if (s != null) {
-            this.pdfAMode = PDFAMode.valueOf(s);
-        }
-        s = cfg.getChild(PDF_X_MODE, true).getValue(null);
-        if (s != null) {
-            this.pdfXMode = PDFXMode.valueOf(s);
-        }
-        s = cfg.getChild(KEY_OUTPUT_PROFILE, true).getValue(null);
-        if (s != null) {
-            this.outputProfileURI = s;
-        }
-    }
-
     private boolean booleanValueOf(Object obj) {
         if (obj instanceof Boolean) {
             return ((Boolean)obj).booleanValue();
@@ -479,6 +444,7 @@
      * @see org.apache.fop.render.Renderer#stopRenderer()
      */
     public void stopRenderer() throws IOException {
+//        renderExtensions(extensions);
         pdfDoc.getResources().addFonts(pdfDoc, fontInfo);
         pdfDoc.outputTrailer(ostream);
 
@@ -1594,5 +1560,21 @@
     public String getMimeType() {
         return MIME_TYPE;
     }
+    
+    public void setAMode(PDFAMode mode) {
+        this.pdfAMode = mode;
+    }
+
+    public void setXMode(PDFXMode mode) {
+        this.pdfXMode = mode;        
+    }
+
+    public void setOutputProfileURI(String outputProfileURI) {
+        this.outputProfileURI = outputProfileURI;
+    }
+
+    public void setFilterMap(Map filterMap) {
+        this.filterMap = filterMap;
+    }
 }
 
Index: src/java/org/apache/fop/render/AbstractRenderer.java
===================================================================
--- src/java/org/apache/fop/render/AbstractRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/AbstractRenderer.java	(working copy)
@@ -64,23 +64,19 @@
 import org.apache.fop.area.inline.WordArea;
 import org.apache.fop.area.inline.SpaceArea;
 import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.config.FopConfig;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-// Avalon
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
 /**
  * Abstract base class for all renderers. The Abstract renderer does all the
  * top level processing of the area tree and adds some abstract methods to
  * handle viewports. This keeps track of the current block and inline position.
  */
 public abstract class AbstractRenderer 
-         implements Renderer, Configurable, Constants {
+         implements Renderer, Constants {
 
     /** logging instance */
     protected static Log log = LogFactory.getLog("org.apache.fop.render");
@@ -118,12 +114,6 @@
     private Set warnedXMLHandlers;
     
     /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration conf) throws ConfigurationException {
-    }
-
-    /**
      *  @see org.apache.fop.render.Renderer#setupFontInfo(FontInfo)
      */
     public abstract void setupFontInfo(FontInfo fontInfo);
@@ -805,39 +795,6 @@
     }
 
     /**
-     * Returns the configuration subtree for a specific renderer.
-     * @param cfg the renderer configuration
-     * @param namespace the namespace (i.e. the XMLHandler) for which the configuration should
-     *                  be returned
-     * @return the requested configuration subtree, null if there's no configuration
-     */
-    public static Configuration getHandlerConfig(Configuration cfg, String namespace) {
-
-        if (cfg == null || namespace == null) {
-            return null;
-        }
-
-        Configuration handlerConfig = null;
-
-        Configuration[] children = cfg.getChildren("xml-handler");
-        for (int i = 0; i < children.length; ++i) {
-            try {
-                if (children[i].getAttribute("namespace").equals(namespace)) {
-                    handlerConfig = children[i];
-                    break;
-                }
-            } catch (ConfigurationException e) {
-                // silently pass over configurations without namespace
-            }
-        }
-        if (log.isDebugEnabled()) {
-            log.debug((handlerConfig == null ? "No" : "")
-                    + "XML handler configuration found for namespace " + namespace);
-        }
-        return handlerConfig;
-    }
-
-    /**
      * Render the xml document with the given xml namespace.
      * The Render Context is by the handle to render into the current
      * rendering target.
@@ -851,15 +808,7 @@
                 this, namespace);
         if (handler != null) {
             try {
-                //Optional XML handler configuration
-                Configuration cfg = userAgent.getFactory().getUserRendererConfig(getMimeType());
-                if (cfg != null) {
-                    cfg = getHandlerConfig(cfg, namespace);
-                    if (cfg != null) {
-                        ctx.setProperty(RendererContextConstants.HANDLER_CONFIGURATION, cfg);
-                    }
-                }
-                
+                FopConfig.configure(new RendererContextInfo(this, ctx, doc, namespace));
                 handler.handleXML(ctx, doc, namespace);
             } catch (Throwable t) {
                 // could not handle document
@@ -887,6 +836,5 @@
     public String getMimeType() {
         return null;
     }
-
 }
 
Index: src/java/org/apache/fop/render/bitmap/TIFFRenderer.java
===================================================================
--- src/java/org/apache/fop/render/bitmap/TIFFRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/bitmap/TIFFRenderer.java	(working copy)
@@ -77,12 +77,12 @@
 
     //private static final String COMPRESSION_NONE = "NONE";
     //private static final String COMPRESSION_JPEG = "JPEG";
-    private static final String COMPRESSION_PACKBITS = "PackBits";
+    public static final String COMPRESSION_PACKBITS = "PackBits";
     //private static final String COMPRESSION_DEFLATE = "Deflate";
     //private static final String COMPRESSION_LZW = "LZW";
     //private static final String COMPRESSION_ZLIB = "ZLib";
-    private static final String COMPRESSION_CCITT_T6 = "CCITT T.6"; //CCITT Group 4
-    private static final String COMPRESSION_CCITT_T4 = "CCITT T.4"; //CCITT Group 3
+    public static final String COMPRESSION_CCITT_T6 = "CCITT T.6"; //CCITT Group 4
+    public static final String COMPRESSION_CCITT_T4 = "CCITT T.4"; //CCITT Group 3
     
     /** ImageWriter parameters */
     private ImageWriterParams writerParams;
@@ -115,30 +115,6 @@
         writerParams.setResolution(dpi);
     }
 
-    /**
-     * Configure the TIFF renderer. Get the configuration to be used for
-     * compression
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        super.configure(cfg);
-
-        //set compression
-        String name = cfg.getChild("compression").getValue(COMPRESSION_PACKBITS);
-        //Some compression formats need a special image format:
-        if (name.equalsIgnoreCase(COMPRESSION_CCITT_T6)) {
-            bufferedImageType = BufferedImage.TYPE_BYTE_BINARY;
-        } else if (name.equalsIgnoreCase(COMPRESSION_CCITT_T4)) {
-            bufferedImageType = BufferedImage.TYPE_BYTE_BINARY;
-        } else {
-            bufferedImageType = BufferedImage.TYPE_INT_ARGB;
-        }
-        if (!"NONE".equalsIgnoreCase(name)) {
-            writerParams.setCompressionMethod(name);
-        }
-        log.info("TIFF compression set to " + name);
-    }
-
     /** @see org.apache.fop.render.Renderer#startRenderer(java.io.OutputStream) */
     public void startRenderer(OutputStream outputStream) throws IOException {
         this.outputStream = outputStream;
@@ -253,4 +229,12 @@
                     "Method 'remove' is not supported.");
         }
     }
+
+    public void setBufferedImageType(int bufferedImageType) {
+        this.bufferedImageType = bufferedImageType;
+    }
+
+    public ImageWriterParams getWriterParams() {
+        return writerParams;
+    }
 }
Index: src/java/org/apache/fop/render/pcl/PCLRenderer.java
===================================================================
--- src/java/org/apache/fop/render/pcl/PCLRenderer.java	(revision 517602)
+++ src/java/org/apache/fop/render/pcl/PCLRenderer.java	(working copy)
@@ -53,8 +53,6 @@
 import org.apache.xmlgraphics.java2d.GraphicContext;
 
 // FOP
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.fop.apps.FOPException;
@@ -143,31 +141,8 @@
     public PCLRenderer() {
     }
 
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        super.configure(cfg);
-        String rendering = cfg.getChild("rendering").getValue(null);
-        if ("quality".equalsIgnoreCase(rendering)) {
-            this.qualityBeforeSpeed = true;
-        } else if ("speed".equalsIgnoreCase(rendering)) {
-            this.qualityBeforeSpeed = false;
-        } else if (rendering != null) {
-            throw new ConfigurationException(
-                    "Valid values for 'rendering' are 'quality' and 'speed'. Value found: " 
-                        + rendering);
-        }
-        String textRendering = cfg.getChild("text-rendering").getValue(null);
-        if ("bitmap".equalsIgnoreCase(textRendering)) {
-            this.allTextAsBitmaps = true;
-        } else if ("auto".equalsIgnoreCase(textRendering)) {
-            this.allTextAsBitmaps = false;
-        } else if (textRendering != null) {
-            throw new ConfigurationException(
-                    "Valid values for 'text-rendering' are 'auto' and 'bitmap'. Value found: " 
-                        + textRendering);
-        }
+    public void setQualityBeforeSpeed(boolean qualityBeforeSpeed) {
+        this.qualityBeforeSpeed = qualityBeforeSpeed;
     }
 
     /**
@@ -1499,6 +1474,10 @@
             handleIOTrouble(ioe);
         }
     }
+
+    public void setAllTextAsBitmaps(boolean allTextAsBitmaps) {
+        this.allTextAsBitmaps = allTextAsBitmaps;
+    }
     
     
     
Index: src/java/org/apache/fop/render/RendererFactory.java
===================================================================
--- src/java/org/apache/fop/render/RendererFactory.java	(revision 517602)
+++ src/java/org/apache/fop/render/RendererFactory.java	(working copy)
@@ -25,9 +25,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -36,7 +33,9 @@
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.AreaTreeHandler;
+import org.apache.fop.config.FopConfig;
 import org.apache.fop.fo.FOEventHandler;
+import org.apache.fop.fonts.FontInfoCache;
 
 /**
  * Factory for FOEventHandlers and Renderers.
@@ -185,19 +184,7 @@
             }
             Renderer rend = maker.makeRenderer(userAgent);
             rend.setUserAgent(userAgent);
-            String mimeType = rend.getMimeType(); //Always use main MIME type for this
-            Configuration userRendererConfig = null;
-            if (mimeType != null) {
-                userRendererConfig
-                    = userAgent.getFactory().getUserRendererConfig(mimeType);
-            }
-            if (userRendererConfig != null) {
-                try {
-                    ContainerUtil.configure(rend, userRendererConfig);
-                } catch (ConfigurationException e) {
-                    throw new FOPException(e);
-                }
-            }
+            FopConfig.configure(rend);
             return rend;
         }
     }
Index: src/java/org/apache/fop/layoutmgr/PositionIterator.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/PositionIterator.java	(revision 517602)
+++ src/java/org/apache/fop/layoutmgr/PositionIterator.java	(working copy)
@@ -22,6 +22,9 @@
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+/**
+ * TODO add Javadoc
+ */
 public abstract class PositionIterator implements Iterator {
     
     private Iterator parentIter;
Index: src/java/org/apache/fop/fonts/CachedFontInfo.java
===================================================================
--- src/java/org/apache/fop/fonts/CachedFontInfo.java	(revision 0)
+++ src/java/org/apache/fop/fonts/CachedFontInfo.java	(revision 0)
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+public class CachedFontInfo extends EmbedFontInfo {
+
+    /** file modify date (if available) */
+    private long lastModified = -1;
+
+    /** time that font info was cached */
+    private long cached = -1;
+
+    /**
+     * returns a file given a list of urls
+     * @param embedUrl
+     * @param metricsUrl
+     * @return
+     */
+    public static File getFontFileFromUrls(String[] fontUrls) {
+        for (int i = 0; i < fontUrls.length; i++) {
+            String fontUrl = fontUrls[i]; 
+            if (fontUrl != null && fontUrl.startsWith("file:")) {                
+                try {
+                    URI fontUri = new URI(fontUrl);
+                    return new File(fontUri);
+                } catch (URISyntaxException e) {
+                    // this is not a valid file url so unable to ascertain modified date
+                }
+            }
+        } 
+        return null;
+    }
+
+    /**
+     * default constructor
+     * @param metricsFile
+     * @param kerning
+     * @param fontTriplets
+     * @param embedFile
+     * @param cached 
+     */
+    public CachedFontInfo(String metricsFile, boolean kerning, List fontTriplets, String embedFile, long lastModified, long cached) {
+        super(metricsFile, kerning, fontTriplets, embedFile);
+        this.lastModified = lastModified;
+        this.cached = cached;
+    }
+
+    public CachedFontInfo(EmbedFontInfo fontInfo) {
+        super(fontInfo.metricsFile, fontInfo.kerning, fontInfo.fontTriplets, fontInfo.embedFile);
+        // try and determine modified date
+        File fontFile = getFontFileFromUrls(new String[] {embedFile, metricsFile});
+        if (fontFile != null ) {
+            this.lastModified = fontFile.lastModified();
+        }
+    }
+
+    /**
+     * gets the modified timestamp for font file (not always available)
+     * @return modified timestamp
+     */
+    public long lastModified() {
+        return this.lastModified;
+    }
+
+    /**
+     * gets the cached timestamp
+     * @return
+     */
+    public long getCached() {
+        return cached;
+    }
+
+    /**
+     * gets the modified timestamp for font file
+     * (used for the purposes of font info caching) 
+     * @param lastModified modified font file timestamp
+     */
+    public void setLastModified(long lastModified) {
+        this.lastModified = lastModified;
+    }
+    
+    /** @see java.lang.Object#toString() */
+    public String toString() {
+        return super.toString() + ", lastModified=" + lastModified + ", cached=" + cached;
+    }
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\fonts\CachedFontInfo.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/FontInfoCache.java
===================================================================
--- src/java/org/apache/fop/fonts/FontInfoCache.java	(revision 0)
+++ src/java/org/apache/fop/fonts/FontInfoCache.java	(revision 0)
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts;
+
+import java.util.Map;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.config.CacheConfig;
+
+/**
+ * Retains a detailed cache of available fonts and font directories
+ * @author Adrian Cumiskey
+ */
+public class FontInfoCache {
+
+    /** master mapping of font url -> font info */
+    private static Map fontMap = CacheConfig.getFonts();
+    
+    /** mapping of font url -> file modified date */
+    private static Map failedFontMap = CacheConfig.getFailedFonts();
+
+    /** has this cache been changed since it was last read? */
+    private static boolean changed = false;
+    
+    /**
+     * creates a key given a font info for the font mapping
+     * @param fontInfo font info
+     * @return font cache key
+     */
+    public static String getCacheKey(EmbedFontInfo fontInfo) {
+        if (fontInfo != null) {
+            String embedFile = fontInfo.getEmbedFile();
+            String metricsFile = fontInfo.getMetricsFile();
+            return (embedFile != null) ? embedFile : metricsFile;
+        }
+        return null;
+    }
+
+    /**
+     * is this font in the cache?
+     * @param embedUrl font info
+     * @return boolean
+     */
+    public static boolean contains(String embedUrl) {
+        if (embedUrl != null) {
+            return fontMap.containsKey(embedUrl);
+        }
+        return false;
+    }
+
+    /**
+     * is this font info in the cache?
+     * @param fontInfo font info
+     * @return font
+     */
+    public static boolean contains(EmbedFontInfo fontInfo) {
+        if (fontInfo != null) {
+            return fontMap.containsKey(getCacheKey(fontInfo));
+        }
+        return false;
+    }
+
+    /**
+     * adds a font info to cache
+     * @param fontInfo font info
+     */
+    public static void add(EmbedFontInfo fontInfo) {
+        String cacheKey = getCacheKey(fontInfo);
+        if (!contains(cacheKey)) {
+            changed = true;
+            if (fontInfo instanceof CachedFontInfo) {
+                fontMap.put(cacheKey, fontInfo);
+            } else {
+                fontMap.put(cacheKey, new CachedFontInfo(fontInfo));
+            }
+        }
+    }
+
+    /**
+     * returns a font from the cache
+     * @param embedUrl font info
+     * @return boolean
+     */
+    public static CachedFontInfo get(String embedUrl) {
+        if (contains(embedUrl)) {
+            return (CachedFontInfo)fontMap.get(embedUrl);
+        }
+        return null;
+    }
+    
+    /**
+     * removes font from cache
+     * @param embedUrl
+     */
+    public static void remove(String embedUrl) {
+        if (contains(embedUrl)) {
+            changed = true;
+            fontMap.remove(embedUrl);
+        }
+    }
+    
+    /**
+     * clears font cache
+     */
+    public static void clear() {
+        changed = true;
+        fontMap.clear();
+    }
+
+    /**
+     * writes the font info cache back to disk
+     * @throws FOPException fop exception
+     */
+    public static void write() throws FOPException {
+        if (changed) {
+            CacheConfig.updateFonts(fontMap);
+            CacheConfig.updateFailedFonts(failedFontMap);
+            CacheConfig.save();
+        }
+    }
+
+    /**
+     * has this font previously failed to load?
+     * @param embedUrl
+     * @param lastModified
+     * @return
+     */
+    public static boolean isFailedFont(String embedUrl, long lastModified) {
+        if (failedFontMap.containsKey(embedUrl)) {
+            long failedLastModified = ((Long)failedFontMap.get(embedUrl)).longValue();
+            if (lastModified == failedLastModified) {
+                return true;
+            }
+            // this font has been changed to lets remove it
+            // from failed font map for now
+            failedFontMap.remove(embedUrl);
+        }
+        return false;
+    }
+
+    /**
+     * registers a failed font with the cache
+     * @param embedUrl
+     * @param lastModified
+     */
+    public static void registerFailedFont(String embedUrl, long lastModified) {
+        if (!failedFontMap.containsKey(embedUrl)) {
+            changed = true;
+            failedFontMap.put(embedUrl, new Long(lastModified));
+        }
+    }
+
+    /**
+     * cache has been updated since it was read
+     * @return
+     */
+    public static boolean hasChanged() {
+        return changed;
+    }    
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\fonts\FontInfoCache.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/CustomFont.java
===================================================================
--- src/java/org/apache/fop/fonts/CustomFont.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/CustomFont.java	(working copy)
@@ -30,6 +30,7 @@
             implements FontDescriptor, MutableFont {
 
     private String fontName = null;
+    protected String fontSubName = null;
     private String embedFileName = null;
     protected String embedResourceName = null;
     private FontResolver resolver = null;
@@ -51,6 +52,24 @@
 
     private boolean useKerning = true;
 
+    /**
+     * Removes all white space from a string (used primarily for font names)
+     * @param s the string
+     * @return the processed result
+     */
+    public static String stripWhiteSpace(String s) {
+        StringBuffer sb = new StringBuffer(s.length());
+        for (int i = 0, c = s.length(); i < c; i++) {
+            final char ch = s.charAt(i);
+            if (ch != ' ' 
+                    && ch != '\r' 
+                    && ch != '\n'
+                    && ch != '\t') {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
 
     /**
      * @see org.apache.fop.fonts.FontMetrics#getFontName()
@@ -60,6 +79,21 @@
     }
 
     /**
+     * @see org.apache.fop.fonts.FontMetrics#getStrippedFontName()
+     */
+    public String getStrippedFontName() {
+        return stripWhiteSpace(fontName);
+    }
+
+    /**
+     * returns font sub name
+     * @return
+     */
+    public String getFontSubName() {
+        return fontSubName;
+    }
+
+    /**
      * Returns an URI representing an embeddable font file. The URI will often
      * be a filename or an URL.
      * @return URI to an embeddable font file or null if not available.
@@ -239,6 +273,14 @@
     }
 
     /**
+     * sets the font sub name
+     * @return
+     */
+    public void setFontSubFamilyName(String subFamilyName) {
+        this.fontSubName = subFamilyName;        
+    }
+    
+    /**
      * @see org.apache.fop.fonts.MutableFont#setEmbedFileName(String)
      */
     public void setEmbedFileName(String path) {
Index: src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java
===================================================================
--- src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java	(working copy)
@@ -25,9 +25,10 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.fop.fonts.BFEntry;
 import org.apache.fop.fonts.CIDFontType;
-import org.apache.fop.fonts.CustomFont;
 import org.apache.fop.fonts.FontLoader;
 import org.apache.fop.fonts.FontResolver;
 import org.apache.fop.fonts.MultiByteFont;
@@ -37,18 +38,26 @@
  */
 public class TTFFontLoader extends FontLoader {
 
-    private String fontFileURI;
-    private TTFFile ttf;
+    /** logger instance */
+    private static Log log = LogFactory.getLog(TTFFontLoader.class);
+
     private MultiByteFont multiFont;
-    private CustomFont returnFont;
-    private FontResolver resolver;
     
-    public TTFFontLoader(String fontFileURI, InputStream in, FontResolver resolver) 
-                throws IOException {
-        this.fontFileURI = fontFileURI;
-        this.resolver = resolver;
-
-        this.ttf = new TTFFile();
+    /**
+     * default constructor
+     * @param fontFileURI
+     * @param in
+     * @param resolver
+     */
+    public TTFFontLoader(String fontFileURI, InputStream in, FontResolver resolver) {
+        super(fontFileURI, in, resolver);
+    }
+    
+    /**
+     * @see FontLoader#read()
+     */
+    protected void read() throws IOException {
+        TTFFile ttf = new TTFFile();
         FontFileReader reader = new FontFileReader(in);
         boolean supported = ttf.readFont(reader, null);
         if (!supported) {
@@ -61,11 +70,9 @@
         multiFont = new MultiByteFont();
         multiFont.setResolver(this.resolver);
         returnFont = multiFont;
-        read();        
-    }
-    
-    private void read() throws IOException {
+
         returnFont.setFontName(ttf.getFamilyName());
+        returnFont.setFontSubFamilyName(ttf.getSubFamilyName());
         //multiFont.setTTCName(ttcName)
         returnFont.setCapHeight(ttf.getCapHeight());
         returnFont.setXHeight(ttf.getXHeight());
@@ -77,6 +84,7 @@
         returnFont.setStemV(Integer.parseInt(ttf.getStemV())); //not used for TTF
         returnFont.setItalicAngle(Integer.parseInt(ttf.getItalicAngle()));
         returnFont.setMissingWidth(0);
+        
         multiFont.setCIDType(CIDFontType.CIDTYPE2);
         int[] wx = ttf.getWidths();
         multiFont.setWidthArray(wx);
@@ -93,9 +101,14 @@
         multiFont.setBFEntries(bfentries);
         copyKerning(ttf, true);
         multiFont.setEmbedFileName(this.fontFileURI);
-        
+        loaded = true;
     }
     
+    /**
+     * copy kerning information
+     * @param ttf
+     * @param isCid
+     */
     private void copyKerning(TTFFile ttf, boolean isCid) {
         
         // Get kerning
@@ -115,15 +128,7 @@
             } else {
                 h2 = (Map)ttf.getAnsiKerning().get(kpx1);
             }
-
             returnFont.putKerningEntry(kpx1, h2);
         }
-    }
-    
-    
-    /** @see org.apache.fop.fonts.FontLoader#getFont() */
-    public CustomFont getFont() {
-        return this.returnFont;
-    }
-    
+    }    
 }
Index: src/java/org/apache/fop/fonts/truetype/TTFFile.java
===================================================================
--- src/java/org/apache/fop/fonts/truetype/TTFFile.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/truetype/TTFFile.java	(working copy)
@@ -567,6 +567,14 @@
     }
 
     /**
+     * Returns the font sub family name of the font.
+     * @return String The sub family name
+     */
+    public String getSubFamilyName() {
+        return subFamilyName;
+    }
+
+    /**
      * Returns the name of the character set used.
      * @return String The caracter set
      */
Index: src/java/org/apache/fop/fonts/MultiByteFont.java
===================================================================
--- src/java/org/apache/fop/fonts/MultiByteFont.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/MultiByteFont.java	(working copy)
@@ -108,25 +108,6 @@
     public void setCIDType(CIDFontType cidType) {
         this.cidType = cidType;
     }
-
-    /**
-     * Removes all white space from a string (used primarily for font names)
-     * @param s the string
-     * @return the processed result
-     */
-    public static String stripWhiteSpace(String s) {
-        StringBuffer sb = new StringBuffer(s.length());
-        for (int i = 0, c = s.length(); i < c; i++) {
-            final char ch = s.charAt(i);
-            if (ch != ' ' 
-                    && ch != '\r' 
-                    && ch != '\n'
-                    && ch != '\t') {
-                sb.append(ch);
-            }
-        }
-        return sb.toString();
-    }
     
     private String getPrefixedFontName() {
         return namePrefix + stripWhiteSpace(super.getFontName());
Index: src/java/org/apache/fop/fonts/LazyFont.java
===================================================================
--- src/java/org/apache/fop/fonts/LazyFont.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/LazyFont.java	(working copy)
@@ -54,14 +54,21 @@
      * @param useKerning True, if kerning should be enabled
      * @param resolver the font resolver to handle font URIs
      */
-    public LazyFont(String fontEmbedPath, String metricsFileName
-                    , boolean useKerning, FontResolver resolver) {
-        this.metricsFileName = metricsFileName;
-        this.fontEmbedPath = fontEmbedPath;
-        this.useKerning = useKerning;
+    public LazyFont(EmbedFontInfo fontInfo, FontResolver resolver) {
+        
+        this.metricsFileName = fontInfo.getMetricsFile();
+        this.fontEmbedPath = fontInfo.getEmbedFile();
+        this.useKerning = fontInfo.getKerning();
         this.resolver = resolver;
     }
 
+    /**
+     * String representation of LazyFont
+     */
+    public String toString() {
+        return ( "metrics-url=" + metricsFileName + ", embed-url=" + fontEmbedPath + ", kerning=" + useKerning );
+    }
+        
     private void load(boolean fail) {
         if (!isMetricsLoaded) {
             try {
@@ -327,6 +334,5 @@
         load(true);
         return realFontDescriptor.isEmbeddable();
     }
-
 }
 
Index: src/java/org/apache/fop/fonts/Font.java
===================================================================
--- src/java/org/apache/fop/fonts/Font.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/Font.java	(working copy)
@@ -27,13 +27,22 @@
  */
 public class Font {
 
-    /** Default fallback key */
-    public static final FontTriplet DEFAULT_FONT = new FontTriplet("any", "normal", 400);
-    /** Normal font weight */
-    public static final int NORMAL = 400;
     /** Bold font weight */
-    public static final int BOLD = 700;
+    public static final int WEIGHT_BOLD = 700;
 
+    /** Normal font weight */
+    public static final int WEIGHT_NORMAL = 400;
+
+    /** Normal font style */
+    public static final String STYLE_NORMAL = "normal";
+
+    /** Italic font style */
+    public static final String STYLE_ITALIC = "italic";
+
+    /** Default fallback key */
+    public static final FontTriplet DEFAULT_FONT = new FontTriplet("any", STYLE_NORMAL, WEIGHT_NORMAL);
+
+
     private String fontName;
     private FontTriplet triplet;
     private int fontSize;
Index: src/java/org/apache/fop/fonts/EmbedFontInfo.java
===================================================================
--- src/java/org/apache/fop/fonts/EmbedFontInfo.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/EmbedFontInfo.java	(working copy)
@@ -26,10 +26,11 @@
  */
 public class EmbedFontInfo {
     
-    private String metricsFile, embedFile;
-    private boolean kerning;
-    private List fontTriplets;
-
+    protected String metricsFile;
+    protected String embedFile;
+    protected boolean kerning;
+    protected List fontTriplets;
+      
     /**
      * Main constructor
      * @param metricsFile Path to the xml file containing font metrics
@@ -44,7 +45,7 @@
         this.kerning = kerning;
         this.fontTriplets = fontTriplets;
     }
-
+        
     /**
      * Returns the path to the metrics file
      * @return the metrics file path
@@ -76,6 +77,10 @@
     public List getFontTriplets() {
         return fontTriplets;
     }
-
-}
-
+    
+    /** @see java.lang.Object#toString() */
+    public String toString() {
+        return "metrics-url=" + metricsFile + ",embed-url=" + embedFile +
+            ", kerning=" + kerning + ", font-triplet=" + fontTriplets; 
+    }
+}
\ No newline at end of file
Index: src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java	(revision 0)
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+/**
+ * FontFinder for native Unix flavoured platforms
+ */
+package org.apache.fop.fonts.autodetect;
+
+
+class UnixFontDirFinder extends NativeFontDirFinder {
+    /**
+     * some guesses at possible unix font directory locations
+     */
+    private static final String[] UNIX_FONT_PATHS = {
+        "/usr/share/fonts",
+        "/usr/local/fonts",
+        "/usr/X11R6/lib/X11/fonts"
+    };
+
+    /*
+     * @see org.apache.fop.fonts.GenericFontFinder#init()
+     */
+    protected void init() {
+        super.fontPaths = UNIX_FONT_PATHS;
+    }
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\fonts\autodetect\UnixFontDirFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/NativeFontDirFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/NativeFontDirFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/NativeFontDirFinder.java	(revision 0)
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.util.FileUtil;
+
+/**
+ * Native font finder base class
+ * @author Adrian Cumiskey
+ */
+public abstract class NativeFontDirFinder implements FontFinder {
+    
+    /** logging instance */
+    static final Log log = LogFactory.getLog(FontFinder.class);
+
+    /**
+     * Default constructor
+     */
+    public NativeFontDirFinder() {
+        init();
+    }
+
+    /**
+     * initializes font finder (with native font paths)
+     */
+    protected void init() {
+    }
+
+    /**
+     * list of native o/s font paths
+     */ 
+    protected String[] fontPaths = null;
+
+    /**
+     * Generic method used by Mac and Unix font finders
+     * @see FontFinder#find()
+     */
+    public List find() {
+        List fontDirList = new java.util.ArrayList();
+        File fontsDir = null;
+        for (int i = 0; i < fontPaths.length; i++) {
+            fontsDir = new File(fontPaths[i]);
+            if (FileUtil.validDirectory(fontsDir)) {                
+                fontDirList.add(fontsDir);
+            }
+        }
+        return fontDirList;
+    }
+}

Property changes on: src\java\org\apache\fop\fonts\autodetect\NativeFontDirFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/NativeFontFileFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/NativeFontFileFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/NativeFontFileFinder.java	(revision 0)
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.FontResolver;
+
+
+/*
+ * font finder factory
+ */
+public class NativeFontFileFinder {
+    private static final String OS_NAME = System.getProperty("os.name");
+    
+    /** native font finder implementation */
+    private static FontFinder fontDirFinder = null;
+    
+    private static FontFinder getFontDirFinder() {
+        if (fontDirFinder == null) {
+            if (OS_NAME.startsWith("Windows")) {
+                fontDirFinder = new WindowsFontDirFinder();
+            } else {
+                if (OS_NAME.startsWith("Mac")) {
+                    fontDirFinder = new MacFontDirFinder();
+                } else {
+                    fontDirFinder = new UnixFontDirFinder();
+                }
+            }
+        }
+        return fontDirFinder;
+    };
+    
+    /**
+     * Finds/identifies font files within a given directory.
+     * 
+     * @param fontResolver font resolver used to resolve font
+     * @param strict validate configuration strictly
+     * @return list of found font files
+     * @throws FOPException if something's wrong with the config data
+     */
+    public static List find(FontResolver fontResolver, boolean strict)
+    throws FOPException {
+        List fontFileList = new java.util.ArrayList();
+        List fontDirList = getFontDirFinder().find();
+        for ( int i = 0; i < fontDirList.size(); i++ ) {
+            List fontFiles = FontFileFinder.find(
+                    (File)fontDirList.get(i), fontResolver, false, strict);
+            fontFileList.addAll(fontFiles);
+        }
+        return fontFileList;
+    }
+}

Property changes on: src\java\org\apache\fop\fonts\autodetect\NativeFontFileFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/WindowsFontDirFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/WindowsFontDirFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/WindowsFontDirFinder.java	(revision 0)
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.List;
+
+import org.apache.fop.util.FileUtil;
+
+/**
+ * FontFinder for native Windows platforms
+ */
+public class WindowsFontDirFinder extends NativeFontDirFinder {
+        
+    /**
+     * Attempts to read windir environment variable on windows
+     * (disclaimer: This is a bit dirty but seems to work nicely) 
+     */
+    private static String getWinDir(String osName) throws IOException {
+        Process process = null;
+        Runtime runtime = Runtime.getRuntime();
+        if (osName.startsWith("Windows 9")) {
+            process = runtime.exec("command.com /c set");
+        } else if (osName.endsWith("NT") || osName.endsWith("2000") || osName.endsWith("XP")) {
+            process = runtime.exec("cmd.exe /c set");
+        }
+        BufferedReader bufferedReader = new BufferedReader(
+                new InputStreamReader(process.getInputStream()));
+        String line;
+        while ((line = bufferedReader.readLine()) != null) {
+            int idx = line.indexOf('=');
+            String key = line.substring(0, idx);
+            String value = line.substring(idx + 1);
+            if (key.toLowerCase().equals("windir")) {
+                return value;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @see FontFinder#find()
+     * @return a list of detected font files
+     */
+    public List find() {
+        List fontDirList = new java.util.ArrayList();
+        String windir = null;
+        try {
+            windir = System.getProperty("env.windir");
+        } catch (SecurityException e) {
+            // should continue if this fails
+        }
+        String osName = System.getProperty("os.name");
+        if (windir == null) {
+            try {
+                windir = getWinDir(osName);
+            } catch (IOException e) {
+                // should continue if this fails
+            }
+        }
+        File osFontsDir = null, psFontsDir = null;
+        if (windir != null) {
+            // remove any trailing '/'
+            if (windir.endsWith("/")) {
+                windir = windir.substring(0, windir.length() - 1);
+            }
+            osFontsDir = new File(windir + File.separator + "FONTS");
+            if (FileUtil.validDirectory(osFontsDir)) {
+                fontDirList.add(osFontsDir);
+            }
+            psFontsDir = new File(windir.substring(0, 2) + File.separator + "PSFONTS");
+            if (FileUtil.validDirectory(psFontsDir)) {
+                fontDirList.add(psFontsDir);
+            }
+        } else {
+            String windowsDirName = osName.endsWith("NT") ? "WINNT" : "WINDOWS";                
+            // look for true type font folder
+            for (char driveLetter = 'C'; driveLetter <= 'E'; driveLetter++) {
+                osFontsDir = new File(
+                        driveLetter + ":"
+                        + File.separator + windowsDirName
+                        + File.separator + "FONTS");
+                if (FileUtil.validDirectory(osFontsDir)) {
+                    fontDirList.add(osFontsDir);
+                    break;
+                }
+            }
+            // look for type 1 font folder
+            for (char driveLetter = 'C'; driveLetter <= 'E'; driveLetter++) {
+                psFontsDir = new File( driveLetter + ":" + File.separator + "PSFONTS");
+                if (FileUtil.validDirectory(psFontsDir)) {
+                    fontDirList.add(psFontsDir);
+                    break;
+                }
+            }
+        }
+        return fontDirList;
+    }
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\fonts\autodetect\WindowsFontDirFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java	(revision 0)
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.fonts.CachedFontInfo;
+import org.apache.fop.fonts.CustomFont;
+import org.apache.fop.fonts.EmbedFontInfo;
+import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontInfoCache;
+import org.apache.fop.fonts.FontLoader;
+import org.apache.fop.fonts.FontResolver;
+import org.apache.fop.fonts.FontTriplet;
+
+public abstract class FontInfoFinder implements FontFinder {
+    
+    /** logging instance */
+    private static final Log log = LogFactory.getLog(FontInfoFinder.class);
+
+    /** font constituent names which identify a font as being of "italic" style */
+    static final private String[] italicIdentifyingNames = {"italic", "oblique"};
+
+    /** font constituent names which identify a font as being of "bold" weight */
+    static final private String[] boldIdentifyingNames = {"bold", "black", "heavy", "ultra", "super"};
+
+    /**
+     * Attempts to determine FontTriplet from a given CustomFont.
+     * It seems to be fairly accurate but will probably require some tweaking over time
+     * 
+     * @param customFont CustomFont
+     * @return newly created font triplet
+     */
+    private static FontTriplet tripletFromFont(CustomFont customFont) {
+        // default style and weight triplet vales (fallback)
+        String name = customFont.getStrippedFontName();
+        String subName = customFont.getFontSubName();
+        String searchName = name.toLowerCase();
+        if (subName != null) {
+            searchName += subName.toLowerCase();
+        }
+        
+        // style
+        String style = "normal";
+        if (customFont.getItalicAngle() > 0) {
+            style = "italic";          
+        } else {
+            for (int i = 0; i < italicIdentifyingNames.length; i++) {
+                if (searchName.indexOf(italicIdentifyingNames[i]) != -1) {
+                    style = "italic";          
+                    break;
+                }
+            }
+        }
+        
+        // weight
+        int weight = Font.WEIGHT_NORMAL;
+        for (int i = 0; i < boldIdentifyingNames.length; i++) {
+            if (searchName.indexOf(boldIdentifyingNames[i]) != -1) {
+                weight = Font.WEIGHT_BOLD;
+                break;
+            }            
+        }
+        return new FontTriplet(name, style, weight);
+    }
+    
+    /**
+     * Attempts to determine FontInfo from a given custom font
+     * @param fontFile
+     * @param customFont
+     * @param useCache resolve font info from cache
+     * @return
+     */
+    private static EmbedFontInfo fontInfoFromCustomFont(
+            File fontFile, CustomFont customFont, boolean useCache) {
+        FontTriplet fontTriplet = tripletFromFont(customFont);
+        List fontTripletList = new java.util.ArrayList();
+        fontTripletList.add(fontTriplet);
+        String embedUrl;
+        try {
+            embedUrl = fontFile.toURL().toExternalForm();
+        } catch (MalformedURLException e) {
+            embedUrl = fontFile.getAbsolutePath();
+        }
+        EmbedFontInfo fontInfo = new EmbedFontInfo(null, customFont.isKerningEnabled(),
+                fontTripletList, embedUrl);
+        if (useCache) {
+            FontInfoCache.add(fontInfo);
+        }
+        return fontInfo;
+    }
+        
+    /**
+     * Attempts to determine EmbedFontInfo from a given font file.
+     * 
+     * @param fontFile font file
+     * @param resolver font resolver used to resolve font
+     * @param useCache resolve font info from cache
+     * @return newly created embed font info
+     */
+    public static EmbedFontInfo find(File fontFile, FontResolver resolver, boolean useCache) {
+        String embedUrl = null;
+        try {
+            embedUrl = fontFile.toURL().toExternalForm();
+        } catch (MalformedURLException mfue) {
+            // should never happen
+            log.error("Failed to convert '" + fontFile + "' to URL: " + mfue.getMessage() );
+        }
+        
+        long fileLastModified = -1;
+        if (useCache) {
+            fileLastModified = fontFile.lastModified();
+            // firstly try and fetch it from cache before loading/parsing the font file
+            if (FontInfoCache.contains(embedUrl)) {
+                CachedFontInfo fontInfo = FontInfoCache.get(embedUrl);
+                if (fontInfo.lastModified() == fileLastModified) {
+                    return fontInfo;
+                } else {
+                    // out of date cache item
+                    FontInfoCache.remove(embedUrl);
+                }
+            // is this a previously failed parsed font?
+            } else if (FontInfoCache.isFailedFont(embedUrl, fileLastModified)) {
+                log.info("Unable to load font file: " + embedUrl);
+                return null;
+            }
+        }
+        
+        // try to determine triplet information from font file
+        CustomFont customFont = null;
+        try {
+            customFont = FontLoader.loadFont(fontFile, resolver);
+        } catch (IOException e) {
+            log.error("Unable to load font file: " + embedUrl);
+            if (useCache) {
+                FontInfoCache.registerFailedFont(embedUrl, fileLastModified);
+            }
+            return null;
+        }
+        return fontInfoFromCustomFont(fontFile, customFont, useCache);     
+    }
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\fonts\autodetect\FontInfoFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/FontDirFilter.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/FontDirFilter.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/FontDirFilter.java	(revision 0)
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.io.File;
+import java.io.FileFilter;
+
+/**
+ * FileFilter used to identify valid font directories
+ * only readable directories not beginning with a '.'
+ */
+public class FontDirFilter implements FileFilter {
+
+    public boolean accept(File file) {
+        return file.canRead() && file.isDirectory()
+        && !file.getName().startsWith(".");
+    }
+}

Property changes on: src\java\org\apache\fop\fonts\autodetect\FontDirFilter.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/FontFileFilter.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/FontFileFilter.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/FontFileFilter.java	(revision 0)
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.io.File;
+import java.io.FileFilter;
+
+/**
+ * FileFilter used to identify valid font files
+ * only readable truetype and printer font metrics files
+ */
+public class FontFileFilter implements FileFilter {
+
+    /**
+     * @see FileFilter#accept(File)
+     */
+    public boolean accept(File file) {
+        String filename = file.getName().toLowerCase();
+        return ((file.canRead() && file.isFile()) && (filename
+                .endsWith(".ttf") || filename.endsWith(".pfb")));
+    }
+}

Property changes on: src\java\org\apache\fop\fonts\autodetect\FontFileFilter.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java	(revision 0)
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.FontResolver;
+import org.apache.fop.util.FileUtil;
+import org.apache.fop.util.LogUtil;
+
+/**
+ * Helps to autodetect/locate available operating system fonts
+ * @author Adrian Cumiskey
+ */
+public class FontFileFinder {
+    /** logging instance */
+    private static final Log log = LogFactory.getLog(FontFileFinder.class);
+
+    /** font file filter */
+    private static FileFilter fontFileFilter = null;
+
+    /** font directory filter */
+    private static FileFilter fontDirectoryFilter = null;
+    
+    /**
+     * Directory filter used to find valid font directories
+     * @return font file filter
+     */
+    private static FileFilter getFontDirectoryFilter() {
+        if (fontDirectoryFilter == null) {
+            fontDirectoryFilter = new FontDirFilter();
+        }
+        return fontDirectoryFilter;
+    }
+
+    /**
+     * File filter used to find font files
+     * @return font file filter
+     */
+    private static FileFilter getFontFileFilter() {
+        if (fontFileFilter == null) {
+            fontFileFilter = new FontFileFilter();
+        }
+        return fontFileFilter;
+    }
+
+    /**
+     * Finds/identifies font files within a given directory.
+     * 
+     * @param fontDir File object representing fonts location
+     * @param fontResolver font resolver used to resolve font
+     * @param recursive look in sub directories for fonts
+     * @param strict validate configuration strictly
+     * @return list of found font files
+     * @throws FOPException if something's wrong with the config data
+     */
+    public static List find(
+            File fontDir, FontResolver fontResolver, boolean recursive, boolean strict)
+            throws FOPException {
+
+        List fontFileList = new java.util.ArrayList();
+        
+        if (!FileUtil.validDirectory(fontDir, log)) {
+            LogUtil.handleError(log, "Fonts configuration directory '"
+                            + fontDir.getAbsolutePath() + "' is not valid", strict);
+            return fontFileList;
+        }
+                       
+        File[] fontFiles = fontDir.listFiles(getFontFileFilter());
+        log.info(fontDir + ": found " + fontFiles.length + " font"
+                + ((fontFiles.length == 1) ? "" : "s"));
+        for (int i = 0; i < fontFiles.length; i++) {
+            File fontFile = fontFiles[i];
+            fontFileList.add(fontFile);
+        }
+
+        // examine sub directories
+        if (recursive) {
+            File[] fontSubdirList = fontDir.listFiles(getFontDirectoryFilter());
+            for (int i = 0; i < fontSubdirList.length; i++) {
+                List subDirFontFileList = find(fontSubdirList[i], fontResolver, recursive, strict);
+                fontFileList.addAll(subDirFontFileList);
+            }
+        }        
+        return fontFileList;
+    }    
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\fonts\autodetect\FontFileFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/MacFontDirFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/MacFontDirFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/MacFontDirFinder.java	(revision 0)
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+/**
+ * FontFinder for native Mac flavoured platforms
+ */
+package org.apache.fop.fonts.autodetect;
+
+
+class MacFontDirFinder extends NativeFontDirFinder {
+    /**
+     * standard mac font directory locations
+     */
+    private static final String[] MAC_FONT_PATHS = {
+        "~/Library/Fonts/",         // user
+        "/Library/Fonts/",          // local
+        "/Network/Library/Fonts/",  // network
+        "/System/Library/Fonts/",   // system
+        "/System Folder/Fonts/"     // classic
+    };
+    
+    /*
+     * @see org.apache.fop.fonts.GenericFontFinder#init()
+     */
+    protected void init() {
+        super.fontPaths = MAC_FONT_PATHS;
+    }
+}
\ No newline at end of file

Property changes on: src\java\org\apache\fop\fonts\autodetect\MacFontDirFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/autodetect/FontFinder.java
===================================================================
--- src/java/org/apache/fop/fonts/autodetect/FontFinder.java	(revision 0)
+++ src/java/org/apache/fop/fonts/autodetect/FontFinder.java	(revision 0)
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.fonts.autodetect;
+
+import java.util.List;
+
+/**
+ * Implementers provide find method for searching native operating system
+ * for available fonts.
+ */
+public interface FontFinder {    
+    public List find();
+}

Property changes on: src\java\org\apache\fop\fonts\autodetect\FontFinder.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/fonts/FontInfo.java
===================================================================
--- src/java/org/apache/fop/fonts/FontInfo.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/FontInfo.java	(working copy)
@@ -130,6 +130,9 @@
      */
     private FontTriplet fontLookup(String family, String style,
                              int weight, boolean substFont) {
+        if( log.isDebugEnabled() ) {
+            log.debug(family + " " + style + " " + weight);
+        }
         FontTriplet startKey = createFontKey(family, style, weight); 
         FontTriplet key = startKey;
         // first try given parameters
@@ -146,13 +149,13 @@
             // only if the font may be substituted
             // fallback 1: try the same font-family and weight with default style
             if (f == null) {
-                key = createFontKey(family, "normal", weight);
+                key = createFontKey(family, Font.STYLE_NORMAL, weight);
                 f = getInternalFontKey(key);
             }
             
             // fallback 2: try the same font-family with default style and weight
             if (f == null) {
-                key = createFontKey(family, "normal", 400);
+                key = createFontKey(family, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
                 f = getInternalFontKey(key);
             }
             
@@ -426,8 +429,4 @@
             return 0;
         }
     }
-    
 }
-
-
-
Index: src/java/org/apache/fop/fonts/FontSetup.java
===================================================================
--- src/java/org/apache/fop/fonts/FontSetup.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/FontSetup.java	(working copy)
@@ -34,16 +34,11 @@
 import org.apache.fop.fonts.base14.CourierBoldOblique;
 import org.apache.fop.fonts.base14.Symbol;
 import org.apache.fop.fonts.base14.ZapfDingbats;
-import org.apache.fop.render.PrintRenderer;
 
 // commons logging
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-// Avalon
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
 // Java
 import java.util.List;
 
@@ -63,7 +58,7 @@
      * logging instance
      */
     protected static Log log = LogFactory.getLog("org.apache.fop.fonts");
-    
+
     /**
      * Sets up the font info object.
      *
@@ -113,52 +108,52 @@
         // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic());
 
         /* any is treated as serif */
-        fontInfo.addFontProperties("F5", "any", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "any", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "any", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F8", "any", "oblique", Font.BOLD);
+        fontInfo.addFontProperties("F5", "any", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "any", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "any", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "any", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "any", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "any", "oblique", Font.WEIGHT_BOLD);
 
-        fontInfo.addFontProperties("F1", "sans-serif", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F3", "sans-serif", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F5", "serif", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "serif", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F9", "monospace", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F11", "monospace", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "italic", Font.BOLD);
+        fontInfo.addFontProperties("F1", "sans-serif", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F3", "sans-serif", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F5", "serif", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "serif", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "serif", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "serif", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F9", "monospace", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F11", "monospace", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "italic", Font.WEIGHT_BOLD);
 
-        fontInfo.addFontProperties("F1", "Helvetica", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F3", "Helvetica", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F5", "Times", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "Times", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F9", "Courier", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F11", "Courier", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F13", "Symbol", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Font.NORMAL);
+        fontInfo.addFontProperties("F1", "Helvetica", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F3", "Helvetica", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F5", "Times", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "Times", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F9", "Courier", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F11", "Courier", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F13", "Symbol", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Font.WEIGHT_NORMAL);
 
         // Custom type 1 fonts step 2/2
         // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL);
@@ -166,20 +161,20 @@
         // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", FontInfo.BOLD);
 
         /* for compatibility with PassiveTex */
-        fontInfo.addFontProperties("F5", "Times-Roman", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "Times-Roman", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "italic", Font.BOLD);
-        fontInfo.addFontProperties("F5", "Times Roman", "normal", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "oblique", Font.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "italic", Font.NORMAL);
-        fontInfo.addFontProperties("F7", "Times Roman", "normal", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "oblique", Font.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "italic", Font.BOLD);
+        fontInfo.addFontProperties("F5", "Times-Roman", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "Times-Roman", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F5", "Times Roman", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F7", "Times Roman", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "italic", Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
-                                   "normal", Font.NORMAL);
+                                   "normal", Font.WEIGHT_NORMAL);
 
         /* Add configured fonts */
         addConfiguredFonts(fontInfo, embedList, 15, resolver);
@@ -218,10 +213,7 @@
             reader.setFontEmbedPath(configFontInfo.getEmbedFile());
             fontInfo.addMetrics(internalName, reader.getFont());
             */
-            LazyFont font = new LazyFont(configFontInfo.getEmbedFile(),
-                                         metricsFile,
-                                         configFontInfo.getKerning(), 
-                                         resolver);
+            LazyFont font = new LazyFont(configFontInfo, resolver);
             fontInfo.addMetrics(internalName, font);
 
             List triplets = configFontInfo.getFontTriplets();
@@ -237,7 +229,7 @@
     }
 
     /** @return a new FontResolver to be used by the font subsystem */
-    private static FontResolver createMinimalFontResolver() {
+    public static FontResolver createMinimalFontResolver() {
         return new FontResolver() {
 
             /** @see org.apache.fop.fonts.FontResolver#resolve(java.lang.String) */
@@ -245,135 +237,6 @@
                 //Minimal functionality here
                 return new StreamSource(href);
             }
-            
         };
-    }
-   
-    /**
-     * Builds a list of EmbedFontInfo objects for use with the setup() method.
-     * 
-     * @param cfg Configuration object
-     * @param renderer calling Renderer object
-     * @return List the newly created list of fonts
-     * @throws ConfigurationException if something's wrong with the config data
-     */
-    public static List buildFontListFromConfiguration(Configuration cfg, PrintRenderer renderer)
-            throws ConfigurationException {
-        List fontList = new java.util.ArrayList();
-               
-        FontResolver fontResolver = (renderer != null ? renderer.getFontResolver() : null);
-        if (fontResolver == null) {
-            //Ensure that we have minimal font resolution capabilities
-            fontResolver = FontSetup.createMinimalFontResolver();
-        }
-       
-        boolean strict = false;
-        if (renderer != null) {
-            strict = renderer.getUserAgent().getFactory().validateUserConfigStrictly();
-        }
-        
-        Configuration[] fonts = cfg.getChildren("fonts");
-        for (int f = 0; f < fonts.length; f++) {
-                
-            Configuration[] font = fonts[f].getChildren("font");
-            for (int i = 0; i < font.length; i++) {
-    
-                String metricsUrl = font[i].getAttribute("metrics-url", null);
-                String embedUrl = font[i].getAttribute("embed-url", null);
-    
-                if (metricsUrl == null && embedUrl == null) {
-                    if (strict) {
-                        throw new ConfigurationException(
-                                "Font configuration without metric-url or embed-url");
-                    }
-                    log.error("Font configuration without metric-url or embed-url");
-                    continue;
-                }
-                
-                if (metricsUrl != null && fontResolver.resolve(metricsUrl) == null) {
-                    if (strict) {
-                        throw new ConfigurationException("Failed to resolve font metric-url '"
-                            + metricsUrl + "'");                    
-                    }
-                    log.error("Failed to resolve font metric-url '" + metricsUrl + "'");
-                    continue;
-                }
-                
-                if (embedUrl != null && fontResolver.resolve(embedUrl) == null) {
-                    if (strict) {
-                        throw new ConfigurationException("Failed to resolve font with embed-url '"
-                                + embedUrl + "'");
-                    }
-                    log.error("Failed to resolve font with embed-url '" + embedUrl + "'");
-                    continue;
-                }
-            
-                boolean useKerning = font[i].getAttributeAsBoolean("kerning", false);
-    
-                Configuration[] triple = font[i].getChildren("font-triplet");
-                List tripleList = new java.util.ArrayList();
-                for (int j = 0; j < triple.length; j++) {
-                    String name = triple[j].getAttribute("name");
-                    if (name == null) {
-                        if (strict) {
-                            throw new ConfigurationException("font-triplet without name");
-                        }
-                        log.error("font-triplet without name");
-                        continue;
-                    }
-                    
-                    String weightStr = triple[j].getAttribute("weight");
-                    if (weightStr == null) {
-                        if (strict) {
-                            throw new ConfigurationException("font-triplet without weight");
-                        }
-                        log.error("font-triplet without weight");
-                        continue;
-                    }
-                    int weight = FontUtil.parseCSS2FontWeight(weightStr);
-    
-                    String style = triple[j].getAttribute("style");
-                    if (style == null) {
-                        if (strict) {
-                            throw new ConfigurationException("font-triplet without style");
-                        }
-                        log.error("font-triplet without style");
-                        continue;
-                    }
-                    
-                    tripleList.add(FontInfo.createFontKey(name,
-                            style, weight));
-                }
-    
-                EmbedFontInfo configFontInfo = new EmbedFontInfo(metricsUrl, 
-                        useKerning, tripleList, embedUrl);
-                
-                if (log.isDebugEnabled()) {
-                    log.debug("Adding font " + configFontInfo.getEmbedFile()
-                            + ", metric file " + configFontInfo.getMetricsFile());
-                    for (int j = 0; j < tripleList.size(); ++j) {
-                        FontTriplet triplet = (FontTriplet) tripleList.get(j);
-                        log.debug("Font triplet "
-                                    + triplet.getName() + ", "
-                                    + triplet.getStyle() + ", "
-                                    + triplet.getWeight());
-                    }
-                }
-                fontList.add(configFontInfo);
-            }
-        }
-        return fontList;
-    }    
-
-    /**
-     * Builds a list of EmbedFontInfo objects for use with the setup() method.
-     * 
-     * @param cfg Configuration object
-     * @return List the newly created list of fonts
-     * @throws ConfigurationException if something's wrong with the config data
-     */
-    public static List buildFontListFromConfiguration(Configuration cfg)
-    throws ConfigurationException {
-        return buildFontListFromConfiguration(cfg, null);
-    }
+    }       
 }
Index: src/java/org/apache/fop/fonts/FontLoader.java
===================================================================
--- src/java/org/apache/fop/fonts/FontLoader.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/FontLoader.java	(working copy)
@@ -19,6 +19,8 @@
 
 package org.apache.fop.fonts;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -28,6 +30,8 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.fop.fonts.truetype.TTFFontLoader;
 import org.apache.fop.fonts.type1.Type1FontLoader;
 
@@ -37,6 +41,43 @@
 public abstract class FontLoader {
 
     /**
+     * logging instance
+     */
+    protected static Log log = LogFactory.getLog("org.apache.fop.fonts");
+
+    protected String fontFileURI = null;
+    protected InputStream in = null;
+    protected FontResolver resolver = null;
+    protected CustomFont returnFont = null;
+
+    protected boolean loaded = false;
+
+    public FontLoader(String fontFileURI, InputStream in, FontResolver resolver) {
+        this.fontFileURI = fontFileURI;
+        this.in = in;
+        this.resolver = resolver;
+    }
+
+    private static boolean isType1(String fontURI) {
+        return fontURI.toLowerCase().endsWith(".pfb");
+    }
+
+    /**
+     * Loads a custom font from a File. In the case of Type 1 fonts, the PFB file must be specified.
+     * @param fontFile the File representation of the font
+     * @param resolver the font resolver to use when resolving URIs
+     * @return the newly loaded font
+     * @throws IOException In case of an I/O error
+     */
+    public static CustomFont loadFont(File fontFile, FontResolver resolver)
+    throws IOException {
+        String fontFileURI = fontFile.getAbsolutePath();
+        boolean type1 = isType1(fontFileURI);
+        InputStream in = new FileInputStream(fontFile);
+        return loadFontFromInputStream(fontFileURI, resolver, type1, in);
+    }
+        
+    /**
      * Loads a custom font from a URI. In the case of Type 1 fonts, the PFB file must be specified.
      * @param fontFileURI the URI to the font
      * @param resolver the font resolver to use when resolving URIs
@@ -45,21 +86,38 @@
      */
     public static CustomFont loadFont(String fontFileURI, FontResolver resolver)
                 throws IOException {
-        FontLoader loader;
         fontFileURI = fontFileURI.trim();
         String name = fontFileURI.toLowerCase();
         String effURI;
-        boolean type1 = false;
-        if (name.endsWith(".pfb")) {
-            type1 = true;
+        boolean type1 = isType1(fontFileURI);
+        if (type1) {
             effURI = name.substring(0, fontFileURI.length() - 4) + ".pfm";
         } else {
             effURI = fontFileURI;
         }
-        
+        if (log.isDebugEnabled()) {
+            log.debug("opening " + effURI);
+        }
         InputStream in = openFontFile(resolver, effURI);
+        return loadFontFromInputStream(fontFileURI, resolver, type1, in);
+    }
+
+    /**
+     * loads and returns a font given an input stream
+     * @param fontFileURI font file uri
+     * @param resolver font resolver
+     * @param isType1 is it a type1 font?
+     * @param in input stream
+     * @return
+     * @throws IOException
+     */
+    protected static CustomFont loadFontFromInputStream(
+            String fontFileURI, FontResolver resolver, boolean isType1,
+            InputStream in)
+    throws IOException {
+        FontLoader loader;
         try {
-            if (type1) {
+            if (isType1) {
                 loader = new Type1FontLoader(fontFileURI, in, resolver);
             } else {
                 loader = new TTFFontLoader(fontFileURI, in, resolver);
@@ -70,6 +128,14 @@
         }
     }
 
+    /**
+     * opens a font file and returns an input stream
+     * @param resolver
+     * @param uri
+     * @return
+     * @throws IOException
+     * @throws MalformedURLException
+     */
     private static InputStream openFontFile(FontResolver resolver, String uri) 
                     throws IOException, MalformedURLException {
         InputStream in = null;
@@ -96,11 +162,18 @@
         }
         return in;
     }
-    
+        
     /**
-     * @return the font loaded by this loader
+     * reads/parses the font data
      */
-    public abstract CustomFont getFont();
+    abstract protected void read() throws IOException;
 
-    
+    /** @throws IOException 
+     * @see org.apache.fop.fonts.FontLoader#getFont() */
+    public CustomFont getFont() throws IOException {
+        if (!loaded) {
+            read();
+        }
+        return this.returnFont;
+    }
 }
Index: src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
===================================================================
--- src/java/org/apache/fop/fonts/type1/Type1FontLoader.java	(revision 517602)
+++ src/java/org/apache/fop/fonts/type1/Type1FontLoader.java	(working copy)
@@ -22,7 +22,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.fop.fonts.CustomFont;
 import org.apache.fop.fonts.FontLoader;
 import org.apache.fop.fonts.FontResolver;
 import org.apache.fop.fonts.FontType;
@@ -33,11 +32,8 @@
  */
 public class Type1FontLoader extends FontLoader {
 
-    private String fontFileURI;
     private PFMFile pfm;
     private SingleByteFont singleFont;
-    private CustomFont returnFont;
-    private FontResolver resolver;
     
     /**
      * Constructs a new Type 1 font loader.
@@ -48,19 +44,19 @@
      */
     public Type1FontLoader(String fontFileURI, InputStream in, FontResolver resolver) 
                 throws IOException {
-        this.fontFileURI = fontFileURI;
-        this.resolver = resolver;
+        super(fontFileURI, in, resolver);
+    }
 
+    /**
+     * @see FontLoader#read()
+     */
+    protected void read() throws IOException {
         pfm = new PFMFile();
         pfm.load(in);
         singleFont = new SingleByteFont();
         singleFont.setFontType(FontType.TYPE1);
         singleFont.setResolver(this.resolver);
         returnFont = singleFont;
-        read();        
-    }
-    
-    private void read() throws IOException {
         returnFont.setFontName(pfm.getPostscriptName());
         returnFont.setCapHeight(pfm.getCapHeight());
         returnFont.setXHeight(pfm.getXHeight());
@@ -77,12 +73,5 @@
             singleFont.setWidth(i, pfm.getCharWidth(i));
         }
         singleFont.setEmbedFileName(this.fontFileURI);
-        
     }
-    
-    /** @see org.apache.fop.fonts.FontLoader#getFont() */
-    public CustomFont getFont() {
-        return this.returnFont;
-    }
-    
 }
Index: src/java/org/apache/fop/svg/PDFTextPainter.java
===================================================================
--- src/java/org/apache/fop/svg/PDFTextPainter.java	(revision 517602)
+++ src/java/org/apache/fop/svg/PDFTextPainter.java	(working copy)
@@ -160,8 +160,8 @@
         String style = ((posture != null) && (posture.floatValue() > 0.0))
                        ? "italic" : "normal";
         int weight = ((taWeight != null)
-                       &&  (taWeight.floatValue() > 1.0)) ? Font.BOLD
-                       : Font.NORMAL;
+                       &&  (taWeight.floatValue() > 1.0)) ? Font.WEIGHT_BOLD
+                       : Font.WEIGHT_NORMAL;
 
         Font fontState = null;
         FontInfo fi = fontInfo;
@@ -187,7 +187,7 @@
             }
         }
         if (!found) {
-            FontTriplet triplet = fontInfo.fontLookup("any", style, Font.NORMAL);
+            FontTriplet triplet = fontInfo.fontLookup("any", style, Font.WEIGHT_NORMAL);
             int fsize = (int)(size.floatValue() * 1000);
             fontState = fontInfo.getFontInstance(triplet, fsize);
         } else {
@@ -196,7 +196,7 @@
             }
         }
         int fStyle = java.awt.Font.PLAIN;
-        if (weight == Font.BOLD) {
+        if (weight == Font.WEIGHT_BOLD) {
             if (style.equals("italic")) {
                 fStyle = java.awt.Font.BOLD | java.awt.Font.ITALIC;
             } else {
Index: src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
===================================================================
--- src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java	(revision 517602)
+++ src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java	(working copy)
@@ -28,13 +28,12 @@
 import org.apache.fop.pdf.PDFResources;
 import org.apache.fop.pdf.PDFColor;
 import org.apache.fop.pdf.PDFAnnotList;
+import org.apache.fop.config.PDFRendererConfig;
 import org.apache.fop.fonts.FontSetup;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 
 import java.awt.Graphics;
 import java.awt.Font;
@@ -57,7 +56,7 @@
  * @see org.apache.fop.svg.PDFGraphics2D
  */
 public class PDFDocumentGraphics2D extends PDFGraphics2D
-            implements Configurable, Initializable {
+            implements Initializable {
 
     private PDFContext pdfContext;
 
@@ -154,14 +153,6 @@
     }
 
     /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration cfg) throws ConfigurationException {
-        this.cfg = cfg;
-        this.pdfContext.setFontList(FontSetup.buildFontListFromConfiguration(cfg));
-    }
-
-    /**
      * @see org.apache.avalon.framework.activity.Initializable#initialize()
      */
     public void initialize() throws Exception {
@@ -176,7 +167,7 @@
 
         if (this.cfg != null) {
             this.pdfDoc.setFilterMap(
-                PDFFilterList.buildFilterMapFromConfiguration(cfg));
+                PDFRendererConfig.buildFilterMapFromConfiguration(cfg));
         }
     }
 
Index: src/java/org/apache/fop/svg/PDFGraphics2D.java
===================================================================
--- src/java/org/apache/fop/svg/PDFGraphics2D.java	(revision 517602)
+++ src/java/org/apache/fop/svg/PDFGraphics2D.java	(working copy)
@@ -1429,7 +1429,7 @@
             }
             float siz = gFont.getSize2D();
             String style = gFont.isItalic() ? "italic" : "normal";
-            int weight = gFont.isBold() ? Font.BOLD : Font.NORMAL;
+            int weight = gFont.isBold() ? Font.WEIGHT_BOLD : Font.WEIGHT_NORMAL;
             FontTriplet triplet = fontInfo.fontLookup(n, style, weight);
             fontState = fontInfo.getFontInstance(triplet, (int)(siz * 1000 + 0.5));
         } else {
Index: src/java/org/apache/fop/apps/FOUserAgent.java
===================================================================
--- src/java/org/apache/fop/apps/FOUserAgent.java	(revision 517602)
+++ src/java/org/apache/fop/apps/FOUserAgent.java	(working copy)
@@ -33,6 +33,7 @@
 
 // FOP
 import org.apache.fop.Version;
+import org.apache.fop.config.FopConfig;
 import org.apache.fop.fo.FOEventHandler;
 import org.apache.fop.pdf.PDFEncryptionParams;
 import org.apache.fop.render.Renderer;
@@ -63,19 +64,25 @@
 public class FOUserAgent {
 
     /** Defines the default target resolution (72dpi) for FOP */
-    public static final float DEFAULT_TARGET_RESOLUTION = FopFactory.DEFAULT_TARGET_RESOLUTION;
+    public static final float DEFAULT_TARGET_RESOLUTION = FopConfig.DEFAULT_TARGET_RESOLUTION;
 
     private static Log log = LogFactory.getLog("FOP");
 
     private FopFactory factory;
     
-    /** The base URL for all URL resolutions, especially for external-graphics */
-    private String baseURL;
-    
+    /**
+     *  The base URL for all URL resolutions, especially for
+     *  external-graphics.
+     */
+    private String base = null;
+
+    /** The base URL for all font URL resolutions. */
+    private String fontBase = null;
+
     /** A user settable URI Resolver */
     private URIResolver uriResolver = null;
     
-    private float targetResolution = DEFAULT_TARGET_RESOLUTION;
+    private float targetResolution = FopConfig.DEFAULT_TARGET_RESOLUTION;
     private Map rendererOptions = new java.util.HashMap();
     private File outputFile = null;
     private Renderer rendererOverride = null;
@@ -107,6 +114,7 @@
      * Default constructor
      * @throws FOPException 
      * @see org.apache.fop.apps.FopFactory
+     * @throws FOPException 
      * @deprecated Provided for compatibility only. Please use the methods from 
      *             FopFactory to construct FOUserAgent instances!
      */
@@ -126,6 +134,7 @@
         }
         this.factory = factory;
         setBaseURL(factory.getBaseURL());
+        setFontBaseURL(factory.getFontBaseURL());
         setTargetResolution(factory.getTargetResolution());
     }
     
@@ -277,18 +286,26 @@
     
     /**
      * Sets the base URL.
-     * @param baseURL base URL
+     * @param baseUrl base URL
      */
-    public void setBaseURL(String baseURL) {
-        this.baseURL = baseURL;
+    public void setBaseURL(String baseUrl) {
+        this.base = baseUrl;
     }
 
     /**
+     * sets font base URL
+     * @param fontBaseUrl font base URL
+     */
+    public void setFontBaseURL(String fontBaseUrl) {
+        this.fontBase = fontBaseUrl;
+    }
+
+    /**
      * Returns the base URL.
      * @return the base URL
      */
     public String getBaseURL() {
-        return this.baseURL;
+        return this.base;
     }
 
     /**
@@ -410,8 +427,6 @@
      */
     public void setTargetResolution(float dpi) {
         this.targetResolution = dpi;
-        log.info("target-resolution set to: " + targetResolution 
-                + "dpi (px2mm=" + getTargetPixelUnitToMillimeter() + ")");
     }
 
     /**
@@ -429,8 +444,7 @@
 
     /** @return the font base URL */
     public String getFontBaseURL() {
-        String fontBaseURL = getFactory().getFontBaseURL(); 
-        return fontBaseURL != null ? fontBaseURL : getBaseURL();
+        return fontBase != null ? fontBase : getBaseURL();
     }
 
     /**
Index: src/java/org/apache/fop/apps/FOURIResolver.java
===================================================================
--- src/java/org/apache/fop/apps/FOURIResolver.java	(revision 517602)
+++ src/java/org/apache/fop/apps/FOURIResolver.java	(working copy)
@@ -29,6 +29,7 @@
 import java.net.URLConnection;
 
 import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
 import javax.xml.transform.stream.StreamSource;
 
 // commons logging
@@ -47,54 +48,63 @@
 public class FOURIResolver
     implements javax.xml.transform.URIResolver {
     
+    // log
     private Log log = LogFactory.getLog("FOP");
+
+    // fop factory
+    private FopFactory factory = null;
+
+    /**
+     * default constructor
+     * @param factory fop factory
+     */
+    public FOURIResolver(FopFactory factory) {
+        this.factory  = factory;
+    }
     
     /**
-     * Called by the processor through {@link FOUserAgent} when it encounters an 
-     * uri in an external-graphic element.
-     * (see also {@link javax.xml.transform.URIResolver#resolve(String, String)}
-     * This resolver will allow URLs without a scheme, i.e. it assumes 'file:' as
-     * the default scheme. It also allows relative URLs with scheme, 
-     * e.g. file:../../abc.jpg which is not strictly RFC compliant as long as the 
-     * scheme is the same as the scheme of the base URL. If the base URL is null 
-     * a 'file:' URL referencing the current directory is used as the base URL.
-     * If the method is successful it will return a Source of type 
-     * {@link javax.xml.transform.stream.StreamSource} with its SystemID set to 
-     * the resolved URL used to open the underlying InputStream.
-     * 
-     * @param href An href attribute, which may be relative or absolute.
-     * @param base The base URI against which the first argument will be made 
-     * absolute if the absolute URI is required. 
-     * @return A {@link javax.xml.transform.Source} object, or null if the href 
-     * cannot be resolved. 
-     * @throws javax.xml.transform.TransformerException Never thrown by this implementation.
-     * @see javax.xml.transform.URIResolver#resolve(String, String)
+     * handles resolve exceptions appropriately
+     * @param errorStr error string
+     * @param strict strict user config
+     * @throws TransformerException
      */
-    public Source resolve(String href, String base)
-        throws javax.xml.transform.TransformerException {
-        
-        //data URLs can be quite long so don't try to build a File (can lead to problems)
+    private void handleException(Exception e, String errorStr, boolean strict)
+    throws TransformerException {
+        if (strict) {
+            throw new TransformerException(errorStr, e);
+        }
+        log.error(e.getMessage());
+    }
+
+    /**
+     * Attempts to return a URL from a given absolute reference
+     * @param href
+     * @param strict
+     * @return
+     * @throws MalformedURLException
+     */
+    public Source resolve(String href, String base) throws TransformerException {        
+        // data URLs can be quite long so don't try to build a File (can lead to problems)
         if (href.startsWith("data:")) {
             return parseDataURI(href);
         }
-        
+
+        // strict user config
+        boolean strict = factory.validateUserConfigStrictly();
+
         URL absoluteURL = null;
-        File f = new File(href);
-        if (f.exists()) {
+        File file = new File(href);
+        if (file.canRead() && file.isFile()) {
             try {
-                absoluteURL = f.toURL();
+                absoluteURL = file.toURL();
             } catch (MalformedURLException mfue) {
-                log.error("Could not convert filename to URL: " + mfue.getMessage()); 
+                handleException(mfue,
+                        "Could not convert filename '" + href + "' to URL", strict);
             }
         } else {
-            URL baseURL = null;
-            try {
-                baseURL = toBaseURL(base);
-            } catch (MalformedURLException mfue) {
-                log.error("Error with base URL \"" + base + "\"): " + mfue.getMessage());
-            }
-            if (baseURL == null) {
-                // We don't have a valid baseURL just use the URL as given
+            // no base provided
+            if (base == null) {
+                // We don't have a valid file protocol based URL
                 try {
                     absoluteURL = new URL(href);
                 } catch (MalformedURLException mue) {
@@ -103,64 +113,78 @@
                         // the href contains only a path then file: is assumed
                         absoluteURL = new URL("file:" + href);
                     } catch (MalformedURLException mfue) {
-                        log.error("Error with URL '" + href + "': " + mue.getMessage());
-                        return null;
+                        handleException(mfue,
+                                "Error with URL '" + href + "'", strict);
                     }
                 }
+
+            // try and resolve from context of base
             } else {
+                URL baseURL = null;
                 try {
-                    /*
-                        This piece of code is based on the following statement in 
-                        RFC2396 section 5.2:
+                    baseURL = new URL(base);
+                } catch (MalformedURLException mfue) {
+                    handleException(mfue, "Error with base URL '" + base + "'", strict);
+                }
 
-                        3) If the scheme component is defined, indicating that the reference
-                           starts with a scheme name, then the reference is interpreted as an
-                           absolute URI and we are done.  Otherwise, the reference URI's
-                           scheme is inherited from the base URI's scheme component.
-
-                           Due to a loophole in prior specifications [RFC1630], some parsers
-                           allow the scheme name to be present in a relative URI if it is the
-                           same as the base URI scheme.  Unfortunately, this can conflict
-                           with the correct parsing of non-hierarchical URI.  For backwards
-                           compatibility, an implementation may work around such references
-                           by removing the scheme if it matches that of the base URI and the
-                           scheme is known to always use the <hier_part> syntax.
-
-                        The URL class does not implement this work around, so we do.
-                    */
-
-                    String scheme = baseURL.getProtocol() + ":";
-                    if (href.startsWith(scheme)) {
-                        href = href.substring(scheme.length());
-                        if ("file:".equals(scheme)) {
-                            int colonPos = href.indexOf(':');
-                            int slashPos = href.indexOf('/');
-                            if (slashPos >= 0 && colonPos >= 0 && colonPos < slashPos) {
-                                href = "/" + href; //Absolute file URL doesn't have a leading slash
-                            }
+                /*
+                 * This piece of code is based on the following statement in
+                 * RFC2396 section 5.2:
+                 * 
+                 * 3) If the scheme component is defined, indicating that the
+                 * reference starts with a scheme name, then the reference is
+                 * interpreted as an absolute URI and we are done. Otherwise,
+                 * the reference URI's scheme is inherited from the base URI's
+                 * scheme component.
+                 * 
+                 * Due to a loophole in prior specifications [RFC1630], some
+                 * parsers allow the scheme name to be present in a relative URI
+                 * if it is the same as the base URI scheme. Unfortunately, this
+                 * can conflict with the correct parsing of non-hierarchical
+                 * URI. For backwards compatibility, an implementation may work
+                 * around such references by removing the scheme if it matches
+                 * that of the base URI and the scheme is known to always use
+                 * the <hier_part> syntax.
+                 * 
+                 * The URL class does not implement this work around, so we do.
+                 */
+                String scheme = baseURL.getProtocol() + ":";
+                if (href.startsWith(scheme)) {
+                    href = href.substring(scheme.length());
+                    if ("file:".equals(scheme)) {
+                        int colonPos = href.indexOf(':');
+                        int slashPos = href.indexOf('/');
+                        if (slashPos >= 0 && colonPos >= 0 && colonPos < slashPos) {
+                            href = "/" + href; // Absolute file URL doesn't
+                                                // have a leading slash
                         }
                     }
+                }
+                try {
                     absoluteURL = new URL(baseURL, href);
                 } catch (MalformedURLException mfue) {
-                    log.error("Error with URL '" + href + "': " + mfue.getMessage());
-                    return null;
+                    handleException(mfue,
+                            "Error with URL; base '" + base + "' " + "href '" + href + "'",
+                            strict);                        
                 }
             }
         }
         
-        String effURL = absoluteURL.toExternalForm();
-        try {
-            URLConnection connection = absoluteURL.openConnection();
-            connection.setAllowUserInteraction(false);
-            connection.setDoInput(true);
-            updateURLConnection(connection, href);
-            connection.connect();
-            return new StreamSource(connection.getInputStream(), effURL);
-        } catch (FileNotFoundException fnfe) {
-            //Note: This is on "debug" level since the caller is supposed to handle this
-            log.debug("File not found: " + effURL);
-        } catch (java.io.IOException ioe) {
-            log.error("Error with opening URL '" + effURL + "': " + ioe.getMessage());
+        if (absoluteURL != null) {
+            String effURL = absoluteURL.toExternalForm();
+            try {
+                URLConnection connection = absoluteURL.openConnection();
+                connection.setAllowUserInteraction(false);
+                connection.setDoInput(true);
+                updateURLConnection(connection, href);
+                connection.connect();
+                return new StreamSource(connection.getInputStream(), effURL);
+            } catch (FileNotFoundException fnfe) {
+                //Note: This is on "debug" level since the caller is supposed to handle this
+                log.debug("File not found: " + effURL);
+            } catch (java.io.IOException ioe) {
+                log.error("Error with opening URL '" + effURL + "': " + ioe.getMessage());
+            }
         }
         return null;
     }
@@ -200,33 +224,10 @@
     }
     
     /**
-     * Returns the base URL as a java.net.URL.
-     * If the base URL is not set a default URL pointing to the
-     * current directory is returned.
-     * @param baseURL the base URL
-     * @returns the base URL as java.net.URL
-     */
-    private URL toBaseURL(String base) throws MalformedURLException {
-        if (base == null) {
-            return new java.io.File("").toURL();
-        }
-        if (!base.endsWith("/")) {
-            // The behavior described by RFC 3986 regarding resolution of relative
-            // references may be misleading for normal users:
-            // file://path/to/resources + myResource.res -> file://path/to/myResource.res
-            // file://path/to/resources/ + myResource.res -> file://path/to/resources/myResource.res
-            // We assume that even when the ending slash is missing, users have the second
-            // example in mind
-            base += "/";
-        }
-        return new URL(base);
-    }
-
-    /**
      * Parses inline data URIs as generated by MS Word's XML export and FO stylesheet.
      * @see <a href="http://www.ietf.org/rfc/rfc2397">RFC 2397</a>
      */
-    private Source parseDataURI(String href) {
+    private StreamSource parseDataURI(String href) {
         int commaPos = href.indexOf(',');
         // header is of the form data:[<mediatype>][;base64]
         String header = href.substring(0, commaPos);
Index: src/java/org/apache/fop/apps/FopFactory.java
===================================================================
--- src/java/org/apache/fop/apps/FopFactory.java	(revision 517602)
+++ src/java/org/apache/fop/apps/FopFactory.java	(working copy)
@@ -26,6 +26,8 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
@@ -39,12 +41,11 @@
 import org.xml.sax.SAXException;
 
 import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.apache.fop.config.FopConfig;
 import org.apache.fop.fo.ElementMapping;
 import org.apache.fop.fo.ElementMappingRegistry;
 import org.apache.fop.hyphenation.HyphenationTreeResolver;
@@ -62,27 +63,6 @@
  */
 public class FopFactory {
     
-    /** Defines the default target resolution (72dpi) for FOP */
-    public static final float DEFAULT_TARGET_RESOLUTION = 72.0f; //dpi
-
-    /** Defines the default source resolution (72dpi) for FOP */
-    private static final float DEFAULT_SOURCE_RESOLUTION = 72.0f; //dpi
-
-    /** Defines the default page-height */
-    private static final String DEFAULT_PAGE_HEIGHT = "11in";
-    
-    /** Defines the default page-width */
-    private static final String DEFAULT_PAGE_WIDTH = "8.26in";
-    
-    /** Defines if FOP should use strict validation for FO and user config */
-    private static final boolean DEFAULT_STRICT_FO_VALIDATION = true;
-
-    /** Defines if FOP should validate the user config strictly */
-    private static final boolean DEFAULT_STRICT_USERCONFIG_VALIDATION = true;
-    
-    /** Defines if FOP should use an alternative rule to determine text indents */
-    private static final boolean DEFAULT_BREAK_INDENT_INHERITANCE = false;
-
     /** logger instance */
     private static Log log = LogFactory.getLog(FopFactory.class);
     
@@ -100,7 +80,7 @@
                 = new ContentHandlerFactoryRegistry();
     
     /** Our default resolver if none is set */
-    private URIResolver foURIResolver = new FOURIResolver();
+    private URIResolver foURIResolver = null;
     
     /** A user settable URI Resolver */
     private URIResolver uriResolver = null;
@@ -108,22 +88,23 @@
     /** The resolver for user-supplied hyphenation patterns */
     private HyphenationTreeResolver hyphResolver;
     
+    /** Image factory for creating fop image objects */
     private ImageFactory imageFactory = new ImageFactory();
 
-    /** user configuration */
-    private Configuration userConfig = null;
-
+    /** Configuration layer used to configure fop */
+    private FopConfig config = null;
+    
     /**
      *  The base URL for all URL resolutions, especially for
      *  external-graphics.
      */
-    private String baseURL;
+    private String base = null;
 
     /** The base URL for all font URL resolutions. */
-    private String fontBaseURL;
+    private String fontBase = null;
 
     /** The base URL for all hyphen URL resolutions. */
-    private String hyphenBaseURL;
+    private String hyphenBase = null;
 
     /**
      * FOP has the ability, for some FO's, to continue processing even if the
@@ -131,32 +112,35 @@
      * behavior for FOP.  However, this flag, if set, provides the user the
      * ability for FOP to halt on all content model violations if desired.
      */ 
-    private boolean strictFOValidation = DEFAULT_STRICT_FO_VALIDATION;
+    private boolean strictFOValidation = FopConfig.DEFAULT_STRICT_FO_VALIDATION;
 
     /**
      * FOP will validate the contents of the user configuration strictly
      * (e.g. base-urls and font urls/paths).
      */
-    private boolean strictUserConfigValidation = DEFAULT_STRICT_USERCONFIG_VALIDATION;
-    
+    private boolean strictUserConfigValidation = FopConfig.DEFAULT_STRICT_USERCONFIG_VALIDATION;
+
+    /** Cache font info/font file triplet detection */
+    private boolean cacheFonts = FopConfig.DEFAULT_CACHE_FONT_INFO;
+
     /** Allows enabling kerning on the base 14 fonts, default is false */
     private boolean enableBase14Kerning = false;
     
     /** Source resolution in dpi */
-    private float sourceResolution = DEFAULT_SOURCE_RESOLUTION;
+    private float sourceResolution = FopConfig.DEFAULT_SOURCE_RESOLUTION;
 
     /** Target resolution in dpi */
-    private float targetResolution = DEFAULT_TARGET_RESOLUTION;
+    private float targetResolution = FopConfig.DEFAULT_TARGET_RESOLUTION;
 
     /** Page height */
-    private String pageHeight = DEFAULT_PAGE_HEIGHT;
+    private String pageHeight = FopConfig.DEFAULT_PAGE_HEIGHT;
     
     /** Page width */
-    private String pageWidth = DEFAULT_PAGE_WIDTH;
+    private String pageWidth = FopConfig.DEFAULT_PAGE_WIDTH;
 
     /** @see #setBreakIndentInheritanceOnReferenceAreaBoundary(boolean) */
     private boolean breakIndentInheritanceOnReferenceAreaBoundary
-        = DEFAULT_BREAK_INDENT_INHERITANCE;
+        = FopConfig.DEFAULT_BREAK_INDENT_INHERITANCE;
 
     /** Optional overriding LayoutManagerMaker */
     private LayoutManagerMaker lmMakerOverride = null;
@@ -170,7 +154,9 @@
      * Main constructor.
      */
     protected FopFactory() {
+        this.config = new FopConfig(this);
         this.elementMappingRegistry = new ElementMappingRegistry(this);
+        this.foURIResolver = new FOURIResolver(this);
         // Use a synchronized Map - I am not really sure this is needed, but better safe than sorry.
         this.colorSpaceMap = Collections.synchronizedMap(new java.util.HashMap());
     }
@@ -336,11 +322,42 @@
     }
 
     /**
+     * cleans the base url
+     * @param base
+     * @return
+     * @throws MalformedURLException
+     * @throws URISyntaxException 
+     */
+    private String checkBaseURL(String base) throws MalformedURLException {
+        if (!base.endsWith("/")) {
+            // The behavior described by RFC 3986 regarding resolution of relative
+            // references may be misleading for normal users:
+            // file://path/to/resources + myResource.res -> file://path/to/myResource.res
+            // file://path/to/resources/ + myResource.res -> file://path/to/resources/myResource.res
+            // We assume that even when the ending slash is missing, users have the second
+            // example in mind
+            base += "/";
+        }
+        File dir = new File(base);
+        try {
+            base = (dir.isDirectory() ? dir.toURL() : new URL(base)).toExternalForm(); 
+        } catch (MalformedURLException mfue) {
+            if (strictUserConfigValidation) {
+                throw mfue;
+            }
+            log.error(mfue.getMessage());
+        }
+        return base;
+    }
+    
+    /**
      * Sets the base URL.
-     * @param baseURL base URL
+     * @param base base URL
+     * @throws MalformedURLException 
+     * @throws URISyntaxException 
      */
-    void setBaseURL(String baseURL) {
-        this.baseURL = baseURL;
+    public void setBaseURL(String base) throws MalformedURLException {
+        this.base = checkBaseURL(base);
     }
 
     /**
@@ -348,42 +365,46 @@
      * @return the base URL
      */
     public String getBaseURL() {
-        return this.baseURL;
+        return this.base;
     }
-
+    
     /**
      * Sets the font base URL.
-     * @param fontBaseURL font base URL
+     * @param fontBase font base URL
+     * @throws MalformedURLException 
+     * @throws URISyntaxException 
      */
-    public void setFontBaseURL(String fontBaseURL) {
-        this.fontBaseURL = fontBaseURL;
+    public void setFontBaseURL(String fontBase) throws MalformedURLException {
+        this.fontBase = checkBaseURL(fontBase);
     }
 
     /** @return the font base URL */
     public String getFontBaseURL() {
-        return this.fontBaseURL;
+        return this.fontBase;
     }
 
     /** @return the hyphen base URL */
     public String getHyphenBaseURL() {
-        return hyphenBaseURL;
+        return this.hyphenBase;
     }
 
     /**
      * Sets the hyphen base URL.
-     * @param hyphenBaseURL hythen base URL
-     */
-    public void setHyphenBaseURL(final String hyphenBaseURL) {
-        if (hyphenBaseURL != null) {
+     * @param hyphenBase hythen base URL
+     * @throws MalformedURLException 
+     * @throws URISyntaxException 
+     * */
+    public void setHyphenBaseURL(final String hyphenBase) throws MalformedURLException {
+        if (hyphenBase != null) {
             this.hyphResolver = new HyphenationTreeResolver() {
                 public Source resolve(String href) {
-                    return resolveURI(href, hyphenBaseURL);
+                    return resolveURI(href, hyphenBase);
                 }
             };
         }
-        this.hyphenBaseURL = hyphenBaseURL;
+        this.hyphenBase = checkBaseURL(hyphenBase);
     }
-
+    
     /**
      * Sets the URI Resolver. It is used for resolving factory-level URIs like hyphenation
      * patterns and as backup for URI resolution performed during a rendering run. 
@@ -483,8 +504,6 @@
      */
     public void setSourceResolution(float dpi) {
         this.sourceResolution = dpi;
-        log.info("source-resolution set to: " + sourceResolution 
-                + "dpi (px2mm=" + getSourcePixelUnitToMillimeter() + ")");
     }
 
     /** @return the resolution for resolution-dependant output */
@@ -538,7 +557,6 @@
      */
     public void setPageHeight(String pageHeight) {
         this.pageHeight = pageHeight;
-        log.info("Default page-height set to: " + pageHeight);
     }
     
     /**
@@ -559,7 +577,6 @@
      */
     public void setPageWidth(String pageWidth) {
         this.pageWidth = pageWidth;
-        log.info("Default page-width set to: " + pageWidth);
     }
     
     /**
@@ -595,7 +612,7 @@
     public Set getIgnoredNamespace() {
         return Collections.unmodifiableSet(this.ignoredNamespaces);
     }
-    
+
     //------------------------------------------- Configuration stuff
     
     /**
@@ -605,14 +622,9 @@
      * @throws SAXException if a parsing error occurs
      */
     public void setUserConfig(File userConfigFile) throws SAXException, IOException {
-        try {
-            DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
-            setUserConfig(cfgBuilder.buildFromFile(userConfigFile));
-        } catch (ConfigurationException e) {
-            throw new FOPException(e);
-        }
+        config.setUserConfig(userConfigFile);
     }
-    
+
     /**
      * Set the user configuration from an URI.
      * @param uri the URI to the configuration file
@@ -620,12 +632,7 @@
      * @throws SAXException if a parsing error occurs
      */
     public void setUserConfig(String uri) throws SAXException, IOException {
-        try {
-            DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
-            setUserConfig(cfgBuilder.build(uri));
-        } catch (ConfigurationException e) {
-            throw new FOPException(e);
-        }
+        config.setUserConfig(uri);
     }
     
     /**
@@ -634,12 +641,7 @@
      * @throws FOPException if a configuration problem occurs 
      */
     public void setUserConfig(Configuration userConfig) throws FOPException {
-        this.userConfig = userConfig;
-        try {
-            configure(userConfig);
-        } catch (ConfigurationException e) {            
-            throw new FOPException(e);
-        }
+        config.setUserConfig(userConfig);
     }
 
     /**
@@ -647,160 +649,57 @@
      * @return the user configuration
      */
     public Configuration getUserConfig() {
-        return userConfig;
+        return config.getUserConfig();
     }
 
     /**
-     * Returns the configuration subtree for a specific renderer.
-     * @param mimeType MIME type of the renderer
-     * @return the requested configuration subtree, null if there's no configuration
+     * Is the user configuration to be validated?
+     * @param strictUserConfigValidation strict user config validation
      */
-    public Configuration getUserRendererConfig(String mimeType) {
-        if (userConfig == null || mimeType == null) {
-            return null;
-        }
-        
-        Configuration userRendererConfig = null;
+    public void setStrictUserConfigValidation(boolean strictUserConfigValidation) {
+        this.strictUserConfigValidation = strictUserConfigValidation;
+    }
 
-        Configuration[] cfgs
-            = userConfig.getChild("renderers").getChildren("renderer");
-        for (int i = 0; i < cfgs.length; ++i) {
-            Configuration child = cfgs[i];
-            try {
-                if (child.getAttribute("mime").equals(mimeType)) {
-                    userRendererConfig = child;
-                    break;
-                }
-            } catch (ConfigurationException e) {
-                // silently pass over configurations without mime type
-            }
-        }
-        log.debug((userRendererConfig == null ? "No u" : "U")
-                  + "ser configuration found for MIME type " + mimeType);
-        return userRendererConfig;
+    /**
+     * Is the user configuration to be validated?
+     * @return if the user configuration should be validated
+     */
+    public boolean validateUserConfigStrictly() {
+        return this.strictUserConfigValidation;
     }
 
+    //------------------------------------------- Cache related stuff
+
     /**
-     * Initializes user agent settings from the user configuration
-     * file, if present: baseURL, resolution, default page size,...
-     * 
-     * @throws ConfigurationException when there is an entry that 
-     *          misses the required attribute
-     * Configures the FopFactory.
-     * @param cfg Avalon Configuration Object
-     * @see org.apache.avalon.framework.configuration.Configurable
+     * Cache results of font triplet detection/auto-config?
+     * @param cacheFonts
      */
-    public void configure(Configuration cfg) throws ConfigurationException {        
-        log.info("Initializing FopFactory Configuration");        
-        
-        if (cfg.getChild("strict-configuration", false) != null) {
-            this.strictUserConfigValidation
-                    = cfg.getChild("strict-configuration").getValueAsBoolean();
-        }
-        if (cfg.getChild("strict-validation", false) != null) {
-            this.strictFOValidation = cfg.getChild("strict-validation").getValueAsBoolean();
-        }
-        if (cfg.getChild("base", false) != null) {
-            try {
-                setBaseURL(getBaseURLfromConfig(cfg, "base"));
-            } catch (ConfigurationException e) {
-                if (strictUserConfigValidation) {
-                    throw e;
-                }
-                log.error(e.getMessage());
-            }
-        }
-        if (cfg.getChild("font-base", false) != null) {
-            try {
-                setFontBaseURL(getBaseURLfromConfig(cfg, "font-base"));
-            } catch (ConfigurationException e) {
-                if (strictUserConfigValidation) {
-                    throw e;
-                }
-                log.error(e.getMessage());
-            }
-        }
-        if (cfg.getChild("hyphenation-base", false) != null) {
-            try {
-                setHyphenBaseURL(getBaseURLfromConfig(cfg, "hyphenation-base"));
-            } catch (ConfigurationException e) {
-                if (strictUserConfigValidation) {
-                    throw e;
-                }
-                log.error(e.getMessage());
-            }
-        }
-        if (cfg.getChild("source-resolution", false) != null) {
-            setSourceResolution(
-                    cfg.getChild("source-resolution").getValueAsFloat(DEFAULT_SOURCE_RESOLUTION));
-        }
-        if (cfg.getChild("target-resolution", false) != null) {
-            setTargetResolution(
-                    cfg.getChild("target-resolution").getValueAsFloat(DEFAULT_TARGET_RESOLUTION));
-        }
-        if (cfg.getChild("break-indent-inheritance", false) != null) {
-            setBreakIndentInheritanceOnReferenceAreaBoundary(
-                    cfg.getChild("break-indent-inheritance").getValueAsBoolean());
-        }        
-        Configuration pageConfig = cfg.getChild("default-page-settings");
-        if (pageConfig.getAttribute("height", null) != null) {
-            setPageHeight(pageConfig.getAttribute("height", DEFAULT_PAGE_HEIGHT));
-        }
-        if (pageConfig.getAttribute("width", null) != null) {
-            setPageWidth(pageConfig.getAttribute("width", DEFAULT_PAGE_WIDTH));
-        }
+    public void setCacheFonts(boolean cacheFonts) {
+        this.cacheFonts = cacheFonts;
     }
 
     /**
-     * Retrieves and verifies a base URL.
-     * @param cfg The Configuration object to retrieve the base URL from
-     * @param name the element name for the base URL
-     * @return the requested base URL or null if not available
-     * @throws ConfigurationException 
-     */    
-    public static String getBaseURLfromConfig(Configuration cfg, String name)
-    throws ConfigurationException {
-        if (cfg.getChild(name, false) != null) {
-            try {
-                String cfgBasePath = cfg.getChild(name).getValue(null);
-                if (cfgBasePath != null) {
-                    // Is the path a dirname?
-                    File dir = new File(cfgBasePath);
-//                    if (!dir.exists()) {
-//                        throw new ConfigurationException("Base URL '" + name
-//                                + "' references non-existent resource '"
-//                                + cfgBasePath + "'");
-//                    } else if (dir.isDirectory()) {
-                    if (dir.isDirectory()) {
-                        // Yes, convert it into a URL
-                        cfgBasePath = dir.toURL().toExternalForm(); 
-                    }
-                    // Otherwise, this is already a URL
-                }
-                log.info(name + " set to: " + cfgBasePath);
-                return cfgBasePath;
-            } catch (MalformedURLException mue) {
-                throw new ConfigurationException("Base URL '" + name
-                        + "' in user config is malformed!");
-            }
-        }
-        return null;
+     * Cache results of font triplet detection/auto-config?
+     * @param cacheFonts
+     */
+    public boolean cacheFonts() {
+        return this.cacheFonts;
     }
 
     /**
-     * Is the user configuration to be validated?
-     * @param strictUserConfigValidation strict user config validation
+     * Sets the cache file
+     * @param cacheFile
      */
-    public void setStrictUserConfigValidation(boolean strictUserConfigValidation) {
-        this.strictUserConfigValidation = strictUserConfigValidation;
+    public void setCacheFile(String cacheFile) {
+        setCacheFile(new File(cacheFile));
     }
 
     /**
-     * Is the user configuration to be validated?
-     * @return if the user configuration should be validated
+     * Sets the cache file
+     * @param cacheFile
      */
-    public boolean validateUserConfigStrictly() {
-        return this.strictUserConfigValidation;
+    public void setCacheFile(File cacheFile) {
+        config.setCacheFile(cacheFile);
     }
 
     //------------------------------------------- URI resolution
@@ -824,6 +723,9 @@
                 source = uriResolver.resolve(uri, base);
             } catch (TransformerException te) {
                 log.error("Attempt to resolve URI '" + uri + "' failed: ", te);
+                if (validateUserConfigStrictly()) {
+                    return null;
+                }
             }
         }
         if (source == null) {
@@ -893,5 +795,5 @@
                     + iccProfileSrc);
         }
         return colorSpace;
-    }
-}
+    }    
+}
\ No newline at end of file
Index: src/java/org/apache/fop/cli/CommandLineOptions.java
===================================================================
--- src/java/org/apache/fop/cli/CommandLineOptions.java	(revision 517602)
+++ src/java/org/apache/fop/cli/CommandLineOptions.java	(working copy)
@@ -78,6 +78,8 @@
     private Boolean suppressLowLevelAreas = Boolean.FALSE;
     /* user configuration file */
     private File userConfigFile = null;
+    /* cache file */
+    private File cacheFile = null;
     /* input fo file */
     private File fofile = null;
     /* xsltfile (xslt transformation as input) */
@@ -143,8 +145,8 @@
                     dumpConfiguration();
                 }
                 checkSettings();
-                createUserConfig();
-                
+                setUserConfig();
+                setCacheFile();
                 //Factory config is set up, now we can create the user agent
                 foUserAgent = factory.newFOUserAgent();
                 foUserAgent.getRendererOptions().putAll(renderingOptions);
@@ -229,6 +231,8 @@
                 showConfiguration = Boolean.TRUE;
             } else if (args[i].equals("-c")) {
                 i = i + parseConfigurationOption(args, i);
+            } else if (args[i].equals("-cache")) {
+                i = i + parseCacheOption(args, i);
             } else if (args[i].equals("-l")) {
                 i = i + parseLanguageOption(args, i);
             } else if (args[i].equals("-s")) {
@@ -333,6 +337,17 @@
         }
     }
 
+    private int parseCacheOption(String[] args, int i) throws FOPException {
+        if ((i + 1 == args.length)
+                || (args[i + 1].charAt(0) == '-')) {
+            throw new FOPException("if you use '-cache', you must specify "
+              + "the name of the cache file");
+        } else {
+            cacheFile = new File(args[i + 1]);
+            return 1;
+        }
+    }
+
     private int parseLanguageOption(String[] args, int i) throws FOPException {
         if ((i + 1 == args.length)
                 || (args[i + 1].charAt(0) == '-')) {
@@ -772,11 +787,11 @@
     }    // end checkSettings
 
     /**
-     * Create the user configuration.
+     * Set the user configuration.
      * @throws FOPException if creating the user configuration fails
      * @throws IOException
      */
-    private void createUserConfig() throws FOPException, IOException {
+    private void setUserConfig() throws FOPException, IOException {
         if (userConfigFile == null) {
             return;
         }
@@ -788,6 +803,18 @@
      }
 
     /**
+     * Create the cache.
+     * @throws FOPException if creating the cache fails
+     * @throws IOException
+     */
+    private void setCacheFile() throws FOPException, IOException {
+        if (cacheFile == null) {
+            return;
+        }
+        factory.setCacheFile(cacheFile);
+    }
+
+    /**
      * @return the chosen output format (MIME type)
      * @throws FOPException for invalid output formats
      */
@@ -914,7 +941,8 @@
             + "  -noedit           PDF file will be encrypted without edit content permission\n"
             + "  -noannotations    PDF file will be encrypted without edit annotation permission\n"
             + "  -pdfprofile prof  PDF file will be generated with the specified profile\n"
-            + "                    (Examples for prof: PDF/A-1b or PDF/X-3:2003)\n\n"
+            + "                    (Examples for prof: PDF/A-1b or PDF/X-3:2003)\n"
+            + "  -cache xx.xconf   use fop cache file xx.xconf (when cache-fonts set)\n\n"
             + " [INPUT]  \n"
             + "  infile            xsl:fo input file (the same as the next) \n"
             + "  -fo  infile       xsl:fo input file  \n"
Index: src/java/org/apache/fop/area/AreaTreeParser.java
===================================================================
--- src/java/org/apache/fop/area/AreaTreeParser.java	(revision 517602)
+++ src/java/org/apache/fop/area/AreaTreeParser.java	(working copy)
@@ -977,7 +977,7 @@
                         if (fontName != null) {
                             String fontStyle = attributes.getValue("font-style");
                             int fontWeight = getAttributeAsInteger(
-                                    attributes, "font-weight", Font.NORMAL);
+                                    attributes, "font-weight", Font.WEIGHT_NORMAL);
                             area.addTrait(trait, 
                                     FontInfo.createFontKey(fontName, fontStyle, fontWeight));
                         }
Index: src/java/org/apache/fop/pdf/PDFFilterList.java
===================================================================
--- src/java/org/apache/fop/pdf/PDFFilterList.java	(revision 517602)
+++ src/java/org/apache/fop/pdf/PDFFilterList.java	(working copy)
@@ -24,14 +24,6 @@
 import java.util.List;
 import java.util.Map;
 
-// commons logging
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-// Avalon
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
 /**
  * This class represents a list of PDF filters to be applied when serializing 
  * the output of a PDF object.
@@ -56,13 +48,8 @@
     private List filters = new java.util.ArrayList();
 
     private boolean ignoreASCIIFilters = false;
-    
+        
     /**
-     * logging instance
-     */
-    protected static Log logger = LogFactory.getLog("org.apache.fop.render");
-    
-    /**
      * Default constructor.
      * <p>
      * The flag for ignoring ASCII filters defaults to false.
@@ -290,53 +277,4 @@
         }
         return out;
     }
-
-    /**
-     * Builds a filter map from an Avalon Configuration object.
-     * @param cfg the Configuration object
-     * @return Map the newly built filter map
-     * @throws ConfigurationException if a filter list is defined twice
-     */
-    public static Map buildFilterMapFromConfiguration(Configuration cfg) 
-                throws ConfigurationException {
-        Map filterMap = new java.util.HashMap();
-        Configuration[] filterLists = cfg.getChildren("filterList");
-        for (int i = 0; i < filterLists.length; i++) {
-            Configuration filters = filterLists[i];
-            String type = filters.getAttribute("type", null);
-            Configuration[] filt = filters.getChildren("value");
-            List filterList = new java.util.ArrayList();
-            for (int j = 0; j < filt.length; j++) {
-                String name = filt[j].getValue();
-                filterList.add(name);
-            }
-            
-            if (type == null) {
-                type = PDFFilterList.DEFAULT_FILTER;
-            }
-
-            if (!filterList.isEmpty() && logger.isDebugEnabled()) {
-                StringBuffer debug = new StringBuffer("Adding PDF filter");
-                if (filterList.size() != 1) {
-                    debug.append("s");
-                }
-                debug.append(" for type ").append(type).append(": ");
-                for (int j = 0; j < filterList.size(); j++) {
-                    if (j != 0) {
-                        debug.append(", ");
-                    }
-                    debug.append(filterList.get(j));
-                }
-                logger.debug(debug.toString());
-            }
-            
-            if (filterMap.get(type) != null) {
-                throw new ConfigurationException("A filterList of type '" 
-                    + type + "' has already been defined");
-            }
-            filterMap.put(type, filterList);
-        }
-        return filterMap;                
-    }
-
 }
Index: src/java/org/apache/fop/util/FileUtil.java
===================================================================
--- src/java/org/apache/fop/util/FileUtil.java	(revision 0)
+++ src/java/org/apache/fop/util/FileUtil.java	(revision 0)
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.util;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.fop.apps.FOPException;
+
+public class FileUtil {
+
+    /**
+     * 
+     * @param file
+     * @throws FOPException
+     */
+    public static boolean validFile(File file) throws FOPException {
+        if (!file.isFile()) {
+            throw new FOPException( "'" + file.getAbsolutePath() + "' is not a file!");
+        }
+        if (!file.canRead()) {
+            throw new FOPException("Unable to read '" + file.getAbsolutePath() + "'");            
+        }
+        if (!file.canWrite()) {
+            throw new FOPException("Unable to write '" + file.getAbsolutePath() + "'");            
+        }
+        return true;
+    }
+
+    /**
+     * Checks a given directory to determine if it is valid
+     * 
+     * @param dir directory File to test 
+     * @param log log errors 
+     * @return if directory is valid or not
+     */
+    public static boolean validDirectory(File dir) {
+        return validDirectory(dir, null);
+    }
+
+    /**
+     * Checks a given directory to determine if it is valid
+     * 
+     * @param dir directory File to test 
+     * @param log log errors 
+     * @return if directory is valid or not
+     */
+    public static boolean validDirectory(File dir, Log log) {
+        if (!dir.exists()) {
+            if (log != null ) {
+                log.error("'" + dir + "' does not exist");
+            }
+            return false;
+        }
+        if (!dir.canRead()) {
+            if (log != null ) {
+                log.error("Unable to read '" + dir.getAbsolutePath() + "'");
+            }
+            return false;
+        }
+        if (!dir.isDirectory()) {
+            if (log != null) {
+                log.error("'" + dir + "' is not a directory");
+            }
+            return false;
+        }
+        return true;
+    }
+}

Property changes on: src\java\org\apache\fop\util\FileUtil.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/java/org/apache/fop/util/LogUtil.java
===================================================================
--- src/java/org/apache/fop/util/LogUtil.java	(revision 0)
+++ src/java/org/apache/fop/util/LogUtil.java	(revision 0)
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.fop.apps.FOPException;
+
+/**
+ * Utility methods used in the application 
+ * @author Adrian Cumiskey
+ */
+public class LogUtil {
+
+    /**
+     * convenience method that handles any error appropriately
+     * @param log 
+     * @param errorStr error string
+     * @param strict validate strictly
+     * @throws FOPException fop exception
+     */
+    public static void handleError(Log log, String errorStr, boolean strict) throws FOPException {
+        handleException(log, new FOPException(errorStr), strict);
+    }
+
+    /**
+     * convenience method that handles any error appropriately
+     * @param e exception
+     * @param strict validate strictly
+     * @throws FOPException fop exception
+     */
+    public static void handleException(Log log, Exception e, boolean strict) throws FOPException {
+        if (strict) {
+            if (e instanceof FOPException) {
+                throw (FOPException)e;
+            }
+            throw new FOPException(e);
+        }
+        log.error(e.getMessage());
+    }
+}

Property changes on: src\java\org\apache\fop\util\LogUtil.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: src/documentation/content/xdocs/trunk/fonts.xml
===================================================================
--- src/documentation/content/xdocs/trunk/fonts.xml	(revision 517602)
+++ src/documentation/content/xdocs/trunk/fonts.xml	(working copy)
@@ -24,6 +24,7 @@
     <authors>
       <person name="Jeremias Märki" email=""/>
       <person name="Tore Engvig" email=""/>
+      <person name="Adrian Cumiskey" email=""/>
     </authors>
   </header>
   <body>
@@ -129,8 +130,7 @@
 More information about fonts can be found at:</p>
       <ul>
         <li><a href="http://partners.adobe.com/asn/developer/type/ftypes.html">Adobe font types</a></li>
-        <li><a href="http://partners.adobe.com/asn/developer/technotes/fonts.html">Adobe Font Technote</a>
-</li>
+        <li><a href="http://partners.adobe.com/asn/developer/technotes/fonts.html">Adobe Font Technote</a></li>
       </ul>
       <section id="type1-metrics">
         <title>Type 1 Font Metrics</title>
@@ -236,10 +236,24 @@
       <section id="register">
         <title>Register Fonts with FOP</title>
         <p>You must tell FOP how to find and use the font metrics files by registering them in the <a href="configuration.html">FOP Configuration</a>. Add entries for your custom fonts, regardless of font type, to the configuration file in a manner similar to the following:</p>
-        <source><![CDATA[<font metrics-url="file:///C:/myfonts/FTL_____.xml" kerning="yes"
+        <source><![CDATA[
+<fonts>
+  <!-- register a particular font -->
+  <font metrics-url="file:///C:/myfonts/FTL_____.xml" kerning="yes"
       embed-url="file:///C:/myfonts/FTL_____.pfb">
-  <font-triplet name="FrutigerLight" style="normal" weight="normal"/>
-</font>]]></source>
+     <font-triplet name="FrutigerLight" style="normal" weight="normal"/>
+  </font>
+  
+  <!-- register all the fonts found in a directory -->
+  <directory>C:\MyFonts1</directory>
+  
+  <!-- register all the fonts found in a directory
+       and all of its sub directories (use with care) -->
+  <directory recursive="true">C:\MyFonts2</directory>
+
+  <!-- automatically detect operating system installed fonts -->
+  <auto-detect/>  
+</fonts>]]></source>
         <note>Review the documentation for <a href="configuration.html">FOP Configuration</a> for instructions on making the FOP configuration available to FOP when it runs. Otherwise, FOP has no way of finding your custom font information.</note>
         <ul>
           <li>
@@ -247,8 +261,14 @@
             Relative URLs are resolved relative to the font-base property (or base) if available.
             See <a href="configuration.html">FOP: Configuration</a> for more information.
           </li>
-          <li>The "kerning" and "embed-url" attributes are optional. Kerning is currently not used at all. If embedding is off, the output will position the text correctly (from the metrics file), but it will not be displayed or printed correctly unless the viewer has the applicable font available to their local system.</li>
-          <li>When setting the embed-url attribute for Type 1 fonts, be sure to specify the PFB (actual font data), not PFM (font metrics) file that you used to generate the XML font metrics file.</li>
+          <li>Either an "embed-url" or a "metrics-url" must be specified for font tag configurations.</li>
+          <li>The font "kerning" attribute is optional. Kerning is currently not used at all.</li>
+	      <li>If embedding is off, the output will position the text correctly (from the metrics file), but it will not be displayed or printed correctly unless the viewer has the applicable font available to their local system.</li>
+          <li>When setting the "embed-url" attribute for Type 1 fonts, be sure to specify the PFB (actual font data), not PFM (font metrics) file that you used to generate the XML font metrics file.</li>
+          <li>The fonts "directory" tag can be used to register fonts contained within a single or list of directory paths.  The "recursive" attribute can be specified to recursively add fonts from all sub directories.</li>
+          <li>The fonts "auto-detect" tag can be used to automatically register fonts that are found to be installed on the native operating system.</li>
+          <li>Fonts registered with "font" tag configurations override fonts found by means of "directory" tag definitions.</li>
+          <li>Fonts found as a result of a "directory" tag configuration override fonts found as a result of the "auto-detect" tag being specified.</li>
         </ul>
         <!--note>Cocoon users will need to setup the config, see FOPSerializer for more information.</note-->
       </section>
@@ -276,7 +296,7 @@
 See <a href="#ttf-encoding">Table of TTF Encoding Options</a> for more details.</p>
       </section>
       <section id="embedding-base14">
-        <title>Explicitely embedding the base 14 fonts</title>
+        <title>Explicitly embedding the base 14 fonts</title>
         <p>
           There are cases where you might want to force the embedding of one or more of the base 14 fonts that
           can normally be considered available on the target platform (viewer, printer). One of these cases is
Index: src/documentation/content/xdocs/trunk/configuration.xml
===================================================================
--- src/documentation/content/xdocs/trunk/configuration.xml	(revision 517602)
+++ src/documentation/content/xdocs/trunk/configuration.xml	(working copy)
@@ -152,6 +152,24 @@
         <td>"height" 11 inches, "width" 8.26 inches</td>
       </tr>
       <tr>
+        <td>cache-fonts</td>
+        <td>boolean (true, false)</td>
+        <td>All fonts information that has been gathered as a result of "directory"
+        or "auto-detect" font configurations will be cached for future rendering runs.
+        This setting should improve performance on systems where
+        fonts have been configured using the "directory" or "auto-detect" tag mechanisms.
+        By default this option is switched on.</td>
+        <td>true</td>
+      </tr>
+      <tr>
+        <td>cache-file</td>
+        <td>String</td>
+        <td>This options specifies the file/directory path of the fop cache file.
+        This option can also be specified on the command-line using the -cache option.
+        This file is currently only used to cache font triplet information for future reference.</td>
+        <td>${base}/conf/fop.cache</td>
+      </tr>
+      <tr>
         <td>renderers</td>
         <td>(see text below)</td>
         <td>Contains the configuration for each renderer. See below.</td>
Index: test/test.xconf
===================================================================
--- test/test.xconf	(revision 517602)
+++ test/test.xconf	(working copy)
@@ -1,5 +1,9 @@
 <?xml version="1.0"?>
 <fop version="1.0">
+
+  <!-- Switch off font caching for the purposes of unit testing -->
+  <cache-fonts>false</cache-fonts>
+  
   <renderers>
     <renderer mime="application/pdf">
       <fonts>
Index: test/config/test_fonts_directory_recursive.xconf
===================================================================
--- test/config/test_fonts_directory_recursive.xconf	(revision 0)
+++ test/config/test_fonts_directory_recursive.xconf	(revision 0)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+      	<directory recursive="true">test/resources/fonts</directory>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
\ No newline at end of file

Property changes on: test\config\test_fonts_directory_recursive.xconf
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/config/test_fonts_autodetect.xconf
===================================================================
--- test/config/test_fonts_autodetect.xconf	(revision 0)
+++ test/config/test_fonts_autodetect.xconf	(revision 0)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+      	<auto-detect/>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
\ No newline at end of file

Property changes on: test\config\test_fonts_autodetect.xconf
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/config/test_fonts_directory_bad.xconf
===================================================================
--- test/config/test_fonts_directory_bad.xconf	(revision 0)
+++ test/config/test_fonts_directory_bad.xconf	(revision 0)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+     	<directory>doesnotexist</directory>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>

Property changes on: test\config\test_fonts_directory_bad.xconf
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/config/test_embedurl_bad.xconf
===================================================================
--- test/config/test_embedurl_bad.xconf	(revision 517602)
+++ test/config/test_embedurl_bad.xconf	(working copy)
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<fop version="1.0">
-  <!-- Strict configuration On -->
-  <strict-configuration>true</strict-configuration>
-
-  <!-- Base URL for resolving relative URLs -->
-  <base>./</base>
-
-  <!-- Font Base URL for resolving relative font URLs -->
-  <font-base>./</font-base>
-  
-  <renderers>
-    <renderer mime="application/pdf">
-      <fonts>
-		<!-- this font has an embed-url that does not exist on filesystem -->
-		<font metrics-url="test/resources/fonts/glb12.ttf.xml" embed-url="test/resources/fonts/doesnotexist.ttf">
-          <font-triplet name="Gladiator-Ansi" style="normal" weight="normal"/>
-        </font>
-      </fonts>
-    </renderer>
-  </renderers>
-</fop>
Index: test/config/test_embedurl_malformed.xconf
===================================================================
--- test/config/test_embedurl_malformed.xconf	(revision 517602)
+++ test/config/test_embedurl_malformed.xconf	(working copy)
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<fop version="1.0">
-  <!-- Strict configuration On -->
-  <strict-configuration>true</strict-configuration>
-
-  <!-- Base URL for resolving relative URLs -->
-  <base>./</base>
-
-  <!-- Font Base URL for resolving relative font URLs -->
-  <font-base>./</font-base>
-  
-  <renderers>
-    <renderer mime="application/pdf">
-      <fonts>
-		<!-- this font has a malformed embed-url -->
-		<font metrics-url="test/resources/fonts/glb12.ttf.xml" embed-url="badprotocol:test/resources/fonts/glb12.ttf">
-          <font-triplet name="Gladiator-Ansi" style="normal" weight="normal"/>
-        </font>
-      </fonts>
-    </renderer>
-  </renderers>
-</fop>
Index: test/config/test_font_attributes_missing.xconf
===================================================================
--- test/config/test_font_attributes_missing.xconf	(revision 0)
+++ test/config/test_font_attributes_missing.xconf	(revision 0)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+		<!-- this font is without a metrics-url -->
+		<font>
+          <font-triplet name="Gladiator" style="normal" weight="normal"/>
+        </font>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
Index: test/config/test_font_metricsurl_bad.xconf
===================================================================
--- test/config/test_font_metricsurl_bad.xconf	(revision 0)
+++ test/config/test_font_metricsurl_bad.xconf	(revision 0)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+  
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+		<!-- this font has a metrics-url that does not exist on filesystem -->
+        <font metrics-url="test/resources/fonts/doesnotexist.ttf.ansi.xml">
+          <font-triplet name="Gladiator-Ansi" style="normal" weight="normal"/>
+        </font>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
Index: test/config/test_font_metricsurl_malformed.xconf
===================================================================
--- test/config/test_font_metricsurl_malformed.xconf	(revision 0)
+++ test/config/test_font_metricsurl_malformed.xconf	(revision 0)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+  
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+		<!-- this font has a malformed metrics-url -->
+        <font metrics-url="badprotocol:test/resources/fonts/glb12.ttf.xml">
+          <font-triplet name="Gladiator" style="normal" weight="normal"/>
+        </font>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
Index: test/config/test_fontattributes_missing.xconf
===================================================================
--- test/config/test_fontattributes_missing.xconf	(revision 517602)
+++ test/config/test_fontattributes_missing.xconf	(working copy)
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<fop version="1.0">
-  <!-- Strict configuration On -->
-  <strict-configuration>true</strict-configuration>
-
-  <!-- Base URL for resolving relative URLs -->
-  <base>./</base>
-
-  <!-- Font Base URL for resolving relative font URLs -->
-  <font-base>./</font-base>
-  
-  <renderers>
-    <renderer mime="application/pdf">
-      <fonts>
-		<!-- this font is without a metrics-url -->
-		<font>
-          <font-triplet name="Gladiator" style="normal" weight="normal"/>
-        </font>
-      </fonts>
-    </renderer>
-  </renderers>
-</fop>
Index: test/config/test_font_tripletattribute_missing.xconf
===================================================================
--- test/config/test_font_tripletattribute_missing.xconf	(revision 0)
+++ test/config/test_font_tripletattribute_missing.xconf	(revision 0)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+        <font metrics-url="test/resources/fonts/glb12.ttf.xml">
+		  <!-- this font-triplet has a missing style attribute -->           
+          <font-triplet name="Gladiator" weight="normal"/>
+        </font>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
Index: test/config/test_fontbase_bad.xconf
===================================================================
--- test/config/test_fontbase_bad.xconf	(revision 517602)
+++ test/config/test_fontbase_bad.xconf	(working copy)
@@ -3,6 +3,9 @@
   <!-- Strict configuration On -->
   <strict-configuration>true</strict-configuration>
 
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+
   <!-- Base URL for resolving relative URLs -->
   <base>./</base>
 
Index: test/config/test_fonttripletattribute_missing.xconf
===================================================================
--- test/config/test_fonttripletattribute_missing.xconf	(revision 517602)
+++ test/config/test_fonttripletattribute_missing.xconf	(working copy)
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<fop version="1.0">
-  <!-- Strict configuration On -->
-  <strict-configuration>true</strict-configuration>
-
-  <!-- Base URL for resolving relative URLs -->
-  <base>./</base>
-
-  <!-- Font Base URL for resolving relative font URLs -->
-  <font-base>./</font-base>
-  
-  <renderers>
-    <renderer mime="application/pdf">
-      <fonts>
-        <font metrics-url="test/resources/fonts/glb12.ttf.xml">
-		  <!-- this font-triplet has a missing style attribute -->           
-          <font-triplet name="Gladiator" weight="normal"/>
-        </font>
-      </fonts>
-    </renderer>
-  </renderers>
-</fop>
Index: test/config/test_font_embedurl_malformed.xconf
===================================================================
--- test/config/test_font_embedurl_malformed.xconf	(revision 0)
+++ test/config/test_font_embedurl_malformed.xconf	(revision 0)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+  
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+		<!-- this font has a malformed embed-url -->
+		<font metrics-url="test/resources/fonts/glb12.ttf.xml" embed-url="badprotocol:test/resources/fonts/glb12.ttf">
+          <font-triplet name="Gladiator-Ansi" style="normal" weight="normal"/>
+        </font>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
Index: test/config/test_font_embedurl_bad.xconf
===================================================================
--- test/config/test_font_embedurl_bad.xconf	(revision 0)
+++ test/config/test_font_embedurl_bad.xconf	(revision 0)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<fop version="1.0">
+  <!-- Strict configuration On -->
+  <strict-configuration>true</strict-configuration>
+
+  <!-- Switch off font caching for the purposes of the unit test -->
+  <cache-fonts>false</cache-fonts>  
+  
+  <!-- Base URL for resolving relative URLs -->
+  <base>./</base>
+
+  <!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base>
+  
+  <renderers>
+    <renderer mime="application/pdf">
+      <fonts>
+		<!-- this font has an embed-url that does not exist on filesystem -->
+		<font metrics-url="test/resources/fonts/glb12.ttf.xml" embed-url="test/resources/fonts/doesnotexist.ttf">
+          <font-triplet name="Gladiator-Ansi" style="normal" weight="normal"/>
+        </font>
+      </fonts>
+    </renderer>
+  </renderers>
+</fop>
Index: test/config/test_metricsurl_bad.xconf
===================================================================
--- test/config/test_metricsurl_bad.xconf	(revision 517602)
+++ test/config/test_metricsurl_bad.xconf	(working copy)
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<fop version="1.0">
-  <!-- Strict configuration On -->
-  <strict-configuration>true</strict-configuration>
-
-  <!-- Base URL for resolving relative URLs -->
-  <base>./</base>
-
-  <!-- Font Base URL for resolving relative font URLs -->
-  <font-base>./</font-base>
-  
-  <renderers>
-    <renderer mime="application/pdf">
-      <fonts>
-		<!-- this font has a metrics-url that does not exist on filesystem -->
-        <font metrics-url="test/resources/fonts/doesnotexist.ttf.ansi.xml">
-          <font-triplet name="Gladiator-Ansi" style="normal" weight="normal"/>
-        </font>
-      </fonts>
-    </renderer>
-  </renderers>
-</fop>
Index: test/config/test_metricsurl_malformed.xconf
===================================================================
--- test/config/test_metricsurl_malformed.xconf	(revision 517602)
+++ test/config/test_metricsurl_malformed.xconf	(working copy)
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<fop version="1.0">
-  <!-- Strict configuration On -->
-  <strict-configuration>true</strict-configuration>
-
-  <!-- Base URL for resolving relative URLs -->
-  <base>./</base>
-
-  <!-- Font Base URL for resolving relative font URLs -->
-  <font-base>./</font-base>
-  
-  <renderers>
-    <renderer mime="application/pdf">
-      <fonts>
-		<!-- this font has a malformed metrics-url -->
-        <font metrics-url="badprotocol:test/resources/fonts/glb12.ttf.xml">
-          <font-triplet name="Gladiator" style="normal" weight="normal"/>
-        </font>
-      </fonts>
-    </renderer>
-  </renderers>
-</fop>
Index: test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java	(revision 0)
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+/*
+ * this font has a metrics-url that does not exist on filesystem
+ */ 
+public class FontsDirectoryBadTestCase extends BaseDestructiveUserConfigTestCase {
+
+    public FontsDirectoryBadTestCase(String name) {
+        super(name);
+    }
+    
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_fonts_directory_bad.xconf";
+    }
+    
+    /** get test FOP config File */
+    protected String getFontFOFilePath() {
+        return "test/xml/bugtests/font-dir.fo";
+    }
+}

Property changes on: test\java\org\apache\fop\config\FontsDirectoryBadTestCase.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java	(revision 0)
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+/**
+ * tests font directory on system 
+ */
+public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTestCase {
+
+    public FontsDirectoryRecursiveTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    protected String getUserConfigFilename() {
+        return "test_fonts_directory_recursive.xconf";
+    }    
+}

Property changes on: test\java\org\apache\fop\config\FontsDirectoryRecursiveTestCase.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java
===================================================================
--- test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java	(revision 0)
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+public abstract class BaseConstructiveUserConfigTestCase extends BaseUserConfigTestCase {
+
+    /**
+     * @see junit.framework.TestCase#TestCase(String)
+     */
+    public BaseConstructiveUserConfigTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * Test using a standard FOP font
+     * @throws Exception checkstyle wants a comment here, even a silly one
+     */
+    public void testUserConfig() throws Exception {
+        try {
+            initConfig();
+            convertFO();
+        } catch (Exception e) {
+            // this should *not* happen!
+            e.printStackTrace();
+            fail( e.getMessage() );
+        }
+    }
+}

Property changes on: test\java\org\apache\fop\config\BaseConstructiveUserConfigTestCase.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontsAutoDetectTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/FontsAutoDetectTestCase.java	(revision 0)
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTestCase {
+
+    public FontsAutoDetectTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_fonts_autodetect.xconf";
+    }
+}

Property changes on: test\java\org\apache\fop\config\FontsAutoDetectTestCase.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java
===================================================================
--- test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java	(revision 0)
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+import org.apache.fop.apps.FOPException;
+
+public abstract class BaseDestructiveUserConfigTestCase extends BaseUserConfigTestCase {
+
+    /**
+     * @see junit.framework.TestCase#TestCase(String)
+     */
+    public BaseDestructiveUserConfigTestCase(String name) {
+        super(name);
+    }
+
+    public void testUserConfig() throws Exception {
+        try {
+            initConfig();
+            convertFO();
+            fail( getName() + ": Expected Configuration Exception" );
+        } catch (FOPException e) {
+            // this *should* happen!
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail( getName() + ": Expected FOPException but got: " + e.getMessage() );
+        }
+    }
+}

Property changes on: test\java\org\apache\fop\config\BaseDestructiveUserConfigTestCase.java
___________________________________________________________________
Name: svn:eol-style
   + native

Index: test/java/org/apache/fop/config/EmbedUrlBadTestCase.java
===================================================================
--- test/java/org/apache/fop/config/EmbedUrlBadTestCase.java	(revision 517626)
+++ test/java/org/apache/fop/config/EmbedUrlBadTestCase.java	(working copy)
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.config;
-
-import java.io.File;
-
-// 
-/**
- * this font has an embed-url that does not exist on filesystem.
- */
-public class EmbedUrlBadTestCase extends BaseUserConfigTestCase {
-
-    public EmbedUrlBadTestCase(String name) {
-        super(name);
-    }
-
-    protected File getUserConfigFile() {
-        return new File( getBaseConfigDir() + "/test_embedurl_bad.xconf");
-    }
-    
-    public String getName() {
-        return "test_embedurl_bad.xconf";
-    }
-}
Index: test/java/org/apache/fop/config/EmbedUrlMalformedTestCase.java
===================================================================
--- test/java/org/apache/fop/config/EmbedUrlMalformedTestCase.java	(revision 517626)
+++ test/java/org/apache/fop/config/EmbedUrlMalformedTestCase.java	(working copy)
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.config;
-
-import java.io.File;
-
-// this font has a malformed embed-url
-public class EmbedUrlMalformedTestCase extends BaseUserConfigTestCase {
-
-    public EmbedUrlMalformedTestCase(String name) {
-        super(name);
-    }
-
-    protected File getUserConfigFile() {
-        return new File( getBaseConfigDir() + "/test_embedurl_malformed.xconf");
-    }
-    
-    public String getName() {
-        return "test_embedurl_malformed.xconf";
-    }
-}
Index: test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontAttributesMissingTestCase.java	(revision 517626)
+++ test/java/org/apache/fop/config/FontAttributesMissingTestCase.java	(working copy)
@@ -15,24 +15,22 @@
  * limitations under the License.
  */
 
-/* $Id$ */
-
+/* $Id: $ */
 package org.apache.fop.config;
 
-import java.io.File;
+/*
+ * this font is without a metrics-url or an embed-url
+ */
+public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTestCase {
 
-// this font is without a metrics-url or an embed-url
-public class FontAttributesMissingTestCase extends BaseUserConfigTestCase {
-
     public FontAttributesMissingTestCase(String name) {
         super(name);
     }
 
-    protected File getUserConfigFile() {
-        return new File( getBaseConfigDir() + "/test_fontattributes_missing.xconf");
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_font_attributes_missing.xconf";
     }
-    
-    public String getName() {
-        return "test_fontattributes_missing.xconf";
-    }
 }
Index: test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java	(revision 0)
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+/*
+ * this font has a metrics-url that does not exist on filesystem
+ */ 
+public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTestCase {
+
+    /**
+     * @see junit.framework.TestCase#TestCase(String)
+     */
+    public FontMetricsUrlBadTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_font_metricsurl_bad.xconf";
+    }
+}

Property changes on: test\java\org\apache\fop\config\FontMetricsUrlBadTestCase.java
___________________________________________________________________
Name: svn:kewords
   - Id

Index: test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java	(revision 0)
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+/*
+ * this font has a malformed metrics-url
+ */ 
+public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase {
+
+    public FontMetricsUrlMalformedTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_font_metricsurl_malformed.xconf";
+    }
+}
\ No newline at end of file

Property changes on: test\java\org\apache\fop\config\FontMetricsUrlMalformedTestCase.java
___________________________________________________________________
Name: svn:kewords
   - Id

Index: test/java/org/apache/fop/config/FontBaseBadTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontBaseBadTestCase.java	(revision 517626)
+++ test/java/org/apache/fop/config/FontBaseBadTestCase.java	(working copy)
@@ -15,15 +15,14 @@
  * limitations under the License.
  */
 
-/* $Id$ */
-
+/* $Id: $ */
 package org.apache.fop.config;
 
-import java.io.File;
+/*
+ * this font base does not exist and a relative font path is used
+ */ 
+public class FontBaseBadTestCase extends BaseDestructiveUserConfigTestCase {
 
-// this font base does not exist and a relative font path is used
-public class FontBaseBadTestCase extends BaseUserConfigTestCase {
-
     public FontBaseBadTestCase(String name) {
         super(name);
     }
@@ -34,16 +33,9 @@
     }
 
     /**
-     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFile()
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
      */
-    protected File getUserConfigFile() {
-        return new File( getBaseConfigDir() + "/test_fontbase_bad.xconf");
-    }
-    
-    /**
-     * @return configuration filename
-     */
-    public String getName() {
+    public String getUserConfigFilename() {
         return "test_fontbase_bad.xconf";
     }
 }
Index: test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java	(revision 517626)
+++ test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java	(working copy)
@@ -15,24 +15,22 @@
  * limitations under the License.
  */
 
-/* $Id$ */
-
+/* $Id: $ */
 package org.apache.fop.config;
 
-import java.io.File;
+/*
+ * this font has a missing font triplet attribute
+ */ 
+public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTestCase {
 
-// this font has an embed-url that does not exist on filesystem
-public class FontTripletAttributeMissingTestCase extends BaseUserConfigTestCase {
-
     public FontTripletAttributeMissingTestCase(String name) {
         super(name);
     }
 
-    protected File getUserConfigFile() {
-        return new File( getBaseConfigDir() + "/test_fonttripletattribute_missing.xconf");
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_font_tripletattribute_missing.xconf";
     }
-    
-    public String getName() {
-        return "test_fonttripletattribute_missing.xconf";
-    }
 }
Index: test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java	(revision 0)
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+/**
+ * this font has an embed-url that does not exist on filesystem.
+ */
+public class FontEmbedUrlBadTestCase extends BaseDestructiveUserConfigTestCase {
+
+    public FontEmbedUrlBadTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_font_embedurl_bad.xconf";
+    }
+}

Property changes on: test\java\org\apache\fop\config\FontEmbedUrlBadTestCase.java
___________________________________________________________________
Name: svn:kewords
   - Id

Index: test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java
===================================================================
--- test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java	(revision 0)
+++ test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java	(revision 0)
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+package org.apache.fop.config;
+
+/** 
+ * this font has a malformed embed-url
+ */
+public class FontEmbedUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase {
+
+    public FontEmbedUrlMalformedTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
+     */
+    public String getUserConfigFilename() {
+        return "test_font_embedurl_malformed.xconf";
+    }
+}

Property changes on: test\java\org\apache\fop\config\FontEmbedUrlMalformedTestCase.java
___________________________________________________________________
Name: svn:kewords
   - Id

Index: test/java/org/apache/fop/config/BaseUserConfigTestCase.java
===================================================================
--- test/java/org/apache/fop/config/BaseUserConfigTestCase.java	(revision 517706)
+++ test/java/org/apache/fop/config/BaseUserConfigTestCase.java	(working copy)
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id$ */
+/* $Id: $ */
 
 package org.apache.fop.config;
 
@@ -28,7 +28,6 @@
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.render.pdf.BasePDFTestCase;
 import org.xml.sax.SAXException;
@@ -39,7 +38,7 @@
  */
 public abstract class BaseUserConfigTestCase extends BasePDFTestCase {
 
-    protected static DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
+    static protected DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
 
     /** logging instance */
     protected Log log = LogFactory.getLog(BaseUserConfigTestCase.class);
@@ -59,28 +58,25 @@
         // do nothing
     }
 
+    protected void initConfig() throws Exception {
+        fopFactory.setUserConfig(getUserConfig());                
+    }
+
+    protected void convertFO() throws Exception {
+        final File baseDir = getBaseDir();
+        final String fontFOFilePath = getFontFOFilePath();
+        File foFile = new File(baseDir, fontFOFilePath);
+        final boolean dumpOutput = false;
+        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+        convertFO(foFile, foUserAgent, dumpOutput);
+    }
+
     /**
      * Test using a standard FOP font
      * @throws Exception checkstyle wants a comment here, even a silly one
      */
-    public void testUserConfig() throws Exception {
-        try {
-            fopFactory.setUserConfig(getUserConfig());        
-            final File baseDir = getBaseDir();
-            final String fontFOFilePath = getFontFOFilePath();
-            File foFile = new File(baseDir, fontFOFilePath);
-            final boolean dumpOutput = false;
-            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
-            convertFO(foFile, foUserAgent, dumpOutput);
-            fail( getName() + ": Expected Configuration Exception" );
-        } catch (FOPException e) {
-            // this *should* happen!
-        } catch (Exception e) {
-            fail( getName() + ": Expected FOPException but got: " + e.getMessage() );
-        }
-    }
-
-
+    abstract public void testUserConfig() throws Exception;
+    
     /**
      * get test FOP config File
      * @return fo test filepath
@@ -96,30 +92,39 @@
      * @throws SAXException 
      * @throws ConfigurationException 
      */
-    protected Configuration getUserConfig(String configString)
-            throws ConfigurationException, SAXException, IOException {
+    protected Configuration getUserConfig(String configString) throws ConfigurationException, SAXException, IOException {
         return cfgBuilder.build(new ByteArrayInputStream(configString.getBytes()));
     }
 
+    /** get base config directory */
+    protected String getBaseConfigDir() {
+        return "test/config";
+    }
+
     /**
+     * @return user config File
+     */
+    abstract protected String getUserConfigFilename();
+
+    /*
+     * @see junit.framework.TestCase#getName()
+     */
+    public String getName() {
+        return getUserConfigFilename();
+    }
+
+    protected File getUserConfigFile() {
+        return new File( getBaseConfigDir() + File.separator + getUserConfigFilename() );
+    }
+
+    /**
      * get test FOP Configuration
      * @return fo test filepath
      * @throws IOException 
      * @throws SAXException 
      * @throws ConfigurationException 
      */
-    protected Configuration getUserConfig()
-            throws ConfigurationException, SAXException, IOException {
+    protected Configuration getUserConfig() throws ConfigurationException, SAXException, IOException {
         return cfgBuilder.buildFromFile(getUserConfigFile());
-    }
-    
-    /** get base config directory */
-    protected String getBaseConfigDir() {
-        return "test/config";
-    }
-    
-    /**
-     * @return user config File
-     */
-    protected abstract File getUserConfigFile();
-}
+    }        
+}
\ No newline at end of file
Index: test/java/org/apache/fop/config/MetricsUrlBadTestCase.java
===================================================================
--- test/java/org/apache/fop/config/MetricsUrlBadTestCase.java	(revision 517627)
+++ test/java/org/apache/fop/config/MetricsUrlBadTestCase.java	(working copy)
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.config;
-
-import java.io.File;
-
-// this font has a metrics-url that does not exist on filesystem
-public class MetricsUrlBadTestCase extends BaseUserConfigTestCase {
-
-    /**
-     * @see junit.framework.TestCase#TestCase(String)
-     */
-    public MetricsUrlBadTestCase(String name) {
-        super(name);
-    }
-
-    /**
-     * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFile()
-     */
-    protected File getUserConfigFile() {
-        return new File( getBaseConfigDir() + "/test_metricsurl_bad.xconf");
-    }
-    
-    public String getName() {
-        return "test_metricsurl_bad.xconf";
-    }
-}
Index: test/java/org/apache/fop/config/MetricsUrlMalformedTestCase.java
===================================================================
--- test/java/org/apache/fop/config/MetricsUrlMalformedTestCase.java	(revision 517626)
+++ test/java/org/apache/fop/config/MetricsUrlMalformedTestCase.java	(working copy)
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.config;
-
-import java.io.File;
-
-// this font has a malformed metrics-url
-public class MetricsUrlMalformedTestCase extends BaseUserConfigTestCase {
-
-    public MetricsUrlMalformedTestCase(String name) {
-        super(name);
-    }
-
-    protected File getUserConfigFile() {
-        return new File( getBaseConfigDir() + "/test_metricsurl_malformed.xconf");
-    }
-    
-    public String getName() {
-        return "test_metricsurl_malformed.xconf";
-    }
-}
Index: test/java/org/apache/fop/config/UserConfigTestSuite.java
===================================================================
--- test/java/org/apache/fop/config/UserConfigTestSuite.java	(revision 517626)
+++ test/java/org/apache/fop/config/UserConfigTestSuite.java	(working copy)
@@ -15,8 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id$ */
-
+/* $Id: $ */
 package org.apache.fop.config;
 
 import junit.framework.Test;
@@ -38,10 +37,12 @@
         suite.addTest(new TestSuite(FontBaseBadTestCase.class));
         suite.addTest(new TestSuite(FontAttributesMissingTestCase.class));
         suite.addTest(new TestSuite(FontTripletAttributeMissingTestCase.class));
-        suite.addTest(new TestSuite(MetricsUrlBadTestCase.class));
-        suite.addTest(new TestSuite(EmbedUrlBadTestCase.class));
-        suite.addTest(new TestSuite(MetricsUrlMalformedTestCase.class));
-        suite.addTest(new TestSuite(EmbedUrlMalformedTestCase.class));
+        suite.addTest(new TestSuite(FontMetricsUrlBadTestCase.class));
+        suite.addTest(new TestSuite(FontEmbedUrlBadTestCase.class));
+        suite.addTest(new TestSuite(FontMetricsUrlMalformedTestCase.class));
+        suite.addTest(new TestSuite(FontEmbedUrlMalformedTestCase.class));
+        suite.addTest(new TestSuite(FontsDirectoryRecursiveTestCase.class));
+        suite.addTest(new TestSuite(FontsAutoDetectTestCase.class));
         //$JUnit-END$
         return suite;
     }
Index: test/xml/bugtests/font-dir.fo
===================================================================
--- test/xml/bugtests/font-dir.fo	(revision 0)
+++ test/xml/bugtests/font-dir.fo	(revision 0)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+  <fo:layout-master-set>
+      <fo:simple-page-master master-name="simplePM"
+                    page-height="25cm"
+                    page-width="20cm"
+                    margin-top="1cm"
+                    margin-bottom="1cm"
+                    margin-left="1.5cm"
+                    margin-right="1.5cm">
+        <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
+        <fo:region-before extent="2.5cm"/>
+        <fo:region-after extent="2.5cm"/>
+      </fo:simple-page-master>
+  </fo:layout-master-set>
+
+  <fo:page-sequence master-reference="simplePM">
+      <fo:flow flow-name="xsl-region-body">
+      <fo:block font-family="RageItalic" font-size="12pt">
+        This is a simple fo text in Rage italic font.
+      </fo:block>
+    </fo:flow>
+  </fo:page-sequence>
+</fo:root>
Index: test/xml/pdf-encoding/pdf-encoding-test.xconf
===================================================================
--- test/xml/pdf-encoding/pdf-encoding-test.xconf	(revision 517602)
+++ test/xml/pdf-encoding/pdf-encoding-test.xconf	(working copy)
@@ -23,6 +23,9 @@
 -->
 
 <fop version="1.0">
+  <!-- Switch off font caching for the purposes of unit testing -->
+  <cache-fonts>false</cache-fonts>
+
   <renderers>
     <renderer mime="application/pdf">
       <!-- disable PDF text compression -->
