You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/11/21 19:17:49 UTC

svn commit: r719664 [1/2] - in /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign: ./ lib/ src/documentation/ src/documentation/content/xdocs/ src/documentation/content/xdocs/0.95/ src/documentation/content/xdocs/trunk/ src/java/META-INF/services/ src/ja...

Author: jeremias
Date: Fri Nov 21 10:17:47 2008
New Revision: 719664

URL: http://svn.apache.org/viewvc?rev=719664&view=rev
Log:
Merged from Trunk revisions 706551 to 719661.

Added:
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java
      - copied unchanged from r719661, xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFLaunch.java
      - copied unchanged from r719661, xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFLaunch.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/test/layoutengine/standard-testcases/block-container_area-bpd.xml
      - copied unchanged from r719661, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_area-bpd.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/test/layoutengine/standard-testcases/block_break-before_bug46240.xml
      - copied unchanged from r719661, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_break-before_bug46240.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/test/layoutengine/standard-testcases/external-graphic_wmf.xml
      - copied unchanged from r719661, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/external-graphic_wmf.xml
Removed:
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/cocoon.diff
Modified:
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/lib/xmlgraphics-commons-1.4svn.jar
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/0.95/graphics.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/faq.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/skinconf.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Block.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/XMLObj.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCache.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontSetup.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/truetype/TTFFile.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutContext.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFDocument.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFFactory.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSetOrientation.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/FopCharacterSet.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/OutlineFont.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/RasterFont.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFContentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/PSSVGHandler.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/status.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/test/layoutengine/standard-testcases/external-graphic_svg.xml
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/xmlgraphics-fop-pom-template.pom

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1,2 +1,2 @@
 /xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
-/xmlgraphics/fop/trunk:603620-706550
+/xmlgraphics/fop/trunk:603620-719661

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/lib/xmlgraphics-commons-1.4svn.jar
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/lib/xmlgraphics-commons-1.4svn.jar?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/0.95/graphics.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/0.95/graphics.xml?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/0.95/graphics.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/0.95/graphics.xml Fri Nov 21 10:17:47 2008
@@ -554,10 +554,14 @@
         changing dummy parameter on the URI to avoid caching.
       </p>
       <p>
-        The image cache has been improved considerably in the redesigned code. Therefore, a 
-        resetCache() method like in earlier versions of FOP has become unnecessary. If you 
+        The image cache has been improved considerably in the redesigned code. Therefore,
+        resetting the image cache should be a thing of the past. If you 
         still experience OutOfMemoryErrors, please notify us.
       </p>
+      <p>
+        If all else fails, the image cache can be cleared like this:
+        <code>fopFactory.getImageManager().getCache().clearCache();</code>
+      </p>
     </section>
   </body>
 </document>

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/faq.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/faq.xml?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/faq.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/faq.xml Fri Nov 21 10:17:47 2008
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
@@ -426,6 +426,28 @@
 }]]></source>
       </answer>
     </faq>
+    <faq>
+      <question>The following message appears after recently upgrading FOP:
+        "I/O exception while reading font cache (org.apache.fop.fonts.EmbedFontInfo;
+        local class incompatible: stream classdesc serialVersionUID =
+        -9075848379822693399, local class serialVersionUID = 8755432068669997367).
+        Discarding font cache file."</question>
+      <answer>
+        <p>
+          This message is a warning that FOP failed to read from the Font cache. 
+          Which means any Font auto detection or Font directories will be re-scanned. 
+          So this failure doesn't break anything.
+        </p>
+        <p>
+           To avoid the warning you can simply delete the
+           old Font Cache file, which according to [1] lives in ${base}\conf\font.cache.
+           Or you can disable Font Caching altogether using the option "use-cache"
+        </p>
+        <p>
+          [1] http://xmlgraphics.apache.org/fop/0.94/configuration.html#general-elements
+        </p>
+      </answer>
+    </faq>
   </part>
   <part id="part-output">
     <title>Problems with FOP output</title>
@@ -617,15 +639,25 @@
           <link href="http://www.mulberrytech.com/xsl/xsl-list/">XSL list
           archive</link> for how to perform these tasks.
         </p>
-        <p>
-          If your text is not hyphenated at all and overflows the cell, please check
-          if you've specified <code>keep-together="always"</code> on the table-cell
-          or one of its parent elements. <code>keep-together="always"</code> implicitely
-          also sets <code>keep-together.within-line="always"</code> which forbids FOP
-          to break the text into multiple lines. This is important as FOP supports inline-level
-          keeps since version 0.94. It's a good idea not to use the shorthand
-          <code>keep-together="always"</code> at all!
-        </p>
+      </answer>
+    </faq>
+    <faq id="table-cell-wrap">
+      <question>The contents of table cells don’t wrap</question>
+      <answer>
+        <p>You probably have <code>keep-together="always"</code> set on the table cell. See <link 
+            href="#keep-together">next question</link>.</p>
+      </answer>
+    </faq>
+    <faq id="keep-together">
+      <question>FOP 0.95 and FOP 0.94 behave differently when <code>keep-together="always"</code> 
+        is set on table cells</question>
+      <answer>
+        <p>Support for inline-level keeps has been added in FOP 0.95, and setting 
+          <code>keep-together="always"</code> also implicitly sets 
+          <code>keep-together.within-line="always"</code>, which forbids FOP
+          to break the text into multiple lines. Set 
+          <code>keep-together.within-column="always"</code> on table-cell instead. It’s a good idea 
+          not to use the shorthand <code>keep-together="always"</code> at all!</p>
       </answer>
     </faq>
     <faq id="row-height-constraint">

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/content/xdocs/trunk/graphics.xml Fri Nov 21 10:17:47 2008
@@ -554,10 +554,14 @@
         changing dummy parameter on the URI to avoid caching.
       </p>
       <p>
-        The image cache has been improved considerably in the redesigned code. Therefore, a 
-        resetCache() method like in earlier versions of FOP has become unnecessary. If you 
+        The image cache has been improved considerably in the redesigned code. Therefore,
+        resetting the image cache should be a thing of the past. If you 
         still experience OutOfMemoryErrors, please notify us.
       </p>
