You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ph...@apache.org on 2012/08/16 15:31:44 UTC

svn commit: r1373825 [2/4] - in /xmlgraphics/fop/branches/Temp_RoundedCorners: ./ lib/ src/documentation/content/ src/documentation/content/xdocs/ src/documentation/content/xdocs/1.1rc1/ src/documentation/content/xdocs/1.1rc1/fotree/ src/documentation/...

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/team.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/team.xml?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/team.xml (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/team.xml Thu Aug 16 13:31:38 2012
@@ -44,7 +44,7 @@
             is an XP/Agile practitioner with interests in open source content management and electronic
             document generation.  He is a UK expat now residing in Singapore.</li>
         <li id="ad"><link href="mailto:adelmelle@apache.org">Andreas Delmelle</link> (AD)</li>
-        <li id="pjfh"> <a href="mailto:phancock.at.apache.org">Peter Hancock</a>
+        <li id="pjfh"> <link href="mailto:phancock.at.apache.org">Peter Hancock</link>
           (PH) is a Java developer from England.</li>
         <li id="vh"><link href="mailto:vhennebert@apache.org">Vincent Hennebert</link>
           (VH), a Java developer from France; with an interest in typography, and in using

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/trunk/embedding.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/trunk/embedding.xml?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/trunk/embedding.xml (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/content/xdocs/trunk/embedding.xml Thu Aug 16 13:31:38 2012
@@ -41,8 +41,10 @@
       OutputStream, which OutputStream to use for the results of the rendering. You can
       customize FOP's behaviour in a rendering run by supplying your own FOUserAgent
       instance. The FOUserAgent can, for example, be used to set your own document handler
-      instance (details below). Finally, you retrieve a SAX DefaultHandler instance from
-      the Fop object and use that as the SAXResult of your transformation.
+      instance (details below). Because the FOUserAgent holds FOP-run-specific configuration
+      data, it should only be used for a single run and not over multiple FOP invocations.
+      Finally, you retrieve a SAX DefaultHandler instance from the Fop object and use that
+      as the SAXResult of your transformation.
     </p>
   </section>
   <section id="API">
@@ -54,6 +56,7 @@
       clearly defined, the list of classes below are the generally agreed public API:
       <source><![CDATA[
 org.apache.fop.apps.*
+org.apache.fop.apps.io.*
 org.apache.fop.fo.FOEventHandler
 org.apache.fop.fo.ElementMappingRegistry
 org.apache.fop.fonts.FontManager
@@ -89,7 +92,8 @@ import org.apache.fop.apps.MimeConstants
 
 // Step 1: Construct a FopFactory
 // (reuse if you plan to render multiple documents!)
-FopFactory fopFactory = FopFactory.newInstance();
+// Supply FOP with the base URI from which to resolve other URIs from
+FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
 
 // Step 2: Set up output stream.
 // Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
@@ -123,8 +127,10 @@ try {
     <ul>
       <li>
         <strong>Step 1:</strong> You create a new FopFactory instance. The FopFactory instance holds
-        references to configuration information and cached data. It's important to reuse this
-        instance if you plan to render multiple documents during a JVM's lifetime.
+        references to configuration information and cached data. It is important to reuse this
+        instance if you plan to render multiple documents during a JVM's lifetime. URIs used within
+        FOP runs (images in the FO, fonts in the fop conf etc...) will be resolved against the base
+        URI given here.
       </li>
       <li>
         <strong>Step 2:</strong> You set up an OutputStream that the generated document
@@ -302,38 +308,33 @@ try {
     <title>Configuring Apache FOP Programmatically</title>
     <p>
       Apache FOP provides two levels on which you can customize FOP's
-      behaviour: the FopFactory and the user agent.
+      behaviour: the FopFactoryBuilder and the user agent.
     </p>
     <section id="fop-factory">
       <title>Customizing the FopFactory</title>
       <p>
         The FopFactory holds configuration data and references to objects which are reusable over
-        multiple rendering runs. It's important to instantiate it only once (except in special
-        environments) and reuse it every time to create new FOUserAgent and Fop instances.
+        multiple rendering runs. The FopFactoryBuilder allows users to set configuration and then
+        build the FopFactory so that the FopFactory doesn't change between runs. The FopFactory performs
+        some performance expensive operations (i.e. detecting system fonts), as such it only needs to be
+        built once and cane be reused every time to create new FOUserAgent and Fop instances.
       </p>
       <p>
-        You can set all sorts of things on the FopFactory:
+        The FopFactoryBuilder can be instantiated with three objects; the base URI, the ResourceResolver
+        and the EnvironmentProfile. The base URI and the ResourceResolver are used for resolving resource
+        URIs throughout the FOP invocation. The EnvironmentProfile will be discussed further below but, in
+        short, it gives users more control over FOPs system dependent services.
+      </p>
+      <p>
+        You can set all sorts of things on the FopFactoryBuilder:
       </p>
       <ul>
         <li>
           <p>
-            The <strong>font base URL</strong> to use when resolving relative URLs for fonts. Example:
-          </p>
-          <source>fopFactory.getFontManager().setFontBaseURL("file:///C:/Temp/fonts");</source>
-        </li>
-        <li>
-          <p>
-            The <strong>hyphenation base URL</strong> to use when resolving relative URLs for
-            hyphenation patterns. Example:
-          </p>
-          <source>fopFactory.setHyphenBaseURL("file:///C:/Temp/hyph");</source>
-        </li>
-        <li>
-          <p>
             Disable <strong>strict validation</strong>. When disabled FOP is less strict about the rules
             established by the XSL-FO specification. Example:
           </p>
-          <source>fopFactory.setStrictValidation(false);</source>
+          <source>fopFactoryBuilder.setStrictFOValidation(false);</source>
         </li>
         <li>
           <p>
@@ -342,14 +343,14 @@ try {
             'false', which causes Apache FOP to behave exactly as described in the specification. To enable the
             alternative behaviour, call:
           </p>
-          <source>fopFactory.setBreakIndentInheritanceOnReferenceAreaBoundary(true);</source>
+          <source>fopFactoryBuilder.setBreakIndentInheritanceOnReferenceAreaBoundary(true);</source>
         </li>
         <li>
           <p>
             Set the <strong>source resolution</strong> for the document. This is used internally to determine the pixel
             size for SVG images and bitmap images without resolution information. Default: 72 dpi. Example:
           </p>
-          <source>fopFactory.setSourceResolution(96); // =96dpi (dots/pixels per Inch)</source>
+          <source>fopFactoryBuilder.setSourceResolution(96); // =96dpi (dots/pixels per Inch)</source>
         </li>
         <li>
           <p>
@@ -357,22 +358,21 @@ try {
             you can give the instance to the FOUserAgent. Normally, the FOP extensions can be automatically detected
             (see the documentation on extension for more info). Example:
           </p>
-          <source>fopFactory.addElementMapping(myElementMapping); // myElementMapping is a org.apache.fop.fo.ElementMapping</source>
-        </li>
-        <li>
-          <p>
-            Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add
-            custom URI resolution functionality to FOP. For example, you can use
-            <a href="ext:xml.apache.org/commons/resolver">Apache XML Commons Resolver</a> to make use of XCatalogs. Example:
-          </p>
-          <source>fopFactory.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolver</source>
-          <note>
-            Both the FopFactory and the FOUserAgent have a method to set a URIResolver. The URIResolver on the FopFactory
-            is primarily used to resolve URIs on factory-level (hyphenation patterns, for example) and it is always used
-            if no other URIResolver (for example on the FOUserAgent) resolved the URI first.
-          </note>
+          <source>fopFactoryBuilder.addElementMapping(myElementMapping); // myElementMapping is a org.apache.fop.fo.ElementMapping</source>
         </li>
       </ul>
+      <p>
+        Once the settings on the FopFactoryBuilder had been set, you can create a FopFactory by invoking the build method:
+      </p>
+      <source>FopFactory factory = fopFactoryBuilder.build();</source>
+    </section>
+    <section id="environment-profile">
+      <title>Environment Profile</title>
+      <p>
+        The EnvironmentProfile can be used to define the limitations and restrictions of FOPs access to system resources. FOP, for example,
+        can auto-detect system fonts which users may want control over. This environment profile also holds the base URI and the
+        ResourceResolver discussed previously, since they are intrinsically bound to the environment inwhich FOP is invoked.
+      </p>
     </section>
     <section id="user-agent">
       <title>Customizing the User Agent</title>
@@ -383,7 +383,7 @@ try {
         to the factory method that will create a new Fop instance:
       </p>
       <source><![CDATA[
-  FopFactory fopFactory = FopFactory.newInstance(); // Reuse the FopFactory if possible!
+  FopFactory fopFactory = FopFactory.newInstance(...); // Reuse the FopFactory if possible!
   // do the following for each new rendering run
   FOUserAgent userAgent = fopFactory.newFOUserAgent();
   // customize userAgent
@@ -394,12 +394,6 @@ try {
       <ul>
         <li>
           <p>
-            The <strong>base URL</strong> to use when resolving relative URLs. Example:
-          </p>
-          <source>userAgent.setBaseURL("file:///C:/Temp/");</source>
-        </li>
-        <li>
-          <p>
             Set the <strong>producer</strong> of the document. This is metadata information that can be used for certain output formats such as PDF. The default producer is "Apache FOP". Example:
           </p>
           <source>userAgent.setProducer("MyKillerApplication");</source>
@@ -459,19 +453,6 @@ try {
           </p>
           <source>userAgent.setFOEventHandlerOverride(myFOEventHandler); // myFOEventHandler is an org.apache.fop.fo.FOEventHandler</source>
         </li>
-        <li>
-          <p>
-            Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add
-            custom URI resolution functionality to FOP. For example, you can use
-            <a href="ext:xml.apache.org/commons/resolver">Apache XML Commons Resolver</a> to make use of XCatalogs. Example:
-          </p>
-          <source>userAgent.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolver</source>
-          <note>
-            Both the FopFactory and the FOUserAgent have a method to set a URIResolver. The URIResolver on the FOUserAgent is
-            used for resolving URIs which are document-related. If it's not set or cannot resolve a URI, the URIResolver
-            from the FopFactory is used.
-          </note>
-        </li>
       </ul>
       <note>
         You should not reuse an FOUserAgent instance between FOP rendering runs although you can. Especially
@@ -486,18 +467,20 @@ try {
       many values from an XML configuration file:
     </p>
     <source><![CDATA[
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-
-/*..*/
-
-DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
-Configuration cfg = cfgBuilder.buildFromFile(new File("C:/Temp/mycfg.xml"));
-fopFactory.setUserConfig(cfg);
-
-/* ..or.. */
-
-fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]></source>
+FopFactory fopFactory = FopFactory.newInstance(new File("C:/Temp/mycfg.xml"));]]></source>
+    <p>
+      If however, you wish to override some of the configuration settings within the fop conf programmatically
+      then you can do so by using the FopConfParser. This allows the FopFactory to remain immutable and consistent
+      across multiple threads/invocations while still keeping the API flexible for the user.
+    </p>
+    <source><![CDATA[
+// Create an instance of the FopFactoryBuilder populated with config from the fop conf
+FopFactoryBuilder fopFactoryBuilder = new FopConfParser(new File("fop.xconf")).getFopFactoryBuilder();
+// Override the configuration programmatically
+fopFactoryBuilderuilder.setAccessibility(true);
+...
+// Build the FopFactory
+FopFactory factory = fopFactoryBuilder.build();]]></source>
     <p>
       The layout of the configuration file is described on the <a href="configuration.html">Configuration page</a>.
     </p>
@@ -749,4 +732,4 @@ mailing list.
   </section>
 </section>
   </body>
-</document>
\ No newline at end of file
+</document>

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/resources/stylesheets/known-issues2document.xsl
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/resources/stylesheets/known-issues2document.xsl?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/resources/stylesheets/known-issues2document.xsl (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/documentation/resources/stylesheets/known-issues2document.xsl Thu Aug 16 13:31:38 2012
@@ -46,4 +46,10 @@
     </li>
   </xsl:template>
   
+  <xsl:template match="@*|*|text()|processing-instruction()|comment()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|*|text()|processing-instruction()|comment()"/>
+    </xsl:copy>
+  </xsl:template>
+
 </xsl:stylesheet>

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java Thu Aug 16 13:31:38 2012
@@ -221,14 +221,17 @@ class StructureTreeEventTrigger extends 
     @Override
     public void startCell(TableCell tc) {
         AttributesImpl attributes = new AttributesImpl();
-        int colSpan = tc.getNumberColumnsSpanned();
-        if (colSpan > 1) {
-            addNoNamespaceAttribute(attributes, "number-columns-spanned",
-                    Integer.toString(colSpan));
-        }
+        addSpanAttribute(attributes, "number-columns-spanned", tc.getNumberColumnsSpanned());
+        addSpanAttribute(attributes, "number-rows-spanned", tc.getNumberRowsSpanned());
         startElement(tc, attributes);
     }
 
+    private void addSpanAttribute(AttributesImpl attributes, String attributeName, int span) {
+        if (span > 1) {
+            addNoNamespaceAttribute(attributes, attributeName, Integer.toString(span));
+        }
+    }
+
     @Override
     public void endCell(TableCell tc) {
         endElement(tc);

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.java Thu Aug 16 13:31:38 2012
@@ -113,4 +113,13 @@ public interface AFPEventProducer extend
      * @event.severity ERROR
      */
     void invalidConfiguration(Object source, Exception e);
+
+    /**
+     * The characterset is missing metric information for the specified character
+     * @param source the event source
+     * @param character the character with missing metric information.
+     * @param charSet the character set containing missing metric information
+     * @event.severity WARN
+     */
+    void charactersetMissingMetrics(Object source, char character, String charSet);
 }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.xml?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.xml (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPEventProducer.xml Thu Aug 16 13:31:38 2012
@@ -8,4 +8,5 @@
   <message key="fontConfigMissing">The mandatory configuation node: '{missingConfig}' was not found at {location}.</message>
   <message key="characterSetNameInvalid">The character set given has an invalid name. [ Reason: {msg} ]</message>
   <message key="codePageNotFound">The code page for an AFP font cannot be found.[ Reason: {e}]</message>
+  <message key="charactersetMissingMetrics">Metric information is missing for the glyph `{character}` in the characterset `{charSet}`. Using space increment width.</message>
 </catalogue>

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPGraphics2D.java Thu Aug 16 13:31:38 2012
@@ -52,13 +52,13 @@ import org.apache.xmlgraphics.image.load
 import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
 import org.apache.xmlgraphics.java2d.AbstractGraphics2D;
 import org.apache.xmlgraphics.java2d.GraphicContext;
+import org.apache.xmlgraphics.java2d.GraphicsConfigurationWithTransparency;
 import org.apache.xmlgraphics.java2d.StrokingTextHandler;
 import org.apache.xmlgraphics.java2d.TextHandler;
 import org.apache.xmlgraphics.util.UnitConv;
 
 import org.apache.fop.afp.goca.GraphicsSetLineType;
 import org.apache.fop.afp.modca.GraphicsObject;
-import org.apache.fop.afp.svg.AFPGraphicsConfiguration;
 import org.apache.fop.afp.util.CubicBezierApproximator;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.render.afp.AFPImageHandlerRenderedImage;
@@ -111,7 +111,7 @@ public class AFPGraphics2D extends Abstr
     private AFPPaintingState paintingState = null;
 
     /** AFP graphics configuration */
-    private final AFPGraphicsConfiguration graphicsConfig = new AFPGraphicsConfiguration();
+    private final GraphicsConfigurationWithTransparency graphicsConfig = new GraphicsConfigurationWithTransparency();
 
     /** The AFP FontInfo */
     private FontInfo fontInfo;

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceLevel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceLevel.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceLevel.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceLevel.java Thu Aug 16 13:31:38 2012
@@ -66,9 +66,8 @@ public class AFPResourceLevel {
         }
     }
 
-    /** the external resource group file path */
     private URI extUri = null;
-    private ResourceType resourceType;
+    private final ResourceType resourceType;
 
     /**
      * Sets the resource placement level within the AFP output
@@ -84,7 +83,7 @@ public class AFPResourceLevel {
     /**
      * Main constructor
      *
-     * @param level the resource level
+     * @param resourceType the resource type
      */
     public AFPResourceLevel(ResourceType resourceType) {
         this.resourceType = resourceType;
@@ -156,7 +155,7 @@ public class AFPResourceLevel {
     /**
      * Sets the URI of the external resource group.
      *
-     * @param filePath the URI of the external resource group
+     * @param uri the URI of the external resource group
      */
     public void setExternalUri(URI uri) {
         this.extUri = uri;

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPResourceManager.java Thu Aug 16 13:31:38 2012
@@ -115,9 +115,9 @@ public class AFPResourceManager {
     }
 
     /**
-     * Sets the default resource group file path
+     * Sets the default resource group URI.
      *
-     * @param filePath the default resource group file path
+     * @param uri the default resource group URI
      */
 
     public void setDefaultResourceGroupUri(URI uri) {

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPStreamer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPStreamer.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPStreamer.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/AFPStreamer.java Thu Aug 16 13:31:38 2012
@@ -99,9 +99,9 @@ public class AFPStreamer implements Stre
     }
 
     /**
-     * Sets the default resource group file path
+     * Sets the default resource group URI.
      *
-     * @param filePath the default resource group file path
+     * @param uri the default resource group URI
      */
     public void setDefaultResourceGroupUri(URI uri) {
         this.defaultResourceGroupUri = uri;

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java Thu Aug 16 13:31:38 2012
@@ -19,6 +19,8 @@
 
 package org.apache.fop.afp.fonts;
 
+import org.apache.fop.afp.AFPEventProducer;
+
 /**
  * A font defined as a set of lines and curves as opposed to a bitmap font. An
  * outline font can be scaled to any size and otherwise transformed more easily
@@ -29,16 +31,25 @@ public abstract class AbstractOutlineFon
     /** The character set for this font */
     protected CharacterSet charSet = null;
 
+    private final AFPEventProducer eventProducer;
+
     /**
      * Constructor for an outline font.
      *
      * @param name the name of the font
      * @param embeddable sets whether or not this font is to be embedded
      * @param charSet the chracter set
+     * @param eventProducer The object to handle any events which occur from the object.
      */
-    public AbstractOutlineFont(String name, boolean embeddable, CharacterSet charSet) {
+    public AbstractOutlineFont(String name, boolean embeddable, CharacterSet charSet,
+            AFPEventProducer eventProducer) {
         super(name, embeddable);
         this.charSet = charSet;
+        this.eventProducer = eventProducer;
+    }
+
+    AFPEventProducer getAFPEventProducer() {
+        return eventProducer;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSet.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSet.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSet.java Thu Aug 16 13:31:38 2012
@@ -363,4 +363,12 @@ public class CharacterSet {
         return getCharacterSetOrientation().getEmSpaceIncrement();
     }
 
+    /**
+     * Returns the nominal character increment.
+     * @return the nominal character increment
+     */
+    public int getNominalCharIncrement() {
+        return getCharacterSetOrientation().getNominalCharIncrement();
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java Thu Aug 16 13:31:38 2012
@@ -236,9 +236,9 @@ public abstract class CharacterSetBuilde
             CharacterSetType charsetType, AFPResourceAccessor accessor, AFPEventProducer eventProducer)
             throws IOException {
         // check for cached version of the characterset
-        String descriptor = characterSetName + "_" + encoding + "_" + codePageName;
-        CharacterSet characterSet = (CharacterSet) characterSetsCache.get(descriptor);
-
+        URI charSetURI = accessor.resolveURI(characterSetName);
+        String cacheKey = charSetURI.toASCIIString() + "_" + characterSetName + "_" + codePageName;
+        CharacterSet characterSet = (CharacterSet) characterSetsCache.get(cacheKey);
         if (characterSet != null) {
             return characterSet;
         }
@@ -257,6 +257,8 @@ public abstract class CharacterSetBuilde
              * chracter global identifier.
              */
             Map<String, String> codePage;
+            // TODO: This could have performance implications if several threads want to use the
+            // codePagesCache to retrieve different codepages.
             synchronized (codePagesCache) {
                 codePage = codePagesCache.get(codePageName);
 
@@ -308,7 +310,7 @@ public abstract class CharacterSetBuilde
         } finally {
             closeInputStream(inputStream);
         }
-        characterSetsCache.put(descriptor, characterSet);
+        characterSetsCache.put(cacheKey, characterSet);
         return characterSet;
     }
 
@@ -446,20 +448,15 @@ public abstract class CharacterSetBuilde
             position++;
 
             if (position == 26) {
-
                 position = 0;
 
                 int orientation = determineOrientation(fnoData[2]);
-                //  Space Increment
-                int space = ((fnoData[8] & 0xFF ) << 8) + (fnoData[9] & 0xFF);
-                //  Em-Space Increment
-                int em = ((fnoData[14] & 0xFF ) << 8) + (fnoData[15] & 0xFF);
-
-                CharacterSetOrientation cso = new CharacterSetOrientation(orientation);
-                cso.setSpaceIncrement(space);
-                cso.setEmSpaceIncrement(em);
-                orientations.add(cso);
+                int spaceIncrement = getUBIN(fnoData, 8);
+                int emIncrement = getUBIN(fnoData, 14);
+                int nominalCharacterIncrement = getUBIN(fnoData, 20);
 
+                orientations.add(new CharacterSetOrientation(orientation, spaceIncrement,
+                        emIncrement, nominalCharacterIncrement));
             }
         }
         return orientations.toArray(EMPTY_CSO_ARRAY);

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java Thu Aug 16 13:31:38 2012
@@ -60,7 +60,7 @@ public class CharacterSetOrientation {
     /**
      * The character widths in the character set (indexed using Unicode codepoints)
      */
-    private int[] charsWidths = null;
+    private int[] charsWidths;
 
     /**
      * The height of lowercase letters
@@ -77,25 +77,26 @@ public class CharacterSetOrientation {
      */
     private char lastChar;
 
-
-    /**
-     * The character set orientation
-     */
-    private int orientation = 0;
-
+    /** The character set orientation */
+    private final int orientation;
     /** space increment */
-    private int spaceIncrement;
+    private final int spaceIncrement;
     /** em space increment */
-    private int emSpaceIncrement = -1;
-
+    private final int emSpaceIncrement;
+    /** Nominal Character Increment */
+    private final int nomCharIncrement;
 
     /**
      * Constructor for the CharacterSetOrientation, the orientation is
      * expressed as the degrees rotation (i.e 0, 90, 180, 270)
      * @param orientation the character set orientation
      */
-    public CharacterSetOrientation(int orientation) {
+    public CharacterSetOrientation(int orientation, int spaceIncrement, int emSpaceIncrement,
+            int nomCharIncrement) {
         this.orientation = orientation;
+        this.spaceIncrement = spaceIncrement;
+        this.emSpaceIncrement = emSpaceIncrement;
+        this.nomCharIncrement = nomCharIncrement;
         charsWidths = new int[256];
         Arrays.fill(charsWidths, -1);
     }
@@ -284,14 +285,6 @@ public class CharacterSetOrientation {
     }
 
     /**
-     * Sets the space increment.
-     * @param value the space increment
-     */
-    public void setSpaceIncrement(int value) {
-        this.spaceIncrement = value;
-    }
-
-    /**
      * Returns the em space increment.
      * @return the em space increment
      */
@@ -300,11 +293,10 @@ public class CharacterSetOrientation {
     }
 
     /**
-     * Sets the em space increment.
-     * @param value the em space increment
+     * Returns the nominal character increment.
+     * @return the nominal character increment
      */
-    public void setEmSpaceIncrement(int value) {
-        this.emSpaceIncrement = value;
+    public int getNominalCharIncrement() {
+        return this.nomCharIncrement;
     }
-
 }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java Thu Aug 16 13:31:38 2012
@@ -23,6 +23,11 @@ import java.lang.Character.UnicodeBlock;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.fop.afp.AFPEventProducer;
+
 /**
  * Implementation of AbstractOutlineFont that supports double-byte fonts (CID Keyed font (Type 0)).
  * The width of characters that are not prescribed a width metrics in the font resource use
@@ -31,7 +36,9 @@ import java.util.Set;
  */
 public class DoubleByteFont extends AbstractOutlineFont {
 
-    //private static final Log LOG = LogFactory.getLog(DoubleByteFont.class);
+    private static final Log log = LogFactory.getLog(DoubleByteFont.class);
+
+    private final Set<Integer> charsProcessed;
 
     //See also http://unicode.org/reports/tr11/ which we've not closely looked at, yet
     //TODO the Unicode block listed here is probably not complete (ex. Hiragana, Katakana etc.)
@@ -49,9 +56,12 @@ public class DoubleByteFont extends Abst
      * @param name the name of the font
      * @param embeddable whether or not this font is embeddable
      * @param charSet the character set
+     * @param eventProducer Handles any AFP related events
      */
-    public DoubleByteFont(String name, boolean embeddable, CharacterSet charSet) {
-        super(name, embeddable, charSet);
+    public DoubleByteFont(String name, boolean embeddable, CharacterSet charSet,
+            AFPEventProducer eventProducer) {
+        super(name, embeddable, charSet, eventProducer);
+        charsProcessed = new HashSet<Integer>();
     }
 
     /** {@inheritDoc} */
@@ -60,16 +70,30 @@ public class DoubleByteFont extends Abst
         try {
             charWidth = charSet.getWidth(toUnicodeCodepoint(character));
         } catch (IllegalArgumentException e) {
+            if (!charsProcessed.contains(character)) {
+                charsProcessed.add(character);
+                getAFPEventProducer().charactersetMissingMetrics(this, (char)character,
+                        charSet.getName().trim());
+            }
             //  We shall try and handle characters that have no mapped width metric in font resource
             charWidth = -1;
         }
 
         if (charWidth == -1) {
-            charWidth = inferCharWidth(character);
+            charWidth = getDefaultCharacterWidth(character);
         }
         return charWidth * size;
     }
 
+    private int getDefaultCharacterWidth(int character) {
+        int nominalCharIncrement = charSet.getNominalCharIncrement();
+        if (nominalCharIncrement > 0) {
+            return nominalCharIncrement;
+        } else {
+            return inferCharWidth(character);
+        }
+    }
+
     private int inferCharWidth(int character) {
 
         //Is this character an ideograph?

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/OutlineFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/OutlineFont.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/OutlineFont.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/fonts/OutlineFont.java Thu Aug 16 13:31:38 2012
@@ -19,6 +19,8 @@
 
 package org.apache.fop.afp.fonts;
 
+import org.apache.fop.afp.AFPEventProducer;
+
 /**
  * Default implementation of AbstractOutlineFont.
  */
@@ -29,9 +31,11 @@ public class OutlineFont extends Abstrac
      * @param name font's name
      * @param embeddable whether or not this font is embeddable
      * @param charSet font's character set
+     * @param eventProducer Handles any AFP related events
      */
-    public OutlineFont(String name, boolean embeddable, CharacterSet charSet) {
-        super(name, embeddable, charSet);
+    public OutlineFont(String name, boolean embeddable, CharacterSet charSet,
+            AFPEventProducer eventProducer) {
+        super(name, embeddable, charSet, eventProducer);
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java Thu Aug 16 13:31:38 2012
@@ -34,7 +34,7 @@ import org.apache.fop.afp.util.AFPResour
  */
 public class IncludedResourceObject extends AbstractNamedAFPObject {
 
-    private AFPResourceAccessor resourceAccessor;
+    private final AFPResourceAccessor resourceAccessor;
     private URI uri;
 
     /**

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/util/AFPResourceAccessor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/util/AFPResourceAccessor.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/util/AFPResourceAccessor.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/afp/util/AFPResourceAccessor.java Thu Aug 16 13:31:38 2012
@@ -24,6 +24,9 @@ import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.apps.io.InternalResourceResolver;
 
 /**
@@ -31,46 +34,97 @@ import org.apache.fop.apps.io.InternalRe
  */
 public final class AFPResourceAccessor {
 
+    private static final Log log = LogFactory.getLog(AFPResourceAccessor.class);
+
     private final InternalResourceResolver resourceResolver;
-    private final String baseURI;
+    private final URI baseURI;
+    private final URIResolver uriResolver;
 
     /**
      * Constructor for resource to be accessed via the {@link org.apache.fop.apps.FOUserAgent}. This
      * contructor takes a base URI for resolving font resource URIs. So, if fonts need to be
-     * accessed, you can set the {@link FontManager}'s base URI instead of the one on the
-     * {@link org.apache.fop.apps.FopFactory}.
+     * accessed, you can set the {@link org.apache.fop.fonts.FontManager}'s base URI instead of the
+     * one on the {@link org.apache.fop.apps.FopFactory}.
      *
-     * @param InternalResourceResolver resource resolver
+     * @param resourceResolver the resolver of resources
      * @param baseURI the custom base URI to resolve relative URIs against (may be null)
      */
     public AFPResourceAccessor(InternalResourceResolver resourceResolver, String baseURI) {
         this.resourceResolver = resourceResolver;
-        this.baseURI = baseURI;
+        URI actualBaseURI = null;
+        URIResolver uriResolver;
+        if (baseURI == null) {
+            actualBaseURI = null;
+            uriResolver = new NullBaseURIResolver();
+        } else {
+            try {
+                actualBaseURI = InternalResourceResolver.getBaseURI(baseURI);
+                uriResolver = new BaseURIResolver();
+            } catch (URISyntaxException use) {
+                log.error("The URI given \"" + baseURI + "\" is invalid: " + use.getMessage());
+                actualBaseURI = null;
+                uriResolver = new NullBaseURIResolver();
+            }
+        }
+        this.baseURI = actualBaseURI;
+        this.uriResolver = uriResolver;
     }
 
     /**
      * Constructor for resource to be accessed via the {@link org.apache.fop.apps.FOUserAgent}.
      *
-     * @param InternalResourceResolver resource resolver
+     * @param resourceResolver the resolver of resources
      */
     public AFPResourceAccessor(InternalResourceResolver resourceResolver) {
         this(resourceResolver, null);
     }
 
-    private URI getResourceURI(URI uri) {
-        if (baseURI == null) {
+    /**
+     * Creates an {@link InputStream} given a URI.
+     *
+     * @param uri the URI of the InputStream
+     * @return an InputStream
+     * @throws IOException if an I/O error occurs while creating the InputStream.
+     */
+    public InputStream createInputStream(URI uri) throws IOException {
+        return resourceResolver.getResource(uriResolver.resolveURI(uri));
+    }
+
+    /**
+     * Returns the resolved URI, given the URI of a resource.
+     *
+     * @param uri the resource URI
+     * @return the resolved URI
+     */
+    public URI resolveURI(String uri) {
+        return uriResolver.resolveURI(uri);
+    }
+
+    private interface URIResolver {
+        URI resolveURI(URI uri);
+
+        URI resolveURI(String uri);
+    }
+
+    private final class NullBaseURIResolver implements URIResolver {
+
+        public URI resolveURI(URI uri) {
             return uri;
         }
-        try {
-            URI baseURI = InternalResourceResolver.getBaseURI(this.baseURI);
-            return baseURI.resolve(uri);
-        } catch (URISyntaxException use) {
-            return uri;
+
+        public URI resolveURI(String uri) {
+            return URI.create("./" + uri.trim());
         }
     }
 
-    /** {@inheritDoc} */
-    public InputStream createInputStream(URI uri) throws IOException {
-        return resourceResolver.getResource(getResourceURI(uri));
+    private final class BaseURIResolver implements URIResolver {
+
+        public URI resolveURI(URI uri) {
+            return baseURI.resolve(uri);
+        }
+
+        public URI resolveURI(String uri) {
+            return baseURI.resolve(uri.trim());
+        }
     }
 }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FOUserAgent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FOUserAgent.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FOUserAgent.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FOUserAgent.java Thu Aug 16 13:31:38 2012
@@ -166,7 +166,7 @@ public class FOUserAgent {
      * requires an output stream and you want to configure this very rendering run,
      * i.e. if you want to set some metadata like the title and author of the document
      * you want to render. In that case, create a new {@link FOUserAgent} instance
-     * using {@link #newFOUserAgent()}.
+     * using {@link org.apache.fop.apps.FopFactory#newFOUserAgent() newFOUserAgent()}.
      * <p>
      * MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
      * use the constants defined in {@link MimeConstants}.
@@ -184,7 +184,7 @@ public class FOUserAgent {
      * Returns a new {@link Fop} instance. Use this factory method if you want to configure this
      * very rendering run, i.e. if you want to set some metadata like the title and author of the
      * document you want to render. In that case, create a new {@link FOUserAgent}
-     * instance using {@link #newFOUserAgent()}.
+     * instance using {@link org.apache.fop.apps.FopFactory#newFOUserAgent() newFOUserAgent()}.
      * <p>
      * MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
      * use the constants defined in {@link MimeConstants}.
@@ -791,9 +791,8 @@ public class FOUserAgent {
         return factory.getColorSpaceCache();
     }
 
-    /** @see {@link FopFactory#getHyphenationPatternNames()} */
+    /** @see FopFactory#getHyphenationPatternNames() */
     public Map<String, String> getHyphenationPatternNames() {
         return factory.getHyphenationPatternNames();
     }
 }
-

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/Fop.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/Fop.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/Fop.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/Fop.java Thu Aug 16 13:31:38 2012
@@ -52,7 +52,7 @@ public class Fop {
     private OutputStream stream = null;
 
     // FOUserAgent object to set processing options
-    private FOUserAgent foUserAgent = null;
+    private final FOUserAgent foUserAgent;
 
     // FOTreeBuilder object to maintain reference for access to results
     private FOTreeBuilder foTreeBuilder = null;
@@ -81,6 +81,10 @@ public class Fop {
     /**
      * Get the FOUserAgent instance associated with the rendering run represented by this instance.
      * @return the user agent
+     *
+     * @deprecated this getter doesn't need to exist. By virtue of the fact that the client has
+     * an instance of this object, it means they also have the {@link FOUserAgent} since this's
+     * constructor is only used in {@link FOUserAgent}
      */
     public FOUserAgent getUserAgent() {
         return foUserAgent;

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopConfParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopConfParser.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopConfParser.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopConfParser.java Thu Aug 16 13:31:38 2012
@@ -142,12 +142,20 @@ public class FopConfParser {
             log.debug("Initializing FopFactory Configuration");
         }
 
-        // TODO: This makes this variable both strict FO and user-config validation, is that right?
-        boolean strict = false;
         // strict fo validation
         if (cfg.getChild("strict-validation", false) != null) {
             try {
-                strict = cfg.getChild("strict-validation").getValueAsBoolean();
+                boolean strict = cfg.getChild("strict-validation").getValueAsBoolean();
+                fopFactoryBuilder.setStrictFOValidation(strict);
+            } catch (ConfigurationException e) {
+                LogUtil.handleException(log, e, false);
+            }
+        }
+
+        boolean strict = false;
+        if (cfg.getChild("strict-configuration", false) != null) {
+            try {
+                strict = cfg.getChild("strict-configuration").getValueAsBoolean();
                 fopFactoryBuilder.setStrictUserConfigValidation(strict);
             } catch (ConfigurationException e) {
                 LogUtil.handleException(log, e, false);

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactory.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactory.java Thu Aug 16 13:31:38 2012
@@ -295,7 +295,7 @@ public final class FopFactory implements
      * @return the config object
      * @throws FOPException when an error occurs while creating the configuration object
      */
-    public RendererConfig getRendererConfig(FOUserAgent userAgent, Configuration cfg,
+    synchronized RendererConfig getRendererConfig(FOUserAgent userAgent, Configuration cfg,
             RendererConfigParser configCreator) throws FOPException {
         RendererConfig config = rendererConfig.get(configCreator.getMimeType());
         if (config == null) {
@@ -325,48 +325,41 @@ public final class FopFactory implements
         return config.isAccessibilityEnabled();
     }
 
-    /**
-     * Returns the image manager.
-     * @return the image manager
-     */
+    /** @see FopFactoryConfig#getImageManager() */
     public ImageManager getImageManager() {
         return config.getImageManager();
     }
 
-    /**
-     * Returns the overriding LayoutManagerMaker instance, if any.
-     * @return the overriding LayoutManagerMaker or null
-     */
+    /** @see FopFactoryConfig#getLayoutManagerMakerOverride() */
     public LayoutManagerMaker getLayoutManagerMakerOverride() {
         return config.getLayoutManagerMakerOverride();
     }
 
-    /** @return the hyphenation pattern names */
+    /** @see FopFactoryConfig#getHyphenationPatternNames() */
     public Map<String, String> getHyphenationPatternNames() {
         return config.getHyphenationPatternNames();
     }
 
-    /**
-     * Returns whether FOP is strictly validating input XSL
-     * @return true of strict validation turned on, false otherwise
-     */
+    /** @see FopFactoryConfig#validateStrictly() */
     public boolean validateStrictly() {
         return config.validateStrictly();
     }
 
-    /**
-     * @return true if the indent inheritance should be broken when crossing reference area
-     *         boundaries (for more info, see the javadoc for the relative member variable)
-     */
+    /** @see FopFactoryConfig#isBreakIndentInheritanceOnReferenceAreaBoundary() */
     public boolean isBreakIndentInheritanceOnReferenceAreaBoundary() {
         return config.isBreakIndentInheritanceOnReferenceAreaBoundary();
     }
 
-    /** @return the resolution for resolution-dependent input */
+    /** @see FopFactoryConfig#getSourceResolution() */
     public float getSourceResolution() {
         return config.getSourceResolution();
     }
 
+    /** @see FopFactoryConfig#getTargetResolution() */
+    public float getTargetResolution() {
+        return config.getTargetResolution();
+    }
+
     /**
      * Returns the conversion factor from pixel units to millimeters. This
      * depends on the desired source resolution.
@@ -377,11 +370,6 @@ public final class FopFactory implements
         return UnitConv.IN2MM / getSourceResolution();
     }
 
-    /** @return the resolution for resolution-dependant output */
-    public float getTargetResolution() {
-        return config.getTargetResolution();
-    }
-
     /**
      * Returns the conversion factor from pixel units to millimeters. This
      * depends on the desired target resolution.
@@ -392,42 +380,26 @@ public final class FopFactory implements
         return 25.4f / getTargetResolution();
     }
 
-    /**
-     * Gets the default page-height to use as fallback,
-     * in case page-height="auto"
-     *
-     * @return the page-height, as a String
-     */
+    /** @see FopFactoryConfig#getPageHeight() */
     public String getPageHeight() {
         return config.getPageHeight();
     }
 
-    /**
-     * Gets the default page-width to use as fallback,
-     * in case page-width="auto"
-     *
-     * @return the page-width, as a String
-     */
+    /** @see FopFactoryConfig#getPageWidth() */
     public String getPageWidth() {
         return config.getPageWidth();
     }
 
-    /**
-     * Indicates whether a namespace URI is on the ignored list.
-     * @param namespaceURI the namespace URI
-     * @return true if the namespace is ignored by FOP
-     */
+    /** @see FopFactoryConfig#isNamespaceIgnored(String) */
     public boolean isNamespaceIgnored(String namespaceURI) {
         return config.isNamespaceIgnored(namespaceURI);
     }
 
-    /** @return the set of namespaces that are ignored by FOP */
+    /** @see FopFactoryConfig#getIgnoredNamespaces() */
     public Set<String> getIgnoredNamespace() {
         return config.getIgnoredNamespaces();
     }
 
-    //------------------------------------------- Configuration stuff
-
     /**
      * Get the user configuration.
      * @return the user configuration
@@ -436,20 +408,12 @@ public final class FopFactory implements
         return config.getUserConfig();
     }
 
-    /**
-     * Is the user configuration to be validated?
-     * @return if the user configuration should be validated
-     */
+    /** @see FopFactoryConfig#validateUserConfigStrictly() */
     public boolean validateUserConfigStrictly() {
         return config.validateUserConfigStrictly();
     }
 
-    //------------------------------------------- Font related stuff
-
-    /**
-     * Returns the font manager.
-     * @return the font manager
-     */
+    /** @see FopFactoryConfig#getFontManager() */
     public FontManager getFontManager() {
         return config.getFontManager();
     }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryBuilder.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryBuilder.java Thu Aug 16 13:31:38 2012
@@ -61,7 +61,7 @@ public final class FopFactoryBuilder {
     /**
      * A builder class for {@link FopFactory} which can be used for setting configuration. This is
      * a helper constructor that uses the default URI resolver implementation that FOP packages
-     * provide ({@link DefaultResourceResolver}).
+     * provide ({@link org.apache.fop.apps.io.ResourceResolverFactory.DefaultResourceResolver}).
      *
      * @param defaultBaseURI the default base URI for resolving URIs against
      */
@@ -97,6 +97,17 @@ public final class FopFactoryBuilder {
      * @deprecated Exposing the {@link FopFactoryConfig} is only to maintain backwards compatibility
      */
     public FopFactoryConfig buildConfig() {
+        return buildConfiguration();
+    }
+
+    /**
+     * Builds the configuration object used by the FopFactory.
+     *
+     * @return the config for the {@link FopFactory}
+     */
+    // The {@link FopFactoryConfig} doesn't need to be exposed in the "public" API, this method
+    // should remain package private.
+    FopFactoryConfig buildConfiguration() {
         fopFactoryConfigBuilder = CompletedFopFactoryConfigBuilder.INSTANCE;
         return config;
     }
@@ -107,7 +118,7 @@ public final class FopFactoryBuilder {
      * @return the FopFactory instance
      */
     public FopFactory build() {
-        return FopFactory.newInstance(buildConfig());
+        return FopFactory.newInstance(buildConfiguration());
     }
 
     /**
@@ -150,13 +161,12 @@ public final class FopFactoryBuilder {
 
     /**
      * Sets the {@link LayoutManagerMaker} so that users can configure how FOP creates
-     * {@link LayoutManager}s.
+     * {@link org.apache.fop.layoutmgr.LayoutManager}s.
      *
      * @param lmMaker he layout manager maker
      * @return <code>this</code>
      */
-    public FopFactoryBuilder setLayoutManagerMakerOverride(
-            LayoutManagerMaker lmMaker) {
+    public FopFactoryBuilder setLayoutManagerMakerOverride(LayoutManagerMaker lmMaker) {
         fopFactoryConfigBuilder.setLayoutManagerMakerOverride(lmMaker);
         return this;
     }
@@ -285,11 +295,10 @@ public final class FopFactoryBuilder {
     }
 
     /**
-     * Sets whether to chose a {@link Renderer} in preference to an
+     * Sets whether to chose a {@link org.apache.fop.render.Renderer} in preference to an
      * {@link org.apache.fop.render.intermediate.IFDocumentHandler}.
      *
-     * @see {@link RendererFactory}
-     * @param preferRenderer true to prefer {@link Renderer}
+     * @param preferRenderer true to prefer {@link org.apache.fop.render.Renderer}
      * @return <code>this</code>
      */
     public FopFactoryBuilder setPreferRenderer(boolean preferRenderer) {

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryConfig.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryConfig.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryConfig.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/FopFactoryConfig.java Thu Aug 16 13:31:38 2012
@@ -34,6 +34,9 @@ import org.apache.fop.layoutmgr.LayoutMa
 /**
  * The configuration data for a {@link FopFactory} instance.
  */
+// TODO: Make this interface and any implementations of this interface package private. Though
+// they are used by classes that are considered the public API, this object doesn't need to be a
+// part of the API. Why would a user care how the internal objects are passed around? They shouldn't.
 public interface FopFactoryConfig {
 
     /** Defines if FOP should use an alternative rule to determine text indents */
@@ -64,7 +67,10 @@ public interface FopFactoryConfig {
      */
     boolean isAccessibilityEnabled();
 
-    /** @see {@link FopFactory#getLayoutManagerMakerOverride()} */
+    /**
+     * Returns the overriding LayoutManagerMaker instance, if any.
+     * @return the overriding LayoutManagerMaker or null
+     */
     LayoutManagerMaker getLayoutManagerMakerOverride();
 
     /**
@@ -81,31 +87,54 @@ public interface FopFactoryConfig {
      */
     URI getBaseURI();
 
-    /** @see {@link FopFactory#validateStrictly()} */
+    /**
+     * Returns whether FOP is strictly validating input XSL
+     * @return true of strict validation turned on, false otherwise
+     */
     boolean validateStrictly();
 
-    /** @see {@link FopFactory#validateUserConfigStrictly()} */
+    /**
+     * Is the user configuration to be validated?
+     * @return if the user configuration should be validated
+     */
     boolean validateUserConfigStrictly();
 
-    /** @see {@link FopFactory#isBreakIndentInheritanceOnReferenceAreaBoundary()} */
+    /**
+     * @return true if the indent inheritance should be broken when crossing reference area
+     * boundaries (for more info, see the javadoc for the relative member variable)
+     */
     boolean isBreakIndentInheritanceOnReferenceAreaBoundary();
 
-    /** @see {@link FopFactory#getSourceResolution()} */
+    /** @return the resolution for resolution-dependent input */
     float getSourceResolution();
 
-    /** @see {@link FopFactory#getTargetResolution()} */
+    /** @return the resolution for resolution-dependent output */
     float getTargetResolution();
 
-    /** @see {@link FopFactory#getPageHeight()} */
+    /**
+     * Gets the default page-height to use as fallback,
+     * in case page-height="auto"
+     *
+     * @return the page-height, as a String
+     */
     String getPageHeight();
 
-    /** @see {@link FopFactory#getPageWidth()} */
+    /**
+     * Gets the default page-width to use as fallback,
+     * in case page-width="auto"
+     *
+     * @return the page-width, as a String
+     */
     String getPageWidth();
 
-    /** @see {@link FopFactory#getIgnoredNamespace()} */
+    /** @return the set of namespaces that are ignored by FOP */
     Set<String> getIgnoredNamespaces();
 
-    /** @see {@link FopFactory#isNamespaceIgnored(String)} */
+    /**
+     * Indicates whether a namespace URI is on the ignored list.
+     * @param namespace the namespace URI
+     * @return true if the namespace is ignored by FOP
+     */
     boolean isNamespaceIgnored(String namespace);
 
     /**
@@ -115,17 +144,23 @@ public interface FopFactoryConfig {
      */
     Configuration getUserConfig();
 
-    /** @see {@link org.apache.fop.render.RendererFactory#isRendererPreferred()} */
+    /** @see org.apache.fop.render.RendererFactory#isRendererPreferred() */
     boolean preferRenderer();
 
-    /** @see {@link FopFactory#getFontManager()} */
+    /**
+     * Returns the font manager.
+     * @return the font manager
+     */
     FontManager getFontManager();
 
-    /** @see {@link FopFactory#getImageManager()} */
+    /**
+     * Returns the image manager.
+     * @return the image manager
+     */
     ImageManager getImageManager();
 
     boolean isComplexScriptFeaturesEnabled();
 
-    /** @see {@link FopFactory#getHyphenationPatternNames()} */
+    /** @return the hyphenation pattern names */
     Map<String, String> getHyphenationPatternNames();
 }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/ResourceResolverFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/ResourceResolverFactory.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/ResourceResolverFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/ResourceResolverFactory.java Thu Aug 16 13:31:38 2012
@@ -83,6 +83,15 @@ public final class ResourceResolverFacto
         return new TempAwareResourceResolver(tempResourceResolver, defaultResourceResolver);
     }
 
+    /**
+     * This creates the builder class for binding URI schemas to implementations of
+     * {@link ResourceResolver}. This allows users to define their own URI schemas such that they
+     * have finer control over the acquisition of resources.
+     *
+     * @param defaultResolver the default resource resolver that should be used in the event that
+     * none of the other registered resolvers match the schema
+     * @return the schema aware {@link ResourceResolver} builder
+     */
     public static SchemaAwareResourceResolverBuilder createSchemaAwareResourceResolverBuilder(
             ResourceResolver defaultResolver) {
         return new SchemaAwareResourceResolverBuilderImpl(defaultResolver);
@@ -99,10 +108,12 @@ public final class ResourceResolverFacto
                     new NormalResourceResolver());
         }
 
+        /** {@inheritDoc} */
         public Resource getResource(URI uri) throws IOException {
             return delegate.getResource(uri);
         }
 
+        /** {@inheritDoc} */
         public OutputStream getOutputStream(URI uri) throws IOException {
             return delegate.getOutputStream(uri);
         }
@@ -125,6 +136,7 @@ public final class ResourceResolverFacto
             return TempResourceURIGenerator.isTempUri(uri);
         }
 
+        /** {@inheritDoc} */
         public Resource getResource(URI uri) throws IOException {
             if (isTempUri(uri)) {
                 return tempResourceResolver.getResource(uri.getPath());
@@ -133,6 +145,7 @@ public final class ResourceResolverFacto
             }
         }
 
+        /** {@inheritDoc} */
         public OutputStream getOutputStream(URI uri) throws IOException {
             if (isTempUri(uri)) {
                 return tempResourceResolver.getOutputStream(uri.getPath());
@@ -140,7 +153,6 @@ public final class ResourceResolverFacto
                 return defaultResourceResolver.getOutputStream(uri);
             }
         }
-
     }
 
     private static class DefaultTempResourceResolver implements TempResourceResolver {
@@ -150,10 +162,12 @@ public final class ResourceResolverFacto
             return file;
         }
 
+        /** {@inheritDoc} */
         public Resource getResource(String id) throws IOException {
             return new Resource(getTempFile(id).toURI().toURL().openStream());
         }
 
+        /** {@inheritDoc} */
         public OutputStream getOutputStream(String id) throws IOException {
             File file = getTempFile(id);
             if (file.createNewFile()) {
@@ -196,19 +210,52 @@ public final class ResourceResolverFacto
             }
         }
 
+        /** {@inheritDoc} */
         public Resource getResource(URI uri) throws IOException {
             return getResourceResolverForSchema(uri).getResource(uri);
         }
 
+        /** {@inheritDoc} */
         public OutputStream getOutputStream(URI uri) throws IOException {
             return getResourceResolverForSchema(uri).getOutputStream(uri);
         }
     }
 
+    /**
+     * Implementations of this interface will be builders for {@link ResourceResolver}, they bind
+     * URI schemas to their respective resolver. This gives users more control over the mechanisms
+     * by which URIs are resolved.
+     * <p>
+     * Here is an example of how this could be used:
+     * </p>
+     * <p><code>
+     * SchemaAwareResourceResolverBuilder builder
+     *      = ResourceResolverFactory.createSchemaAwareResourceResolverBuilder(defaultResolver);
+     * builder.registerResourceResolverForSchema("test", testResolver);
+     * builder.registerResourceResolverForSchema("anotherTest", test2Resolver);
+     * ResourceResolver resolver = builder.build();
+     * </code></p>
+     * This will result in all URIs for the form "test:///..." will be resolved using the
+     * <code>testResolver</code> object; URIs of the form "anotherTest:///..." will be resolved
+     * using <code>test2Resolver</code>; all other URIs will be resolved from the defaultResolver.
+     */
     public interface SchemaAwareResourceResolverBuilder {
 
+        /**
+         * Register a schema with its respective {@link ResourceResolver}. This resolver will be
+         * used as the only resolver for the specified schema.
+         *
+         * @param schema the schema to be used with the given resolver
+         * @param resourceResolver the resource resolver
+         */
         void registerResourceResolverForSchema(String schema, ResourceResolver resourceResolver);
 
+        /**
+         * Builds a {@link ResourceResolver} that will delegate to the respective resource resolver
+         * when a registered URI schema is given
+         *
+         * @return a resolver that delegates to the appropriate schema resolver
+         */
         ResourceResolver build();
     }
 
@@ -218,10 +265,12 @@ public final class ResourceResolverFacto
         private static final SchemaAwareResourceResolverBuilder INSTANCE
                 = new CompletedSchemaAwareResourceResolverBuilder();
 
+        /** {@inheritDoc} */
         public ResourceResolver build() {
             throw new IllegalStateException("Resource resolver already built");
         }
 
+        /** {@inheritDoc} */
         public void registerResourceResolverForSchema(String schema,
                 ResourceResolver resourceResolver) {
             throw new IllegalStateException("Resource resolver already built");
@@ -240,11 +289,13 @@ public final class ResourceResolverFacto
             this.defaultResolver = defaultResolver;
         }
 
+        /** {@inheritDoc} */
         public void registerResourceResolverForSchema(String schema,
                 ResourceResolver resourceResolver) {
             schemaHandlingResourceResolvers.put(schema, resourceResolver);
         }
 
+        /** {@inheritDoc} */
         public ResourceResolver build() {
             return new SchemaAwareResourceResolver(
                     Collections.unmodifiableMap(schemaHandlingResourceResolvers), defaultResolver);
@@ -261,11 +312,13 @@ public final class ResourceResolverFacto
             this.delegate = new ActiveSchemaAwareResourceResolverBuilder(defaultResolver);
         }
 
+        /** {@inheritDoc} */
         public void registerResourceResolverForSchema(String schema,
                 ResourceResolver resourceResolver) {
             delegate.registerResourceResolverForSchema(schema, resourceResolver);
         }
 
+        /** {@inheritDoc} */
         public ResourceResolver build() {
             ResourceResolver resourceResolver = delegate.build();
             delegate = CompletedSchemaAwareResourceResolverBuilder.INSTANCE;

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/TempResourceResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/TempResourceResolver.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/TempResourceResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/apps/io/TempResourceResolver.java Thu Aug 16 13:31:38 2012
@@ -35,7 +35,7 @@ public interface TempResourceResolver {
      * @return the resource
      * @throws IOException if an I/O error occured during resource acquisition
      */
-    Resource getResource(String id) throws IOException;
+    Resource getResource(String uri) throws IOException;
 
     /**
      * Gets an temporary-output stream of a given URI.
@@ -44,5 +44,5 @@ public interface TempResourceResolver {
      * @return the output stream
      * @throws IOException if an I/O error occured while creating an output stream
      */
-    OutputStream getOutputStream(String id) throws IOException;
+    OutputStream getOutputStream(String uri) throws IOException;
 }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/cli/CommandLineOptions.java Thu Aug 16 13:31:38 2012
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.net.URI;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Vector;
@@ -42,6 +43,7 @@ import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FopConfParser;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.FopFactoryBuilder;
+import org.apache.fop.apps.FopFactoryConfig;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.pdf.PDFAMode;
 import org.apache.fop.pdf.PDFEncryptionManager;
@@ -116,7 +118,7 @@ public class CommandLineOptions {
     /* rendering options (for the user agent) */
     private Map renderingOptions = new java.util.HashMap();
     /* target resolution (for the user agent) */
-    private int targetResolution = 0;
+    private float targetResolution = FopFactoryConfig.DEFAULT_TARGET_RESOLUTION;
 
     private boolean strictValidation = true;
     /* control memory-conservation policy */
@@ -137,6 +139,8 @@ public class CommandLineOptions {
 
     private boolean flushCache = false;
 
+    private URI baseURI = new File(".").getAbsoluteFile().toURI();
+
     /**
      * Construct a command line option object.
      */
@@ -465,6 +469,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 fofile = new File(filename);
+                baseURI = getBaseURI(fofile);
             }
             return 1;
         }
@@ -494,11 +499,16 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 xmlfile = new File(filename);
+                baseURI = getBaseURI(xmlfile);
             }
             return 1;
         }
     }
 
+    private URI getBaseURI(File file) {
+        return file.getAbsoluteFile().getParentFile().toURI();
+    }
+
     private int parseAWTOutputOption(String[] args, int i) throws FOPException {
         setOutputMode(MimeConstants.MIME_FOP_AWT_PREVIEW);
         return 0;
@@ -725,6 +735,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 fofile = new File(filename);
+                baseURI = getBaseURI(fofile);
             }
         } else if (outputmode == null) {
             outputmode = MimeConstants.MIME_PDF;
@@ -783,6 +794,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 areatreefile = new File(filename);
+                baseURI = getBaseURI(areatreefile);
             }
             return 1;
         }
@@ -799,6 +811,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 iffile = new File(filename);
+                baseURI = getBaseURI(iffile);
             }
             return 1;
         }
@@ -815,6 +828,7 @@ public class CommandLineOptions {
                 this.useStdIn = true;
             } else {
                 imagefile = new File(filename);
+                baseURI = getBaseURI(imagefile);
             }
             return 1;
         }
@@ -1030,15 +1044,22 @@ public class CommandLineOptions {
     private void setUserConfig() throws FOPException, IOException {
         FopFactoryBuilder fopFactoryBuilder;
         if (userConfigFile == null) {
-            fopFactoryBuilder = new FopFactoryBuilder(new File(".").toURI());
+            fopFactoryBuilder = new FopFactoryBuilder(baseURI);
+            fopFactoryBuilder.setStrictFOValidation(strictValidation);
+            fopFactoryBuilder.setTargetResolution(targetResolution);
+            fopFactoryBuilder.setComplexScriptFeatures(useComplexScriptFeatures);
         } else {
             try {
                 fopFactoryBuilder = new FopConfParser(userConfigFile).getFopFactoryBuilder();
             } catch (SAXException e) {
                 throw new FOPException(e);
             }
-            fopFactoryBuilder.setStrictFOValidation(strictValidation);
-            fopFactoryBuilder.setComplexScriptFeatures(useComplexScriptFeatures);
+            if (!strictValidation) {
+                fopFactoryBuilder.setStrictFOValidation(strictValidation);
+            }
+            if (useComplexScriptFeatures) {
+                fopFactoryBuilder.setComplexScriptFeatures(useComplexScriptFeatures);
+            }
         }
         factory = fopFactoryBuilder.build();
      }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfig.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfig.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfig.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfig.java Thu Aug 16 13:31:38 2012
@@ -89,7 +89,7 @@ public final class DefaultFontConfig imp
             } else {
                 this.strict = strict;
                 this.fontInfoCfg = cfg.getChild("fonts", false);
-                instance = new DefaultFontConfig(cfg.getChild("auto-detect", false) != null);
+                instance = new DefaultFontConfig(fontInfoCfg.getChild("auto-detect", false) != null);
                 parse();
             }
         }

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java Thu Aug 16 13:31:38 2012
@@ -52,7 +52,6 @@ public class DefaultFontConfigurator imp
 
     /**
      * Main constructor
-     * @param fontInfoConfig the configuration object
      * @param fontManager the font manager
      * @param listener the font event listener
      * @param strict true if an Exception should be thrown if an error is found.

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontCache.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontCache.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontCache.java Thu Aug 16 13:31:38 2012
@@ -53,7 +53,7 @@ public final class FontCache implements 
      * Serialization Version UID. Change this value if you want to make sure the
      * user's cache file is purged after an update.
      */
-    private static final long serialVersionUID = 605232520271754719L;
+    private static final long serialVersionUID = 9129238336422194339L;
 
     /** logging instance */
     private static Log log = LogFactory.getLog(FontCache.class);
@@ -65,7 +65,7 @@ public final class FontCache implements 
     private static final String DEFAULT_CACHE_FILENAME = "fop-fonts.cache";
 
     /** has this cache been changed since it was last read? */
-    private transient boolean changed = false;
+    private transient boolean changed;
 
     /** change lock */
     private final boolean[] changeLock = new boolean[1];
@@ -73,12 +73,14 @@ public final class FontCache implements 
     /**
      * master mapping of font url -> font info. This needs to be a list, since a
      * TTC file may contain more than 1 font.
+     * @serial
      */
     private Map<String, CachedFontFile> fontfileMap = null;
 
     /**
      * mapping of font url -> file modified date (for all fonts that have failed
      * to load)
+     * @serial
      */
     private Map<String, Long> failedFontMap = null;
 
@@ -139,6 +141,7 @@ public final class FontCache implements 
      *
      * @return the font cache deserialized from the file (or null if no cache
      *         file exists or if it could not be read)
+     * @deprecated use {@link #loadFrom(File)} instead
      */
     public static FontCache load() {
         return loadFrom(getDefaultCacheFile(false));
@@ -190,8 +193,8 @@ public final class FontCache implements 
     /**
      * Writes the font cache to disk.
      *
-     * @throws FOPException
-     *             fop exception
+     * @throws FOPException fop exception
+     * @deprecated use {@link #saveTo(File)} instead
      */
     public void save() throws FOPException {
         saveTo(getDefaultCacheFile(true));
@@ -462,10 +465,9 @@ public final class FontCache implements 
     }
 
     /**
-     * Retrieve the last modified date/time of a URL.
+     * Retrieve the last modified date/time of a URI.
      *
-     * @param url
-     *            the URL
+     * @param uri the URI
      * @return the last modified date/time
      */
     public static long getLastModified(URI uri) {

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/fonts/FontManager.java Thu Aug 16 13:31:38 2012
@@ -138,7 +138,6 @@ public class FontManager {
 
     /**
      * Whether or not to cache results of font triplet detection/auto-config
-     * @param useCache use cache or not
      */
     public void disableFontCache() {
         fontCacheManager = FontCacheManagerFactory.createDisabled();
@@ -163,8 +162,7 @@ public class FontManager {
 
     /**
      * Deletes the current FontCache file
-     * @return Returns true if the font cache file was successfully deleted.
-     * @throws FOPException -
+     * @throws FOPException if an error was thrown while deleting the cache
      */
     public void deleteCache() throws FOPException {
         fontCacheManager.delete(getCacheFile(true));

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Thu Aug 16 13:31:38 2012
@@ -329,7 +329,7 @@ public abstract class AbstractBreaker {
      * @return the top-level LayoutContext
      */
     protected LayoutContext createLayoutContext() {
-        return new LayoutContext(0);
+        return LayoutContext.newInstance();
     }
 
     /**
@@ -481,6 +481,11 @@ public abstract class AbstractBreaker {
         addAreas(alg, 0, partCount, originalList, effectiveList);
     }
 
+    protected void addAreas(PageBreakingAlgorithm alg, int startPart, int partCount,
+            BlockSequence originalList, BlockSequence effectiveList) {
+        addAreas(alg, startPart, partCount, originalList, effectiveList, LayoutContext.newInstance());
+    }
+
     /**
      * Phase 3 of Knuth algorithm: Adds the areas
      * @param alg PageBreakingAlgorithm instance which determined the breaks
@@ -490,9 +495,7 @@ public abstract class AbstractBreaker {
      * @param effectiveList effective Knuth element list (after adjustments)
      */
     protected void addAreas(PageBreakingAlgorithm alg, int startPart, int partCount,
-            BlockSequence originalList, BlockSequence effectiveList) {
-        LayoutContext childLC;
-        // add areas
+            BlockSequence originalList, BlockSequence effectiveList, final LayoutContext childLC) {
         int startElementIndex = 0;
         int endElementIndex = 0;
         int lastBreak = -1;
@@ -507,7 +510,17 @@ public abstract class AbstractBreaker {
                 ListElement lastBreakElement = effectiveList.getElement(endElementIndex);
                 if (lastBreakElement.isPenalty()) {
                     KnuthPenalty pen = (KnuthPenalty)lastBreakElement;
-                    lastBreakClass = pen.getBreakClass();
+                    if (pen.getPenalty() == KnuthPenalty.INFINITE) {
+                        /**
+                         * That means that there was a keep.within-page="always", but that
+                         * it's OK to break at a column. TODO The break class is being
+                         * abused to implement keep.within-column and keep.within-page.
+                         * This is very misleading and must be revised.
+                         */
+                        lastBreakClass = Constants.EN_COLUMN;
+                    } else {
+                        lastBreakClass = pen.getBreakClass();
+                    }
                 } else {
                     lastBreakClass = Constants.EN_COLUMN;
                 }
@@ -550,19 +563,13 @@ public abstract class AbstractBreaker {
 
             // ignore KnuthGlue and KnuthPenalty objects
             // at the beginning of the line
-            ListIterator<KnuthElement> effectiveListIterator
-                = effectiveList.listIterator(startElementIndex);
-            while (effectiveListIterator.hasNext()
-                    && !(effectiveListIterator.next()).isBox()) {
-                startElementIndex++;
-            }
+            startElementIndex = alg.par.getFirstBoxIndex(startElementIndex);
 
             if (startElementIndex <= endElementIndex) {
                 if (log.isDebugEnabled()) {
                     log.debug("     addAreas from " + startElementIndex
                             + " to " + endElementIndex);
                 }
-                childLC = new LayoutContext(0);
                 // set the space adjustment ratio
                 childLC.setSpaceAdjust(pbp.bpdAdjust);
                 // add space before if display-align is center or bottom
@@ -576,7 +583,9 @@ public abstract class AbstractBreaker {
                         && p < (partCount - 1)) {
                     // count the boxes whose width is not 0
                     int boxCount = 0;
-                    effectiveListIterator = effectiveList.listIterator(startElementIndex);
+                    @SuppressWarnings("unchecked")
+                    ListIterator<KnuthElement> effectiveListIterator = effectiveList
+                            .listIterator(startElementIndex);
                     while (effectiveListIterator.nextIndex() <= endElementIndex) {
                         KnuthElement tempEl = effectiveListIterator.next();
                         if (tempEl.isBox() && tempEl.getWidth() > 0) {

Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Thu Aug 16 13:31:38 2012
@@ -40,7 +40,7 @@ public final class AreaAdditionUtil {
     public static void addAreas(BlockStackingLayoutManager bslm,
             PositionIterator parentIter, LayoutContext layoutContext) {
         LayoutManager childLM;
-        LayoutContext lc = new LayoutContext(0);
+        LayoutContext lc = LayoutContext.offspringOf(layoutContext);
         LayoutManager firstLM = null;
         LayoutManager lastLM = null;
         Position firstPos = null;



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