+      <p>
+        If all else fails, the image cache can be cleared like this:
+        <code>fopFactory.getImageManager().getCache().clearCache();</code>
+      </p>
     </section>
   </body>
 </document>

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/skinconf.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/skinconf.xml?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/skinconf.xml (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/documentation/skinconf.xml Fri Nov 21 10:17:47 2008
@@ -369,19 +369,17 @@
       <width>88</width>
       <height>31</height>
     </credit>
-    <!--
     <credit box-location="alt2">
-      <name>ApacheCon Europe 2008</name>
+      <name>ApacheCon Europe 2009</name>
       <url>http://eu.apachecon.com/</url>
-      <image>http://apache.org/ads/ApacheCon/2008-europe-125x125.png</image>
+      <image>http://apache.org/ads/ApacheCon/2009-europe-125x125.png</image>
       <width>125</width>
       <height>125</height>
     </credit>
-    -->
     <credit box-location="alt2">
-      <name>ApacheCon US 2008</name>
+      <name>ApacheCon US 2009</name>
       <url>http://us.apachecon.com/</url>
-      <image>http://apache.org/ads/ApacheCon/2008-usa-125x125.png</image>
+      <image>http://apache.org/ads/ApacheCon/2009-usa-125x125.png</image>
       <width>125</width>
       <height>125</height>
     </credit>

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:699793-706550
+/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:699793-719661

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Block.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Block.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Block.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/area/Block.java Fri Nov 21 10:17:47 2008
@@ -79,7 +79,7 @@
      * @param autoHeight increase the height of the block.
      */
     public void addBlock(Block block, boolean autoHeight) {
-        if (autoHeight && allowBPDUpdate) {
+        if (autoHeight && allowBPDUpdate && block.isStacked()) {
             bpd += block.getAllocBPD();
         }
         addChildArea(block);

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/XMLObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/XMLObj.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/XMLObj.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/XMLObj.java Fri Nov 21 10:17:47 2008
@@ -217,6 +217,7 @@
     /** {@inheritDoc} */
     public void notifyObjectBuilt(Object obj) {
         this.doc = (Document)obj;
+        this.element = this.doc.getDocumentElement();
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java Fri Nov 21 10:17:47 2008
@@ -20,35 +20,27 @@
 package org.apache.fop.fo.extensions.svg;
 
 // FOP
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.util.ContentHandlerFactory;
-import org.apache.fop.util.DOMBuilderContentHandlerFactory;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.net.URL;
+
+import org.w3c.dom.Element;
 
+import org.apache.batik.bridge.UnitProcessor;
+import org.apache.batik.dom.svg.SVGContext;
+import org.apache.batik.dom.svg.SVGDOMImplementation;
 import org.apache.batik.dom.svg.SVGOMDocument;
 import org.apache.batik.dom.svg.SVGOMElement;
-import org.apache.batik.dom.svg.SVGContext;
 import org.apache.batik.dom.util.XMLSupport;
-import org.w3c.dom.Element;
-import org.w3c.dom.svg.SVGDocument;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.apache.batik.bridge.UnitProcessor;
 import org.apache.batik.util.SVGConstants;
 
-import org.w3c.dom.DOMImplementation;
-
-import org.apache.batik.dom.svg.SVGDOMImplementation;
-
-import java.net.URL;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.util.ContentHandlerFactory;
 
 /**
- * class representing the SVG root element
- * for constructing an svg document.
+ * Class representing the SVG root element
+ * for constructing an SVG document.
  */
 public class SVGElement extends SVGObj {
 
@@ -61,21 +53,9 @@
         super(parent);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public ContentHandlerFactory getContentHandlerFactory() {
-        return new DOMBuilderContentHandlerFactory(getNamespaceURI(),
-                SVGDOMImplementation.getDOMImplementation());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void processNode(String elementName, Locator locator,
-                            Attributes attlist, PropertyList propertyList) throws FOPException {
-        super.processNode(elementName, locator, attlist, propertyList);
-        init();
+        return new SVGDOMContentHandlerFactory();
     }
 
     /**
@@ -104,7 +84,6 @@
             log.error("Could not set base URL for svg", e);
         }
 
-        Element e = ((SVGDocument)doc).getRootElement();
         final float ptmm = getUserAgent().getSourcePixelUnitToMillimeter();
         // temporary svg context
         SVGContext dc = new SVGContext() {
@@ -157,7 +136,8 @@
             public void deselectAll() {
             }
         };
-        ((SVGOMElement)e).setSVGContext(dc);
+        SVGOMElement e = (SVGOMElement)svgRoot;
+        e.setSVGContext(dc);
 
         //if (!e.hasAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns")) {
             e.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
@@ -165,21 +145,11 @@
         //}
         int fontSize = 12;
         Point2D p2d = getSize(fontSize, svgRoot, getUserAgent().getSourcePixelUnitToMillimeter());
-       ((SVGOMElement)e).setSVGContext(null);
+        e.setSVGContext(null);
 
         return p2d;
     }
 
-    private void init() {
-        DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
-        String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
-        doc = impl.createDocument(svgNS, "svg", null);
-
-        element = doc.getDocumentElement();
-
-        buildTopLevel(doc, element);
-    }
-
     /**
      * Get the size of the SVG root element.
      * @param size the font size

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/Font.java Fri Nov 21 10:17:47 2008
@@ -64,16 +64,16 @@
     /** logger */
     private  static Log log = LogFactory.getLog(Font.class);
 
-    private String fontName;
-    private FontTriplet triplet;
-    private int fontSize;
+    private final String fontName;
+    private final FontTriplet triplet;
+    private final int fontSize;
 
     /**
      * normal or small-caps font
      */
     //private int fontVariant;
 
-    private FontMetrics metric;
+    private final FontMetrics metric;
 
     /**
      * Main constructor
@@ -268,7 +268,8 @@
             width = getCharWidth(' ');
         } else {
             if (hasChar(c)) {
-                width = getWidth(mapChar(c));
+                int mappedChar = mapChar(c);
+                width = getWidth(mappedChar);
             } else {
                 width = -1;
             }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCache.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCache.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontCache.java Fri Nov 21 10:17:47 2008
@@ -48,7 +48,7 @@
      * 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 = 605232520271754718L;
+    private static final long serialVersionUID = 605232520271754719L;
 
     /** logging instance */
     private static Log log = LogFactory.getLog(FontCache.class);
@@ -64,7 +64,7 @@
     private transient boolean changed = false;
 
     /** change lock */
-    private transient Object changeLock = new Object();
+    private final boolean[] changeLock = new boolean[1];
 
     /** master mapping of font url -> font info.  This needs to be
      *  a list, since a TTC file may contain more than 1 font. */
@@ -80,12 +80,6 @@
         //nop
     }
 
-    private void readObject(java.io.ObjectInputStream in)
-            throws IOException, ClassNotFoundException {
-        in.defaultReadObject();
-        this.changeLock = new Object(); //Initialize transient field
-    }
-
     private static File getUserHome() {
         String s = System.getProperty("user.home");
         if (s != null) {
@@ -226,10 +220,8 @@
      * @return boolean
      */
     public boolean containsFont(String embedUrl) {
-        if (embedUrl != null) {
-            return getFontFileMap().containsKey(embedUrl);
-        }
-        return false;
+        return (embedUrl != null
+                && getFontFileMap().containsKey(embedUrl));
     }
 
     /**
@@ -238,10 +230,8 @@
      * @return font
      */
     public boolean containsFont(EmbedFontInfo fontInfo) {
-        if (fontInfo != null) {
-            return getFontFileMap().containsKey(getCacheKey(fontInfo));
-        }
-        return false;
+        return (fontInfo != null
+                && getFontFileMap().containsKey(getCacheKey(fontInfo)));
     }
 
     /**
@@ -316,10 +306,7 @@
      * @return CachedFontFile object
      */
     public CachedFontFile getFontFile(String embedUrl) {
-        if (containsFont(embedUrl)) {
-            return (CachedFontFile)getFontFileMap().get(embedUrl);
-        }
-        return null;
+        return containsFont(embedUrl) ? (CachedFontFile) getFontFileMap().get(embedUrl) : null;
     }
 
     /**
@@ -362,8 +349,8 @@
      * @return whether this is a failed font
      */
     public boolean isFailedFont(String embedUrl, long lastModified) {
-        if (getFailedFontMap().containsKey(embedUrl)) {
-            synchronized (changeLock) {
+        synchronized (changeLock) {
+            if (getFailedFontMap().containsKey(embedUrl)) {
                 long failedLastModified = ((Long)getFailedFontMap().get(embedUrl)).longValue();
                 if (lastModified != failedLastModified) {
                     // this font has been changed so lets remove it
@@ -371,10 +358,11 @@
                     getFailedFontMap().remove(embedUrl);
                     changed = true;
                 }
+                return true;
+            } else {
+                return false;
             }
-            return true;
         }
-        return false;
     }
 
     /**
@@ -457,10 +445,8 @@
         }
 
         public boolean containsFont(EmbedFontInfo efi) {
-            if (efi.getPostScriptName() != null) {
-                return getFileFontsMap().containsKey(efi.getPostScriptName());
-            }
-            return false;
+            return efi.getPostScriptName() != null
+                    && getFileFontsMap().containsKey(efi.getPostScriptName());
         }
 
         public EmbedFontInfo[] getEmbedFontInfos() {

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontSetup.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontSetup.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontSetup.java Fri Nov 21 10:17:47 2008
@@ -27,7 +27,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.fonts.base14.Courier;
 import org.apache.fop.fonts.base14.CourierBold;
 import org.apache.fop.fonts.base14.CourierBoldOblique;
@@ -202,7 +201,7 @@
 
         if (resolver == null) {
             //Ensure that we have minimal font resolution capabilities
-            resolver = createMinimalFontResolver1();
+            resolver = createMinimalFontResolver();
         }
 
         String internalName = null;
@@ -225,7 +224,7 @@
     }
 
     /** @return a new FontResolver to be used by the font subsystem */
-    public static FontResolver createMinimalFontResolver1() {
+    public static FontResolver createMinimalFontResolver() {
         return new FontResolver() {
 
             /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/truetype/TTFFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/truetype/TTFFile.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/truetype/TTFFile.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/truetype/TTFFile.java Fri Nov 21 10:17:47 2008
@@ -1248,10 +1248,11 @@
             }
         }
 
-        log.debug("Font box height: " + (ascender - descender));
-        if (ascender - descender > upem) {
-            log.warn("Ascender and descender together are larger than the em box."
-                    + " This could lead to a wrong baseline placement in Apache FOP.");
+        if (log.isDebugEnabled()) {
+            log.debug("Font box height: " + (ascender - descender));
+            if (ascender - descender > upem) {
+                log.debug("Ascender and descender together are larger than the em box.");
+            }
         }
     }
 
@@ -1259,7 +1260,7 @@
         // Approximate capHeight from height of "H"
         // It's most unlikely that a font misses the PCLT table
         // This also assumes that postscriptnames exists ("H")
-        // Should look it up int the cmap (that wouldn't help
+        // Should look it up in the cmap (that wouldn't help
         // for charsets without H anyway...)
         // Same for xHeight with the letter "x"
         int localCapHeight = 0;
@@ -1294,10 +1295,12 @@
                 }
             }
         }
-        log.debug("Ascender from glyph 'd': " + localAscender
-                + " " + convertTTFUnit2PDFUnit(localAscender));
-        log.debug("Descender from glyph 'p': " + localDescender
-                + " " + convertTTFUnit2PDFUnit(localDescender));
+        if (log.isDebugEnabled()) {
+            log.debug("Ascender from glyph 'd': " + localAscender
+                    + " " + convertTTFUnit2PDFUnit(localAscender));
+            log.debug("Descender from glyph 'p': " + localDescender
+                    + " " + convertTTFUnit2PDFUnit(localDescender));
+        }
         if (ascender - descender > upem) {
             log.debug("Replacing specified ascender/descender with derived values to get values"
                     + " which fit in the em box.");
@@ -1305,10 +1308,12 @@
             descender = localDescender;
         }
 
-        log.debug("xHeight from glyph 'x': " + localXHeight
-                + " " + convertTTFUnit2PDFUnit(localXHeight));
-        log.debug("CapHeight from glyph 'H': " + localCapHeight
-                + " " + convertTTFUnit2PDFUnit(localCapHeight));
+        if (log.isDebugEnabled()) {
+            log.debug("xHeight from glyph 'x': " + localXHeight
+                    + " " + convertTTFUnit2PDFUnit(localXHeight));
+            log.debug("CapHeight from glyph 'H': " + localCapHeight
+                    + " " + convertTTFUnit2PDFUnit(localCapHeight));
+        }
         if (capHeight == 0) {
             capHeight = localCapHeight;
             if (capHeight == 0) {

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Fri Nov 21 10:17:47 2008
@@ -50,8 +50,6 @@
     /** Array of areas currently being filled stored by area class */
     private BlockParent[] currentAreas = new BlockParent[Area.CLASS_MAX];
 
-    private int currentSpan = EN_NONE;
-
     /**
      * This is the top level layout manager.
      * It is created by the PageSequence FO.
@@ -89,10 +87,11 @@
             } else if (curLM instanceof BlockContainerLayoutManager) {
                 span = ((BlockContainerLayoutManager)curLM).getBlockContainerFO().getSpan();
             }
+
+            int currentSpan = context.getCurrentSpan();
             if (currentSpan != span) {
                 log.debug("span change from " + currentSpan + " to " + span);
                 context.signalSpanChange(span);
-                currentSpan = span;
                 SpaceResolver.resolveElementList(returnList);
                 return returnList;
             }
@@ -228,7 +227,7 @@
             oldElement = (KnuthElement)oldListIterator.next();
             if (oldElement.getPosition() instanceof NonLeafPosition) {
                 // oldElement was created by a descendant of this FlowLM
-                oldElement.setPosition(((NonLeafPosition)oldElement.getPosition()).getPosition());
+                oldElement.setPosition((oldElement.getPosition()).getPosition());
             } else {
                 // thisElement was created by this FlowLM, remove it
                 oldListIterator.remove();
@@ -344,7 +343,7 @@
      * @return the BPD of the content area
      */
     public int getContentAreaBPD() {
-        return (int) getCurrentPV().getBodyRegion().getBPD();
+        return getCurrentPV().getBodyRegion().getBPD();
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutContext.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutContext.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutContext.java Fri Nov 21 10:17:47 2008
@@ -88,7 +88,8 @@
      */
     private MinOptMax stackLimitIP;
 
-    /** True if current element list is spanning in multi-column layout. */
+    /** to keep track of spanning in multi-column layout */
+    private int currentSpan = Constants.NOT_SET;
     private int nextSpan = Constants.NOT_SET;
 
     /** inline-progression-dimension of nearest ancestor reference area */
@@ -522,22 +523,37 @@
     }
 
     /**
-     * @return true if the current element list ends early because of a span change
-     * in multi-column layout.
+     * @return one of: {@link Constants#NOT_SET}, {@link Constants#EN_NONE}
+     *                  {@link Constants#EN_ALL}
      */
     public int getNextSpan() {
         return nextSpan;
     }
 
     /**
+     * @return one of: {@link Constants#NOT_SET}, {@link Constants#EN_NONE}
+     *                  {@link Constants#EN_ALL}
+     */
+    public int getCurrentSpan() {
+        return (currentSpan == Constants.NOT_SET)
+                ? Constants.EN_NONE : currentSpan;
+    }
+
+    /**
      * Used to signal the PSLM that the element list ends early because of a span change in
      * multi-column layout.
      * @param span the new span value (legal values: NOT_SET, EN_NONE, EN_ALL)
      */
     public void signalSpanChange(int span) {
-        if (span == Constants.NOT_SET || span == Constants.EN_NONE || span == Constants.EN_ALL) {
+        switch (span) {
+        case Constants.NOT_SET:
+        case Constants.EN_NONE:
+        case Constants.EN_ALL:
+            this.currentSpan = this.nextSpan;
             this.nextSpan = span;
-        } else {
+            break;
+        default:
+            assert false;
             throw new IllegalArgumentException("Illegal value on signalSpanChange() for span: "
                     + span);
         }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Fri Nov 21 10:17:47 2008
@@ -910,7 +910,7 @@
             }
             startIndex = stopIndex;
         }
-        this.hasChanged = !nothingChanged;
+        this.hasChanged = (this.hasChanged || !nothingChanged);
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Fri Nov 21 10:17:47 2008
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 import org.apache.fop.fo.flow.ListItem;
@@ -537,14 +538,6 @@
             label.addAreas(labelIter, lc);
         }
 
-        // reset the area bpd after adding the label areas and before adding the body areas
-        int savedBPD = 0;
-        if (labelFirstIndex <= labelLastIndex
-            && bodyFirstIndex <= bodyLastIndex) {
-            savedBPD = curBlockArea.getBPD();
-            curBlockArea.setBPD(0);
-        }
-
         // add body areas
         if (bodyFirstIndex <= bodyLastIndex) {
             KnuthPossPosIter bodyIter = new KnuthPossPosIter(bodyList,
@@ -559,9 +552,13 @@
         }
 
         // after adding body areas, set the maximum area bpd
-        if (curBlockArea.getBPD() < savedBPD) {
-            curBlockArea.setBPD(savedBPD);
+        int childCount = curBlockArea.getChildAreas().size();
+        assert childCount >= 1 && childCount <= 2;
+        int itemBPD = ((Block)curBlockArea.getChildAreas().get(0)).getAllocBPD();
+        if (childCount == 2) {
+            itemBPD = Math.max(itemBPD, ((Block)curBlockArea.getChildAreas().get(1)).getAllocBPD());
         }
+        curBlockArea.setBPD(itemBPD);
 
         addMarkersToPage(false, isFirst(firstPos), isLast(lastPos));
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFDocument.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFDocument.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFDocument.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFDocument.java Fri Nov 21 10:17:47 2008
@@ -224,6 +224,11 @@
     protected List gotos = new java.util.ArrayList();
 
     /**
+     * List of PDFLaunch objects.
+     */
+    protected List launches = new java.util.ArrayList();
+
+    /**
      * The PDFDests object for the name dictionary.
      * Note: This object is not a list.
      */
@@ -486,6 +491,9 @@
         if (obj instanceof PDFPage) {
             this.pages.notifyKidRegistered((PDFPage)obj);
         }
+        if (obj instanceof PDFLaunch) {
+            this.launches.add(obj);
+        }
         if (obj instanceof PDFLink) {
             this.links.add(obj);
         }
@@ -657,6 +665,15 @@
     }
 
     /**
+     * Finds a launch.
+     * @param compare reference object to use as search template
+     * @return the launch if found, null otherwise
+     */
+    protected PDFLaunch findLaunch(PDFLaunch compare) {
+        return (PDFLaunch) findPDFObject(launches, compare);
+    }
+
+    /**
      * Looks for an existing GState to use
      * @param wanted requested features
      * @param current currently active features
@@ -703,7 +720,6 @@
      */
     public void setColorSpace(int theColorspace) {
         this.colorspace.setColorSpace(theColorspace);
-        return;
     }
 
     /**
@@ -1019,12 +1035,6 @@
           by the table's length */
         this.position += outputXref(stream);
 
-        // Determine existance of encryption dictionary
-        String encryptEntry = "";
-        if (this.encryption != null) {
-            encryptEntry = this.encryption.getTrailerEntry();
-        }
-
         /* construct the trailer */
         String pdf =
             "trailer\n"
@@ -1037,10 +1047,13 @@
                 + "\n"
                 + "/Info "
                 + this.info.referencePDF()
-                + "\n"
-                + getIDEntry()
-                + "\n"
-                + encryptEntry
+                + "\n";
+        if (this.encryption != null) {
+            pdf += this.encryption.getTrailerEntry();
+        } else {
+            pdf += getIDEntry();
+        }
+            pdf += "\n"
                 + ">>\n"
                 + "startxref\n"
                 + this.xref

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFFactory.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/pdf/PDFFactory.java Fri Nov 21 10:17:47 2008
@@ -1011,6 +1011,10 @@
         // HTTP URL?
         if (targetLo.startsWith("http://")) {
             return new PDFUri(target);
+        // Non PDF files. Try to /Launch them.
+        } else if (targetLo.startsWith("file://")) {
+            target = target.substring("file://".length());
+            return getLaunchAction(target);
         // Bare PDF file name?
         } else if (targetLo.endsWith(".pdf")) {
             return getGoToPDFAction(target, null, -1, newWindow);
@@ -1105,6 +1109,37 @@
     }
 
     /**
+     * Creates and returns a launch pdf document action using
+     * <code>file</code> to create a file spcifiaciton for
+     * the document/file to be opened with an external application.
+     *
+     * @param file the pdf file name
+     * @return the pdf launch object
+     */
+    private PDFLaunch getLaunchAction(String file) {
+        getDocument().getProfile().verifyActionAllowed();
+
+        PDFFileSpec fileSpec = new PDFFileSpec(file);
+        PDFFileSpec oldSpec = getDocument().findFileSpec(fileSpec);
+
+        if (oldSpec == null) {
+            getDocument().registerObject(fileSpec);
+        } else {
+            fileSpec = oldSpec;
+        }
+        PDFLaunch launch = new PDFLaunch(fileSpec);
+        PDFLaunch oldLaunch = getDocument().findLaunch(launch);
+
+        if (oldLaunch == null) {
+            getDocument().registerObject(launch);
+        } else {
+            launch = oldLaunch;
+        }
+
+        return launch;
+    }
+
+    /**
      * Make an outline object and add it to the given parent
      *
      * @param parent the parent PDFOutline object (may be null)

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java Fri Nov 21 10:17:47 2008
@@ -26,12 +26,11 @@
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.render.afp.exceptions.FontRuntimeException;
 import org.apache.fop.render.afp.modca.AFPConstants;
 import org.apache.fop.render.afp.tools.StructuredFieldReader;
 
@@ -111,143 +110,19 @@
     /**
      * The collection of code pages
      */
-    private HashMap codePages = new HashMap();
+    private final Map/*<String, Map<String, String>>*/ codePages
+        = new java.util.HashMap/*<String, Map<String, String>>*/();
 
     /**
-     * Load the font details and metrics into the CharacterSetMetric object,
-     * this will use the actual afp code page and character set files to load
-     * the object with the necessary metrics.
+     * Returns an InputStream to a given file path and filename
      *
-     * @param characterSet the CharacterSetMetric object to populate
-     */
-    public void loadCharacterSetMetric(CharacterSet characterSet) {
-
-        InputStream inputStream = null;
-
-        try {
-
-            /**
-             * Get the code page which contains the character mapping
-             * information to map the unicode character id to the graphic
-             * chracter global identifier.
-             */
-            String cp = new String(characterSet.getCodePage());
-            String path = characterSet.getPath();
-
-            HashMap codepage = (HashMap) codePages.get(cp);
-
-            if (codepage == null) {
-                codepage = loadCodePage(cp, characterSet.getEncoding(), path);
-                codePages.put(cp, codepage);
-            }
-
-            /**
-             * Load the character set metric information, no need to cache this
-             * information as it should be cached by the objects that wish to
-             * load character set metric information.
-             */
-            final String characterset = characterSet.getName();
-
-            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-            if (classLoader == null) {
-                classLoader = AFPFontReader.class.getClassLoader();
-            }
-
-            URL url = classLoader.getResource(path);
-            if (url == null) {
-                try {
-                    File file = new File(path);
-                    url = file.toURI().toURL();
-                    if (url == null) {
-                        String msg = "CharacterSet file not found for "
-                            + characterset + " in classpath: " + path;
-                        log.error(msg);
-                        throw new FileNotFoundException(msg);
-                    }
-                } catch (MalformedURLException ex) {
-                    String msg = "CharacterSet file not found for "
-                        + characterset + " in classpath: " + path;
-                    log.error(msg);
-                    throw new FileNotFoundException(msg);
-                }
-
-            }
-
-            File directory = new File(url.getPath());
-
-            final String filterpattern = characterset.trim();
-            FilenameFilter filter = new FilenameFilter() {
-                public boolean accept(File dir, String name) {
-                    return name.startsWith(filterpattern);
-                }
-            };
-
-            File[] csfont = directory.listFiles(filter);
-            if (csfont.length < 1) {
-                String msg = "CharacterSet file search for " + characterset
-                    + " located " + csfont.length + " files";
-                log.error(msg);
-                throw new FileNotFoundException(msg);
-            } else if (csfont.length > 1) {
-                String msg = "CharacterSet file search for " + characterset
-                    + " located " + csfont.length + " files";
-                log.warn(msg);
-            }
-
-            inputStream = csfont[0].toURI().toURL().openStream();
-            if (inputStream == null) {
-                String msg = "Failed to open character set resource "
-                    + characterset;
-                log.error(msg);
-                throw new FileNotFoundException(msg);
-            }
-
-            StructuredFieldReader sfr = new StructuredFieldReader(inputStream);
-
-            // Process D3A789 Font Control
-            FontControl fnc = processFontControl(sfr);
-
-            //process D3AE89 Font Orientation
-            CharacterSetOrientation[] csoArray = processFontOrientation(sfr);
-
-            //process D3AC89 Font Position
-            processFontPosition(sfr, csoArray, fnc.getDpi());
-
-            //process D38C89 Font Index (per orientation)
-            for (int i = 0; i < csoArray.length; i++) {
-                processFontIndex(sfr, csoArray[i], codepage, fnc.getDpi());
-                characterSet.addCharacterSetOrientation(csoArray[i]);
-            }
-
-        } catch (Exception ex) {
-            throw new FontRuntimeException(
-                "Failed to load the character set metrics for code page "
-                + characterSet.getCodePage(), ex);
-        } finally {
-            try {
-                inputStream.close();
-            } catch (Exception ex) {
-                // Ignore
-            }
-        }
-
-    }
-
-    /**
-     * Load the code page information from the appropriate file. The file name
-     * to load is determined by the code page name and the file extension 'CDP'.
+     * @param path the file path
+     * @param filename the file name
+     * @return an inputStream
      *
-     * @param codePage
-     *            the code page identifier
-     * @param encoding
-     *            the encoding to use for the character decoding
+     * @throws IOException in the event that an I/O exception of some sort has occurred
      */
-    private static HashMap loadCodePage(String codePage, String encoding,
-        String path) throws IOException {
-
-        // Create the HashMap to store code page information
-        HashMap codepages = new HashMap();
-
+    private InputStream openInputStream(String path, String filename) throws IOException {
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
         if (classLoader == null) {
             classLoader = AFPFontReader.class.getClassLoader();
@@ -260,14 +135,12 @@
                 File file = new File(path);
                 url = file.toURI().toURL();
                 if (url == null) {
-                    String msg = "CodePage file not found for " + codePage
-                        + " in classpath: " + path;
+                    String msg = "file not found " + filename + " in classpath: " + path;
                     log.error(msg);
                     throw new FileNotFoundException(msg);
                 }
             } catch (MalformedURLException ex) {
-                String msg = "CodePage file not found for " + codePage
-                    + " in classpath: " + path;
+                String msg = "file not found " + filename + " in classpath: " + path;
                 log.error(msg);
                 throw new FileNotFoundException(msg);
             }
@@ -280,115 +153,220 @@
             throw new FileNotFoundException(msg);
         }
 
-        final String filterpattern = codePage.trim();
+        final String filterpattern = filename.trim();
         FilenameFilter filter = new FilenameFilter() {
             public boolean accept(File dir, String name) {
                 return name.startsWith(filterpattern);
             }
         };
 
-        File[] codepage = directory.listFiles(filter);
+        File[] files = directory.listFiles(filter);
 
-        if (codepage.length < 1) {
-            String msg = "CodePage file search for " + codePage + " located "
-                + codepage.length + " files";
+        if (files.length < 1) {
+            String msg = "file search for " + filename + " located "
+                + files.length + " files";
             log.error(msg);
             throw new FileNotFoundException(msg);
-        } else if (codepage.length > 1) {
-            String msg = "CodePage file search for " + codePage + " located "
-                + codepage.length + " files";
+        } else if (files.length > 1) {
+            String msg = "file search for " + filename + " located "
+                + files.length + " files";
             log.warn(msg);
         }
 
-        InputStream is = codepage[0].toURI().toURL().openStream();
+        InputStream inputStream = files[0].toURI().toURL().openStream();
 
-        if (is == null) {
-            String msg = "AFPFontReader:: loadCodePage(String):: code page file not found for "
-                + codePage;
+        if (inputStream == null) {
+            String msg = "AFPFontReader:: getInputStream():: file not found for " + filename;
             log.error(msg);
             throw new FileNotFoundException(msg);
         }
 
-        StructuredFieldReader sfr = new StructuredFieldReader(is);
-        byte[] data = sfr.getNext(CHARACTER_TABLE_SF);
+        return inputStream;
+    }
 
-        int position = 0;
-        byte[] gcgiBytes = new byte[8];
-        byte[] charBytes = new byte[1];
+    /**
+     * Closes the inputstream
+     *
+     * @param inputStream the inputstream to close
+     */
+    private void closeInputStream(InputStream inputStream) {
+        try {
+            if (inputStream != null) {
+                inputStream.close();
+            }
+        } catch (Exception ex) {
+            // Lets log at least!
+            log.error(ex.getMessage());
+        }
+    }
 
-        // Read data, ignoring bytes 0 - 2
-        for (int index = 3; index < data.length; index++) {
-            if (position < 8) {
-                // Build the graphic character global identifier key
-                gcgiBytes[position] = data[index];
-                position++;
-            } else if (position == 9) {
-                position = 0;
-                // Set the character
-                charBytes[0] = data[index];
-                String gcgiString = new String(gcgiBytes,
-                    AFPConstants.EBCIDIC_ENCODING);
-                String charString = new String(charBytes, encoding);
-//                int value = charString.charAt(0);
-                codepages.put(gcgiString, charString);
+    /**
+     * Load the font details and metrics into the CharacterSetMetric object,
+     * this will use the actual afp code page and character set files to load
+     * the object with the necessary metrics.
+     *
+     * @param characterSet the CharacterSetMetric object to populate
+     * @throws IOException if an I/O exception of some sort has occurred.
+     */
+    public void loadCharacterSetMetric(CharacterSet characterSet) throws IOException {
+
+        InputStream inputStream = null;
+
+        try {
+
+            /**
+             * Get the code page which contains the character mapping
+             * information to map the unicode character id to the graphic
+             * chracter global identifier.
+             */
+            String codePageId = new String(characterSet.getCodePage());
+            String path = characterSet.getPath();
+
+            Map/*<String,String>*/ codePage = (Map/*<String,String>*/)codePages.get(codePageId);
+
+            if (codePage == null) {
+                codePage = loadCodePage(codePageId, characterSet.getEncoding(), path);
+                codePages.put(codePageId, codePage);
+            }
+
+            /**
+             * Load the character set metric information, no need to cache this
+             * information as it should be cached by the objects that wish to
+             * load character set metric information.
+             */
+            final String characterSetName = characterSet.getName();
+
+            inputStream = openInputStream(path, characterSetName);
+
+            StructuredFieldReader structuredFieldReader = new StructuredFieldReader(inputStream);
+
+            // Process D3A789 Font Control
+            FontControl fontControl = processFontControl(structuredFieldReader);
+
+            if (fontControl != null) {
+                //process D3AE89 Font Orientation
+                CharacterSetOrientation[] characterSetOrientations
+                    = processFontOrientation(structuredFieldReader);
+
+                int dpi = fontControl.getDpi();
+
+                //process D3AC89 Font Position
+                processFontPosition(structuredFieldReader, characterSetOrientations, dpi);
+
+                //process D38C89 Font Index (per orientation)
+                for (int i = 0; i < characterSetOrientations.length; i++) {
+                    processFontIndex(structuredFieldReader,
+                            characterSetOrientations[i], codePage, dpi);
+                    characterSet.addCharacterSetOrientation(characterSetOrientations[i]);
+                }
             } else {
-                position++;
+                throw new IOException(
+                        "Failed to read font control structured field in character set "
+                        + characterSetName);
             }
+
+        } finally {
+            closeInputStream(inputStream);
         }
 
+    }
+
+    /**
+     * Load the code page information from the appropriate file. The file name
+     * to load is determined by the code page name and the file extension 'CDP'.
+     *
+     * @param codePage
+     *            the code page identifier
+     * @param encoding
+     *            the encoding to use for the character decoding
+     * @returns a code page mapping
+     */
+    private Map/*<String,String>*/ loadCodePage(String codePage, String encoding,
+        String path) throws IOException {
+
+        // Create the HashMap to store code page information
+        Map/*<String,String>*/ codePages = new java.util.HashMap/*<String,String>*/();
+
+        InputStream inputStream = null;
         try {
-            is.close();
-        } catch (Exception ex) {
-            // Ignore
-        }
+            inputStream = openInputStream(path, codePage.trim());
 
-        return codepages;
+            StructuredFieldReader structuredFieldReader = new StructuredFieldReader(inputStream);
+            byte[] data = structuredFieldReader.getNext(CHARACTER_TABLE_SF);
 
+            int position = 0;
+            byte[] gcgiBytes = new byte[8];
+            byte[] charBytes = new byte[1];
+
+            // Read data, ignoring bytes 0 - 2
+            for (int index = 3; index < data.length; index++) {
+                if (position < 8) {
+                    // Build the graphic character global identifier key
+                    gcgiBytes[position] = data[index];
+                    position++;
+                } else if (position == 9) {
+                    position = 0;
+                    // Set the character
+                    charBytes[0] = data[index];
+                    String gcgiString = new String(gcgiBytes,
+                            AFPConstants.EBCIDIC_ENCODING);
+                    String charString = new String(charBytes, encoding);
+//                int value = charString.charAt(0);
+                    codePages.put(gcgiString, charString);
+                } else {
+                    position++;
+                }
+            }
+        } finally {
+            closeInputStream(inputStream);
+        }
+
+        return codePages;
     }
 
     /**
      * Process the font control details using the structured field reader.
      *
-     * @param sfr
+     * @param structuredFieldReader
      *            the structured field reader
      */
-    private static FontControl processFontControl(StructuredFieldReader sfr)
+    private FontControl processFontControl(StructuredFieldReader structuredFieldReader)
     throws IOException {
 
-        byte[] fncData = sfr.getNext(FONT_CONTROL_SF);
+        byte[] fncData = structuredFieldReader.getNext(FONT_CONTROL_SF);
 
 //        int position = 0;
+        FontControl fontControl = null;
+        if (fncData != null) {
+            fontControl = new FontControl();
 
-        FontControl fontControl = new AFPFontReader().new FontControl();
-
-        if (fncData[7] == (byte) 0x02) {
-            fontControl.setRelative(true);
-        }
-
-        int dpi = (((fncData[9] & 0xFF) << 8) + (fncData[10] & 0xFF)) / 10;
+            if (fncData[7] == (byte) 0x02) {
+                fontControl.setRelative(true);
+            }
 
-        fontControl.setDpi(dpi);
+            int dpi = (((fncData[9] & 0xFF) << 8) + (fncData[10] & 0xFF)) / 10;
 
+            fontControl.setDpi(dpi);
+        }
         return fontControl;
-
     }
 
     /**
      * Process the font orientation details from using the structured field
      * reader.
      *
-     * @param sfr
+     * @param structuredFieldReader
      *            the structured field reader
      */
-    private static CharacterSetOrientation[] processFontOrientation(
-        StructuredFieldReader sfr) throws IOException {
+    private CharacterSetOrientation[] processFontOrientation(
+        StructuredFieldReader structuredFieldReader) throws IOException {
 
-        byte[] data = sfr.getNext(FONT_ORIENTATION_SF);
+        byte[] data = structuredFieldReader.getNext(FONT_ORIENTATION_SF);
 
         int position = 0;
         byte[] fnoData = new byte[26];
 
-        ArrayList orientations = new ArrayList();
+        List orientations = new java.util.ArrayList();
 
         // Read data, ignoring bytes 0 - 2
         for (int index = 3; index < data.length; index++) {
@@ -434,20 +412,20 @@
      * Populate the CharacterSetOrientation object in the suplied array with the
      * font position details using the supplied structured field reader.
      *
-     * @param sfr
+     * @param structuredFieldReader
      *            the structured field reader
-     * @param csoArray
+     * @param characterSetOrientations
      *            the array of CharacterSetOrientation objects
      */
-    private static void processFontPosition(StructuredFieldReader sfr,
-        CharacterSetOrientation[] csoArray, int dpi) throws IOException {
+    private void processFontPosition(StructuredFieldReader structuredFieldReader,
+        CharacterSetOrientation[] characterSetOrientations, int dpi) throws IOException {
 
-        byte[] data = sfr.getNext(FONT_POSITION_SF);
+        byte[] data = structuredFieldReader.getNext(FONT_POSITION_SF);
 
         int position = 0;
         byte[] fpData = new byte[26];
 
-        int csoIndex = 0;
+        int characterSetOrientationIndex = 0;
         int fopFactor = 0;
 
         switch (dpi) {
@@ -475,7 +453,8 @@
 
                 position = 0;
 
-                CharacterSetOrientation cso = csoArray[csoIndex];
+                CharacterSetOrientation characterSetOrientation
+                    = characterSetOrientations[characterSetOrientationIndex];
 
                 int xHeight = ((fpData[2] & 0xFF) << 8) + (fpData[3] & 0xFF);
                 int capHeight = ((fpData[4] & 0xFF) << 8) + (fpData[5] & 0xFF);
@@ -484,12 +463,12 @@
 
                 dscHeight = dscHeight * -1;
 
-                cso.setXHeight(xHeight * fopFactor);
-                cso.setCapHeight(capHeight * fopFactor);
-                cso.setAscender(ascHeight * fopFactor);
-                cso.setDescender(dscHeight * fopFactor);
+                characterSetOrientation.setXHeight(xHeight * fopFactor);
+                characterSetOrientation.setCapHeight(capHeight * fopFactor);
+                characterSetOrientation.setAscender(ascHeight * fopFactor);
+                characterSetOrientation.setDescender(dscHeight * fopFactor);
 
-                csoIndex++;
+                characterSetOrientationIndex++;
 
                 fpData[position] = data[index];
 
@@ -503,18 +482,18 @@
     /**
      * Process the font index details for the character set orientation.
      *
-     * @param sfr
+     * @param structuredFieldReader
      *            the structured field reader
      * @param cso
      *            the CharacterSetOrientation object to populate
      * @param codepage
      *            the map of code pages
      */
-    private static void processFontIndex(StructuredFieldReader sfr,
-        CharacterSetOrientation cso, HashMap codepage, int dpi)
+    private void processFontIndex(StructuredFieldReader structuredFieldReader,
+        CharacterSetOrientation cso, Map/*<String,String>*/ codepage, int dpi)
         throws IOException {
 
-        byte[] data = sfr.getNext(FONT_INDEX_SF);
+        byte[] data = structuredFieldReader.getNext(FONT_INDEX_SF);
 
         int fopFactor = 0;
 
@@ -545,14 +524,14 @@
         // Read data, ignoring bytes 0 - 2
         for (int index = 3; index < data.length; index++) {
             if (position < 8) {
-                gcgid[position] = (byte) data[index];
+                gcgid[position] = data[index];
                 position++;
             } else if (position < 27) {
-                fiData[position - 8] = (byte) data[index];
+                fiData[position - 8] = data[index];
                 position++;
             } else if (position == 27) {
 
-                fiData[position - 8] = (byte) data[index];
+                fiData[position - 8] = data[index];
 
                 position = 0;
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java Fri Nov 21 10:17:47 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.render.afp.fonts;
 
+import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.Map;
 
@@ -49,6 +50,15 @@
     /** Static logging instance */
     protected static final Log log = LogFactory.getLog(CharacterSet.class.getName());
 
+    /** default codepage */
+    protected static final String DEFAULT_CODEPAGE = "T1V10500";
+
+    /** default encoding */
+    protected static final String DEFAULT_ENCODING = "Cp500";
+
+    private static final int MAX_NAME_LEN = 8;
+
+
     /** The code page to which the character set relates */
     protected String codePage;
 
@@ -64,8 +74,8 @@
     /** Indicator as to whether to metrics have been loaded */
     private boolean isMetricsLoaded = false;
 
-    /** The current orientation (currently only 0 is suppoted by FOP) */
-    private String currentOrientation = "0";
+    /** The current orientation (currently only 0 is supported by FOP) */
+    private final String currentOrientation = "0";
 
     /** The collection of objects for each orientation */
     private Map characterSetOrientations = null;
@@ -79,27 +89,23 @@
      * @param name the character set name
      * @param path the path to the installed afp fonts
      */
-    public CharacterSet(
-        String codePage,
-        String encoding,
-        String name,
-        String path) {
-
-        if (name.length() > 8) {
-            String msg = "Character set name must be a maximum of 8 characters " + name;
+    public CharacterSet(String codePage, String encoding, String name, String path) {
+        if (name.length() > MAX_NAME_LEN) {
+            String msg = "Character set name '" + name + "' must be a maximum of "
+                + MAX_NAME_LEN + " characters";
             log.error("Constructor:: " + msg);
             throw new IllegalArgumentException(msg);
         }
 
-        if (name.length() < 8) {
-            this.name = StringUtils.rpad(name, ' ', 8);
+        if (name.length() < MAX_NAME_LEN) {
+            this.name = StringUtils.rpad(name, ' ', MAX_NAME_LEN);
         } else {
             this.name = name;
         }
-
         this.codePage = codePage;
         this.encoding = encoding;
         this.path = path;
+
         this.characterSetOrientations = new java.util.HashMap(4);
     }
 
@@ -121,7 +127,7 @@
      * a character rotation other than 0, ascender height loses its
      * meaning when the character is lying on its side or is upside down
      * with respect to normal viewing orientation. For the general case,
-     * Ascender Height is the character�s most positive y-axis value.
+     * Ascender Height is the characters most positive y-axis value.
      * For bounded character boxes, for a given character having an
      * ascender, ascender height and baseline offset are equal.
      *
@@ -157,9 +163,9 @@
     }
 
     /**
-     * The first character in the character set
+     * Returns the first character in the character set
      *
-     * @return the first character
+     * @return the first character in the character set
      */
     public int getFirstChar() {
         load();
@@ -169,7 +175,7 @@
     /**
      * Returns the last character in the character set
      *
-     * @return the last character
+     * @return the last character in the character set
      */
     public int getLastChar() {
         load();
@@ -197,6 +203,7 @@
 
     /**
      * XHeight refers to the height of the lower case letters above the baseline.
+     *
      * @return the typical height of characters
      */
     public int getXHeight() {
@@ -211,9 +218,9 @@
      * @param character the character from which the width will be calculated
      * @return the width of the character
      */
-    public int width(int character) {
+    public int getWidth(int character) {
         load();
-        return getCharacterSetOrientation().width(character);
+        return getCharacterSetOrientation().getWidth(character);
     }
 
     /**
@@ -223,24 +230,30 @@
     private void load() {
         if (!isMetricsLoaded) {
             AFPFontReader afpFontReader = new AFPFontReader();
-            afpFontReader.loadCharacterSetMetric(this);
-            isMetricsLoaded = true;
+            try {
+                afpFontReader.loadCharacterSetMetric(this);
+                isMetricsLoaded = true;
+            } catch (IOException e) {
+                String msg = "Failed to load the character set metrics for code page " + codePage;
+                log.error(msg);
+                throw new RuntimeException(e.getMessage());
+            }
         }
     }
 
     /**
      * Returns the AFP character set identifier
      *
-     * @return String
+     * @return the AFP character set identifier
      */
     public String getName() {
         return name;
     }
 
     /**
-     * Returns the AFP character set identifier
+     * Returns the AFP character set identifier as a byte array
      *
-     * @return the AFP character set identifier
+     * @return the AFP character set identifier as a byte array
      */
     public byte[] getNameBytes() {
         byte[] nameBytes = null;
@@ -249,8 +262,7 @@
         } catch (UnsupportedEncodingException usee) {
             nameBytes = name.getBytes();
             log.warn(
-                "UnsupportedEncodingException translating the name "
-                + name);
+                "UnsupportedEncodingException translating the name " + name);
         }
         return nameBytes;
     }
@@ -281,16 +293,14 @@
      * implementation (whenever FOP implement the mechanism). This is also
      * the case for landscape prints which use an orientation of 270 degrees,
      * in 99.9% of cases the font metrics will be the same as the 0 degrees
-     * therefore the implementation currely will always use 0 degrees.
+     * therefore the implementation currently will always use 0 degrees.
      *
      * @return characterSetOrentation The current orientation metrics.
      */
     private CharacterSetOrientation getCharacterSetOrientation() {
-
         CharacterSetOrientation c
             = (CharacterSetOrientation) characterSetOrientations.get(currentOrientation);
         return c;
-
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSetOrientation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSetOrientation.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSetOrientation.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/CharacterSetOrientation.java Fri Nov 21 10:17:47 2008
@@ -183,11 +183,15 @@
     /**
      * Get the width (in 1/1000ths of a point size) of the character
      * identified by the parameter passed.
-     * @param character the character to evaluate
+     * @param characterIndex the character to evaluate
      * @return the widths of the character
      */
-    public int width(int character) {
-        return chars[character];
+    public int getWidth(int characterIndex) {
+        if (characterIndex >= chars.length) {
+            throw new IllegalArgumentException("Invalid character index: "
+                    + characterIndex + ", maximum is " + (chars.length - 1));
+        }
+        return chars[characterIndex];
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/FopCharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/FopCharacterSet.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/FopCharacterSet.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/FopCharacterSet.java Fri Nov 21 10:17:47 2008
@@ -125,7 +125,7 @@
      * @param character the character from which the width will be calculated
      * @return the width of the character
      */
-    public int width(int character) {
+    public int getWidth(int character) {
         return charSet.getWidth(character, size);
     }
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/OutlineFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/OutlineFont.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/OutlineFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/OutlineFont.java Fri Nov 21 10:17:47 2008
@@ -136,7 +136,7 @@
      * @return the width of the character for the specified point size
      */
     public int getWidth(int character, int size) {
-        return charSet.width(character) / 1000 * size;
+        return charSet.getWidth(character) / 1000 * size;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/RasterFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/RasterFont.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/RasterFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/fonts/RasterFont.java Fri Nov 21 10:17:47 2008
@@ -196,7 +196,7 @@
      * @return the width for the given point size
      */
     public int getWidth(int character, int size) {
-        return getCharacterSet(size).width(character);
+        return getCharacterSet(size).getWidth(character);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java Fri Nov 21 10:17:47 2008
@@ -58,14 +58,14 @@
      * parameter (this must be a valid MO:DCA structured field.
      * @param identifier the three byte identifier
      * @throws IOException if an I/O exception occurred
-     * @return the next structured field
+     * @return the next structured field or null when there are no more
      */
     public byte[] getNext(byte[] identifier) throws IOException {
 
         int bufferPointer = 0;
         byte[] bufferData = new byte[identifier.length + 2];
         for (int x = 0; x < identifier.length; x++) {
-            bufferData[x] = (byte) 0;
+            bufferData[x] = 0x00;
         }
 
         int c;
@@ -128,7 +128,6 @@
 
         }
 
-        return new byte[] {
-        };
+        return null;
     }
 }

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java:699793-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java:699793-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFContentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFContentHandler.java:680381-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFContentHandler.java:680381-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFPainter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFPainter.java:680381-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFPainter.java:680381-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFRenderer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFRenderer.java:680381-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/IFRenderer.java:680381-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java:685127-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java:685127-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java:685127-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionHandlerFactory.java:685127-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java:699793-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java:699793-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java:699793-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java:699793-719661

Propchange: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 21 10:17:47 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java:699793-706550
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java:699793-719661

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java Fri Nov 21 10:17:47 2008
@@ -34,8 +34,10 @@
 import org.apache.batik.transcoder.TranscoderException;
 import org.apache.batik.transcoder.TranscoderOutput;
 import org.apache.batik.transcoder.image.ImageTranscoder;
-import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D;
+
 import org.apache.xmlgraphics.java2d.TextHandler;
+import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D;
+import org.apache.xmlgraphics.ps.PSGenerator;
 
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontSetup;
@@ -70,7 +72,7 @@
  */
 public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder {
 
-    private   Configuration                cfg      = null;
+    private final   Configuration                cfg      = null;
     protected AbstractPSDocumentGraphics2D graphics = null;
 
     /**
@@ -99,6 +101,7 @@
             FontInfo fontInfo = new FontInfo();
             //TODO Do custom font configuration here somewhere/somehow
             FontSetup.setup(fontInfo);
+            PSGenerator generator = graphics.getPSGenerator();
             graphics.setCustomTextHandler(new NativeTextHandler(graphics, fontInfo));
         }
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java?rev=719664&r1=719663&r2=719664&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/ps/NativeTextHandler.java Fri Nov 21 10:17:47 2008
@@ -19,17 +19,19 @@
 
 package org.apache.fop.render.ps;
 
+import java.awt.Graphics2D;
 import java.awt.Shape;
 import java.awt.geom.AffineTransform;
 import java.io.IOException;
 
+import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
+import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
+import org.apache.xmlgraphics.ps.PSGenerator;
+
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontSetup;
 import org.apache.fop.fonts.FontTriplet;
-import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
-import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
-import org.apache.xmlgraphics.ps.PSGenerator;
 
 /**
  * Specialized TextHandler implementation that the PSGraphics2D class delegates to to paint text
@@ -37,7 +39,7 @@
  */
 public class NativeTextHandler implements PSTextHandler {
 
-    private PSGraphics2D g2d;
+    private PSGraphics2D rootG2D;
 
     /** FontInfo containing all available fonts */
     protected FontInfo fontInfo;
@@ -60,7 +62,7 @@
      * @param fontInfo the FontInfo object with all available fonts
      */
     public NativeTextHandler(PSGraphics2D g2d, FontInfo fontInfo) {
-        this.g2d = g2d;
+        this.rootG2D = g2d;
         if (fontInfo != null) {
             this.fontInfo = fontInfo;
         } else {
@@ -83,7 +85,7 @@
     }
 
     private PSGenerator getPSGenerator() {
-        return this.g2d.getPSGenerator();
+        return this.rootG2D.getPSGenerator();
     }
 
     /** {@inheritDoc} */
@@ -98,12 +100,19 @@
         //nop
     }
 
+    /** {@inheritDoc} */
+    public void drawString(String text, float x, float y) throws IOException {
+        // TODO Remove me after removing the deprecated method in TextHandler.
+        throw new UnsupportedOperationException("Deprecated method!");
+    }
+
     /**
      * Draw a string to the PostScript document. The text is painted using
      * text operations.
      * {@inheritDoc}
      */
-    public void drawString(String s, float x, float y) throws IOException {
+    public void drawString(Graphics2D g, String s, float x, float y) throws IOException {
+        PSGraphics2D g2d = (PSGraphics2D)g;
         g2d.preparePainting();
         if (this.overrideFont == null) {
             java.awt.Font awtFont = g2d.getFont();



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