]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
1. create control package
authorWilliam Victor Mote <vmote@apache.org>
Thu, 14 Aug 2003 07:42:59 +0000 (07:42 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Thu, 14 Aug 2003 07:42:59 +0000 (07:42 +0000)
2. move layout.FontInfo to control.Document

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196798 13f79535-47bb-0310-9956-ffa450edef68

35 files changed:
src/java/org/apache/fop/control/Document.java [new file with mode: 0644]
src/java/org/apache/fop/fo/FOInputHandler.java
src/java/org/apache/fop/fo/FOTreeHandler.java
src/java/org/apache/fop/fo/FObjMixed.java
src/java/org/apache/fop/fo/PropertyManager.java
src/java/org/apache/fop/fo/flow/Leader.java
src/java/org/apache/fop/fo/flow/PageNumber.java
src/java/org/apache/fop/fo/flow/PageNumberCitation.java
src/java/org/apache/fop/layout/FontInfo.java [deleted file]
src/java/org/apache/fop/mif/MIFHandler.java
src/java/org/apache/fop/render/AbstractRenderer.java
src/java/org/apache/fop/render/PrintRenderer.java
src/java/org/apache/fop/render/Renderer.java
src/java/org/apache/fop/render/awt/AWTRenderer.java
src/java/org/apache/fop/render/awt/FontSetup.java
src/java/org/apache/fop/render/pdf/FontSetup.java
src/java/org/apache/fop/render/pdf/PDFRenderer.java
src/java/org/apache/fop/render/pdf/PDFXMLHandler.java
src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java
src/java/org/apache/fop/render/ps/PSGraphics2D.java
src/java/org/apache/fop/render/ps/PSProcSets.java
src/java/org/apache/fop/render/ps/PSRenderer.java
src/java/org/apache/fop/render/ps/PSTextElementBridge.java
src/java/org/apache/fop/render/ps/PSTextPainter.java
src/java/org/apache/fop/render/ps/PSTranscoder.java
src/java/org/apache/fop/render/ps/PSXMLHandler.java
src/java/org/apache/fop/render/svg/SVGRenderer.java
src/java/org/apache/fop/render/xml/XMLRenderer.java
src/java/org/apache/fop/rtf/renderer/RTFHandler.java
src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
src/java/org/apache/fop/svg/PDFGraphics2D.java
src/java/org/apache/fop/svg/PDFTextElementBridge.java
src/java/org/apache/fop/svg/PDFTextPainter.java
src/java/org/apache/fop/svg/PDFTranscoder.java
src/java/org/apache/fop/tools/AreaTreeBuilder.java

diff --git a/src/java/org/apache/fop/control/Document.java b/src/java/org/apache/fop/control/Document.java
new file mode 100644 (file)
index 0000000..396ab1c
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+ * $Id$
+ * ============================================================================
+ *                    The Apache Software License, Version 1.1
+ * ============================================================================
+ * 
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 
+ * 3. The end-user documentation included with the redistribution, if any, must
+ *    include the following acknowledgment: "This product includes software
+ *    developed by the Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself, if
+ *    and wherever such third-party acknowledgments normally appear.
+ * 
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ *    endorse or promote products derived from this software without prior
+ *    written permission. For written permission, please contact
+ *    apache@apache.org.
+ * 
+ * 5. Products derived from this software may not be called "Apache", nor may
+ *    "Apache" appear in their name, without prior written permission of the
+ *    Apache Software Foundation.
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ * 
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */ 
+package org.apache.fop.control;
+
+// Java
+import java.util.Map;
+
+// FOP
+import org.apache.fop.fonts.FontMetrics;
+
+/**
+ * The FontInfo for the layout and rendering of a fo document.
+ * This stores the list of available fonts that are setup by
+ * the renderer. The font name can be retrieved for the
+ * family style and weight.
+ * <br>
+ * Currently font supported font-variant small-caps is not
+ * implemented.
+ */
+public class Document {
+    
+    /** Default fallback key */
+    public static final String DEFAULT_FONT = "any,normal,400";
+    /** Normal font weight */
+    public static final int NORMAL = 400;
+    /** Bold font weight */
+    public static final int BOLD = 700;
+
+    /** Map containing fonts that have been used */
+    private Map usedFonts;
+    
+    /** look up a font-triplet to find a font-name */
+    private Map triplets;
+    
+    /** look up a font-name to get a font (that implements FontMetrics at least) */
+    private Map fonts;
+
+    /**
+     * Main constructor
+     */
+    public Document() {
+        this.triplets = new java.util.HashMap();
+        this.fonts = new java.util.HashMap();
+        this.usedFonts = new java.util.HashMap();
+    }
+
+    /**
+     * Checks if the font setup is valid (At least the ultimate fallback font 
+     * must be registered.)
+     * @return True if valid
+     */
+    public boolean isSetupValid() {
+        return triplets.containsKey(DEFAULT_FONT);
+    }
+
+    /**
+     * Adds a new font triplet.
+     * @param name internal key
+     * @param family font family name
+     * @param style font style (normal, italic, oblique...)
+     * @param weight font weight
+     */
+    public void addFontProperties(String name, String family, String style,
+                                  int weight) {
+        /*
+         * add the given family, style and weight as a lookup for the font
+         * with the given name
+         */
+
+        String key = createFontKey(family, style, weight);
+        this.triplets.put(key, name);
+    }
+
+    /**
+     * Adds font metrics for a specific font.
+     * @param name internal key
+     * @param metrics metrics to register
+     */
+    public void addMetrics(String name, FontMetrics metrics) {
+        // add the given metrics as a font with the given name
+
+        this.fonts.put(name, metrics);
+    }
+
+    /**
+     * Lookup a font.
+     * <br>
+     * Locate the font name for a given family, style and weight.
+     * The font name can then be used as a key as it is unique for
+     * the associated document.
+     * This also adds the font to the list of used fonts.
+     * @param family font family
+     * @param style font style
+     * @param weight font weight
+     * @return internal key
+     */
+    public String fontLookup(String family, String style,
+                             int weight) {
+        String key;
+        // first try given parameters
+        key = createFontKey(family, style, weight);
+        String f = (String)triplets.get(key);
+        if (f == null) {
+            // then adjust weight, favouring normal or bold
+            f = findAdjustWeight(family, style, weight);
+
+            // then try any family with orig weight
+            if (f == null) {
+                key = createFontKey("any", style, weight);
+                f = (String)triplets.get(key);
+            }
+
+            // then try any family with adjusted weight
+            if (f == null) {
+                f = findAdjustWeight(family, style, weight);
+            }
+
+            // then use default
+            if (f == null) {
+                f = (String)triplets.get(DEFAULT_FONT);
+            }
+
+        }
+
+        usedFonts.put(f, fonts.get(f));
+        return f;
+    }
+
+    /**
+     * Find a font with a given family and style by trying
+     * different font weights according to the spec.
+     * @param family font family
+     * @param style font style
+     * @param weight font weight
+     * @return internal key
+     */
+    public String findAdjustWeight(String family, String style,
+                             int weight) {
+        String key;
+        String f = null;
+        int newWeight = weight;
+        if (newWeight < 400) {
+            while (f == null && newWeight > 0) {
+                newWeight -= 100;
+                key = createFontKey(family, style, newWeight);
+                f = (String)triplets.get(key);
+            }
+        } else if (newWeight == 500) {
+            key = createFontKey(family, style, 400);
+            f = (String)triplets.get(key);
+        } else if (newWeight > 500) {
+            while (f == null && newWeight < 1000) {
+                newWeight += 100;
+                key = createFontKey(family, style, newWeight);
+                f = (String)triplets.get(key);
+            }
+            newWeight = weight;
+            while (f == null && newWeight > 400) {
+                newWeight -= 100;
+                key = createFontKey(family, style, newWeight);
+                f = (String)triplets.get(key);
+            }
+        }
+        if (f == null) {
+            key = createFontKey(family, style, 400);
+            f = (String)triplets.get(key);
+        }
+
+        return f;
+    }
+
+    /**
+     * Determines if a particular font is available.
+     * @param family font family
+     * @param style font style
+     * @param weight font weight
+     * @return True if available
+     */
+    public boolean hasFont(String family, String style, int weight) {
+        String key = createFontKey(family, style, weight);
+        return this.triplets.containsKey(key);
+    }
+
+    /**
+     * Creates a key from the given strings.
+     * @param family font family
+     * @param style font style
+     * @param weight font weight
+     * @return internal key
+     */
+    public static String createFontKey(String family, String style,
+                                       int weight) {
+        return family + "," + style + "," + weight;
+    }
+
+    /**
+     * Gets a Map of all registred fonts.
+     * @return a read-only Map with font key/FontMetrics pairs
+     */
+    public Map getFonts() {
+        return java.util.Collections.unmodifiableMap(this.fonts);
+    }
+
+    /**
+     * This is used by the renderers to retrieve all the
+     * fonts used in the document.
+     * This is for embedded font or creating a list of used fonts.
+     * @return a read-only Map with font key/FontMetrics pairs
+     */
+    public Map getUsedFonts() {
+        return this.usedFonts;
+    }
+
+    /**
+     * Returns the FontMetrics for a particular font
+     * @param fontName internal key
+     * @return font metrics
+     */
+    public FontMetrics getMetricsFor(String fontName) {
+        usedFonts.put(fontName, fonts.get(fontName));
+        return (FontMetrics)fonts.get(fontName);
+    }
+}
+
index a3734e465d2d0d927d3c29a1c00408cc253d5d4c..8e06247f4c7c1d30b2ce9e54f749ed63133d514b 100644 (file)
@@ -72,7 +72,7 @@ import org.apache.fop.fo.flow.TableCell;
 import org.apache.fop.fo.flow.TableRow;
 import org.apache.fop.fo.pagination.Flow;
 import org.apache.fop.fo.pagination.PageSequence;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 import org.xml.sax.SAXException;
 
@@ -115,7 +115,7 @@ public abstract class FOInputHandler extends AbstractLogEnabled {
      * Returns the FontInfo object associated with this FOInputHandler.
      * @return the FontInof object
      */
-    public FontInfo getFontInfo() {
+    public Document getFontInfo() {
         return null;
     }
 
index 67fe255d69c366f1b4a860ae12d4ed4c9079a92d..f3fede6a038431fa10596b028bb3f8ea4d156e90 100644 (file)
@@ -77,7 +77,7 @@ import org.apache.fop.fo.flow.TableCell;
 import org.apache.fop.fo.flow.TableRow;
 import org.apache.fop.fo.pagination.Flow;
 import org.apache.fop.fo.pagination.PageSequence;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.render.Renderer;
 
 /**
@@ -130,7 +130,7 @@ public class FOTreeHandler extends FOInputHandler {
     /**
      * The FontInfo for this renderer.
      */
-    private FontInfo fontInfo = new FontInfo();
+    private Document fontInfo = new Document();
 
     /**
      * Collection of objects that have registered to be notified about
@@ -477,7 +477,7 @@ public class FOTreeHandler extends FOInputHandler {
      *
      * @return the font information
      */
-    public FontInfo getFontInfo() {
+    public Document getFontInfo() {
         return this.fontInfo;
     }
 
index fc791d439db5a4f73635a301c16b7bc8295f8687..4f6739f3050984bec3506084422b184f8a39a662 100644 (file)
@@ -50,7 +50,7 @@
  */
 package org.apache.fop.fo;
 
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
 import org.apache.fop.layoutmgr.LMiter;
 
@@ -64,7 +64,7 @@ public class FObjMixed extends FObj {
     /** TextInfo for this object */
     protected TextInfo textInfo = null;
     /** FontInfo for this object */
-    protected FontInfo fontInfo = null;
+    protected Document fontInfo = null;
 
     /**
      * @param parent FONode that is the parent of this object
index 6dbbc85ef3d8ae0b0c64940b09fe1db71b3c9316..dc5d9f918b959be1ffdcddab632ad94783bc7ab4 100644 (file)
@@ -58,7 +58,7 @@ import java.awt.geom.Rectangle2D;
 import org.apache.fop.area.CTM;
 import org.apache.fop.datatypes.FODimension;
 import org.apache.fop.layout.FontState;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonMarginBlock;
 import org.apache.fop.fo.properties.CommonMarginInline;
@@ -83,7 +83,7 @@ import org.apache.fop.fo.properties.CommonHyphenation;
 public class PropertyManager {
 
     private PropertyList properties;
-    private FontInfo fontInfo = null;
+    private Document fontInfo = null;
     private FontState fontState = null;
     private CommonBorderAndPadding borderAndPadding = null;
     private CommonHyphenation hyphProps = null;
@@ -122,7 +122,7 @@ public class PropertyManager {
      * available.
      * @param fontInfo available fonts
      */
-    public void setFontInfo(FontInfo fontInfo) {
+    public void setFontInfo(Document fontInfo) {
         this.fontInfo = fontInfo;
     }
 
@@ -133,7 +133,7 @@ public class PropertyManager {
      * @param fontInfo FontInfo to work with
      * @return a FontState object
      */
-    public FontState getFontState(FontInfo fontInfo) {
+    public FontState getFontState(Document fontInfo) {
         if (fontState == null) {
             if (fontInfo == null) {
                 fontInfo = this.fontInfo;
@@ -479,7 +479,7 @@ public class PropertyManager {
      * @param fontInfo available fonts
      * @return a TextInfo object
      */
-    public TextInfo getTextLayoutProps(FontInfo fontInfo) {
+    public TextInfo getTextLayoutProps(Document fontInfo) {
         if (textInfo == null) {
             textInfo = new TextInfo();
             textInfo.fs = getFontState(fontInfo);
index ea3f9790c29dbb51535e9058a273ce0631cbf9bc..285aef2e81a8d9b51a0d9bffe2c637dc0cb0a52c 100644 (file)
@@ -70,7 +70,7 @@ import org.apache.fop.fo.properties.CommonAccessibility;
 import org.apache.fop.fo.properties.CommonAural;
 import org.apache.fop.fo.properties.CommonBackground;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.layout.FontState;
 import org.apache.fop.fo.properties.CommonMarginInline;
 import org.apache.fop.fo.properties.CommonRelativePosition;
@@ -94,7 +94,7 @@ public class Leader extends FObjMixed {
     private int leaderPattern;
     private int patternWidth;
     /** FontInfo for this object */
-    protected FontInfo fontInfo = null;
+    protected Document fontInfo = null;
     /** FontState for this object */
     protected FontState fontState;
     protected InlineArea leaderArea = null;
index af8b3ea5726a5320417a321cdfcb35d0fa6b02de..f6488bd1a8b6b94f6b3d480a7dda43ce3b64c023 100644 (file)
@@ -58,7 +58,7 @@ import org.apache.fop.fo.properties.CommonAccessibility;
 import org.apache.fop.fo.properties.CommonAural;
 import org.apache.fop.fo.properties.CommonBackground;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.layout.FontState;
 import org.apache.fop.fo.properties.CommonMarginInline;
 import org.apache.fop.fo.properties.CommonRelativePosition;
@@ -82,7 +82,7 @@ import org.apache.fop.area.Trait;
  */
 public class PageNumber extends FObj {
     /** FontInfo for this object */
-    protected FontInfo fontInfo = null;
+    protected Document fontInfo = null;
     /** FontState for this object */
     protected FontState fontState;
 
index 367fd3e51044e074542543554ecfbec9f4af793e..53a2bafde3b3d700245af8df3f158397d4598b8f 100644 (file)
@@ -68,7 +68,7 @@ import org.apache.fop.fo.properties.CommonAccessibility;
 import org.apache.fop.fo.properties.CommonAural;
 import org.apache.fop.fo.properties.CommonBackground;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.layout.FontState;
 import org.apache.fop.fo.properties.CommonMarginInline;
 import org.apache.fop.fo.properties.CommonRelativePosition;
@@ -89,7 +89,7 @@ import org.apache.fop.util.CharUtilities;
  */
 public class PageNumberCitation extends FObj {
     /** FontInfo for this object **/
-    protected FontInfo fontInfo = null;
+    protected Document fontInfo = null;
     /** Fontstate for this object **/
     protected FontState fontState;
 
diff --git a/src/java/org/apache/fop/layout/FontInfo.java b/src/java/org/apache/fop/layout/FontInfo.java
deleted file mode 100644 (file)
index 6560fab..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * $Id: FontInfo.java,v 1.20 2003/03/06 22:19:16 jeremias Exp $
- * ============================================================================
- *                    The Apache Software License, Version 1.1
- * ============================================================================
- * 
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modifica-
- * tion, are permitted provided that the following conditions are met:
- * 
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 
- * 3. The end-user documentation included with the redistribution, if any, must
- *    include the following acknowledgment: "This product includes software
- *    developed by the Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself, if
- *    and wherever such third-party acknowledgments normally appear.
- * 
- * 4. The names "FOP" and "Apache Software Foundation" must not be used to
- *    endorse or promote products derived from this software without prior
- *    written permission. For written permission, please contact
- *    apache@apache.org.
- * 
- * 5. Products derived from this software may not be called "Apache", nor may
- *    "Apache" appear in their name, without prior written permission of the
- *    Apache Software Foundation.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * ============================================================================
- * 
- * This software consists of voluntary contributions made by many individuals
- * on behalf of the Apache Software Foundation and was originally created by
- * James Tauber <jtauber@jtauber.com>. For more information on the Apache
- * Software Foundation, please see <http://www.apache.org/>.
- */ 
-package org.apache.fop.layout;
-
-// Java
-import java.util.Map;
-
-// FOP
-import org.apache.fop.fonts.FontMetrics;
-
-/**
- * The FontInfo for the layout and rendering of a fo document.
- * This stores the list of available fonts that are setup by
- * the renderer. The font name can be retrieved for the
- * family style and weight.
- * <br>
- * Currently font supported font-variant small-caps is not
- * implemented.
- */
-public class FontInfo {
-    
-    /** Default fallback key */
-    public static final String DEFAULT_FONT = "any,normal,400";
-    /** Normal font weight */
-    public static final int NORMAL = 400;
-    /** Bold font weight */
-    public static final int BOLD = 700;
-
-    /** Map containing fonts that have been used */
-    private Map usedFonts;
-    
-    /** look up a font-triplet to find a font-name */
-    private Map triplets;
-    
-    /** look up a font-name to get a font (that implements FontMetrics at least) */
-    private Map fonts;
-
-    /**
-     * Main constructor
-     */
-    public FontInfo() {
-        this.triplets = new java.util.HashMap();
-        this.fonts = new java.util.HashMap();
-        this.usedFonts = new java.util.HashMap();
-    }
-
-    /**
-     * Checks if the font setup is valid (At least the ultimate fallback font 
-     * must be registered.)
-     * @return True if valid
-     */
-    public boolean isSetupValid() {
-        return triplets.containsKey(DEFAULT_FONT);
-    }
-
-    /**
-     * Adds a new font triplet.
-     * @param name internal key
-     * @param family font family name
-     * @param style font style (normal, italic, oblique...)
-     * @param weight font weight
-     */
-    public void addFontProperties(String name, String family, String style,
-                                  int weight) {
-        /*
-         * add the given family, style and weight as a lookup for the font
-         * with the given name
-         */
-
-        String key = createFontKey(family, style, weight);
-        this.triplets.put(key, name);
-    }
-
-    /**
-     * Adds font metrics for a specific font.
-     * @param name internal key
-     * @param metrics metrics to register
-     */
-    public void addMetrics(String name, FontMetrics metrics) {
-        // add the given metrics as a font with the given name
-
-        this.fonts.put(name, metrics);
-    }
-
-    /**
-     * Lookup a font.
-     * <br>
-     * Locate the font name for a given family, style and weight.
-     * The font name can then be used as a key as it is unique for
-     * the associated document.
-     * This also adds the font to the list of used fonts.
-     * @param family font family
-     * @param style font style
-     * @param weight font weight
-     * @return internal key
-     */
-    public String fontLookup(String family, String style,
-                             int weight) {
-        String key;
-        // first try given parameters
-        key = createFontKey(family, style, weight);
-        String f = (String)triplets.get(key);
-        if (f == null) {
-            // then adjust weight, favouring normal or bold
-            f = findAdjustWeight(family, style, weight);
-
-            // then try any family with orig weight
-            if (f == null) {
-                key = createFontKey("any", style, weight);
-                f = (String)triplets.get(key);
-            }
-
-            // then try any family with adjusted weight
-            if (f == null) {
-                f = findAdjustWeight(family, style, weight);
-            }
-
-            // then use default
-            if (f == null) {
-                f = (String)triplets.get(DEFAULT_FONT);
-            }
-
-        }
-
-        usedFonts.put(f, fonts.get(f));
-        return f;
-    }
-
-    /**
-     * Find a font with a given family and style by trying
-     * different font weights according to the spec.
-     * @param family font family
-     * @param style font style
-     * @param weight font weight
-     * @return internal key
-     */
-    public String findAdjustWeight(String family, String style,
-                             int weight) {
-        String key;
-        String f = null;
-        int newWeight = weight;
-        if (newWeight < 400) {
-            while (f == null && newWeight > 0) {
-                newWeight -= 100;
-                key = createFontKey(family, style, newWeight);
-                f = (String)triplets.get(key);
-            }
-        } else if (newWeight == 500) {
-            key = createFontKey(family, style, 400);
-            f = (String)triplets.get(key);
-        } else if (newWeight > 500) {
-            while (f == null && newWeight < 1000) {
-                newWeight += 100;
-                key = createFontKey(family, style, newWeight);
-                f = (String)triplets.get(key);
-            }
-            newWeight = weight;
-            while (f == null && newWeight > 400) {
-                newWeight -= 100;
-                key = createFontKey(family, style, newWeight);
-                f = (String)triplets.get(key);
-            }
-        }
-        if (f == null) {
-            key = createFontKey(family, style, 400);
-            f = (String)triplets.get(key);
-        }
-
-        return f;
-    }
-
-    /**
-     * Determines if a particular font is available.
-     * @param family font family
-     * @param style font style
-     * @param weight font weight
-     * @return True if available
-     */
-    public boolean hasFont(String family, String style, int weight) {
-        String key = createFontKey(family, style, weight);
-        return this.triplets.containsKey(key);
-    }
-
-    /**
-     * Creates a key from the given strings.
-     * @param family font family
-     * @param style font style
-     * @param weight font weight
-     * @return internal key
-     */
-    public static String createFontKey(String family, String style,
-                                       int weight) {
-        return family + "," + style + "," + weight;
-    }
-
-    /**
-     * Gets a Map of all registred fonts.
-     * @return a read-only Map with font key/FontMetrics pairs
-     */
-    public Map getFonts() {
-        return java.util.Collections.unmodifiableMap(this.fonts);
-    }
-
-    /**
-     * This is used by the renderers to retrieve all the
-     * fonts used in the document.
-     * This is for embedded font or creating a list of used fonts.
-     * @return a read-only Map with font key/FontMetrics pairs
-     */
-    public Map getUsedFonts() {
-        return this.usedFonts;
-    }
-
-    /**
-     * Returns the FontMetrics for a particular font
-     * @param fontName internal key
-     * @return font metrics
-     */
-    public FontMetrics getMetricsFor(String fontName) {
-        usedFonts.put(fontName, fonts.get(fontName));
-        return (FontMetrics)fonts.get(fontName);
-    }
-}
-
index 97f47c40115f63a6cabc99665816365cb1fc7b80..a5b65b4c0737c9a594d790df449c8d6e1f3472b9 100644 (file)
@@ -65,7 +65,7 @@ import org.apache.fop.fo.pagination.Flow;
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fo.pagination.PageSequenceMaster;
 import org.apache.fop.fo.pagination.SimplePageMaster;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.flow.ExternalGraphic;
 import org.apache.fop.fo.flow.InstreamForeignObject;
@@ -91,7 +91,7 @@ public class MIFHandler extends FOInputHandler {
     protected MIFFile mifFile;
     /** the OutputStream to write to */
     protected OutputStream outStream;
-    private FontInfo fontInfo = new FontInfo();
+    private Document fontInfo = new Document();
 
     // current state elements
     private MIFElement textFlow;
@@ -111,7 +111,7 @@ public class MIFHandler extends FOInputHandler {
     /**
      * @see org.apache.fop.fo.FOInputHandler#getFontInfo()
      */
-    public FontInfo getFontInfo() {
+    public Document getFontInfo() {
         return fontInfo;
     }
 
index 3e27bd5d6c63090c879dc3cc9a8d00df7f132465..979946ff8c05fef9ad7a5b007aca94d8d6e83a89 100644 (file)
@@ -88,7 +88,7 @@ import org.apache.fop.area.inline.Viewport;
 import org.apache.fop.area.inline.Word;
 import org.apache.fop.area.inline.Character;
 import org.apache.fop.fo.FOUserAgent;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 // Avalon
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
@@ -168,7 +168,7 @@ public abstract class AbstractRenderer extends AbstractLogEnabled
     }
 
     /** @see org.apache.fop.render.Renderer */
-    public abstract void setupFontInfo(FontInfo fontInfo);
+    public abstract void setupFontInfo(Document fontInfo);
 
     /** @see org.apache.fop.render.Renderer */
     public void setUserAgent(FOUserAgent agent) {
index bd4cfedc5b8641adbd03aad0be84311c7a1bb4da..cc5c66c3cc33ab05d341f4366eff97ce5859adeb 100644 (file)
@@ -52,7 +52,7 @@ package org.apache.fop.render;
 
 // FOP
 import org.apache.fop.render.pdf.FontSetup;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 // Java
 import java.util.List;
@@ -61,7 +61,7 @@ import java.util.List;
 public abstract class PrintRenderer extends AbstractRenderer {
 
     /** Font configuration */
-    protected FontInfo fontInfo;
+    protected Document fontInfo;
 
     /** list of fonts */
     protected List fontList = null;
@@ -71,7 +71,7 @@ public abstract class PrintRenderer extends AbstractRenderer {
      *
      * @param fontInfo  font info to set up
      */
-    public void setupFontInfo(FontInfo fontInfo) {
+    public void setupFontInfo(Document fontInfo) {
         this.fontInfo = fontInfo;
         FontSetup.setup(fontInfo, fontList);
     }
index d096c3381777fb32d560934f088a05f17da495df..8582f5e825cd03374d5f3e6b49b3bc0e11a436a9 100644 (file)
@@ -66,7 +66,7 @@ import org.apache.fop.area.inline.Leader;
 import org.apache.fop.area.inline.Space;
 import org.apache.fop.area.inline.Viewport;
 import org.apache.fop.area.inline.Word;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.fo.FOUserAgent;
 
 /**
@@ -123,7 +123,7 @@ public interface Renderer {
      *
      * @param fontInfo  The fonts
      */
-    void setupFontInfo(FontInfo fontInfo);
+    void setupFontInfo(Document fontInfo);
 
     /**
      * Set up renderer options.
index 4314078cd2dad093853fc7679da7d76c54542565..1a699f804b8a98cfbbddf3c3f76f0ec39209e30a 100644 (file)
@@ -77,7 +77,7 @@ import java.util.Map;
 
 // FOP
 import org.apache.fop.apps.InputHandler;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.render.AbstractRenderer;
 import org.apache.fop.viewer.PreviewDialog;
 import org.apache.fop.viewer.Translator;
@@ -159,7 +159,7 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
         return 0;
     }
 
-    public void setupFontInfo(FontInfo fontInfo) {
+    public void setupFontInfo(Document fontInfo) {
         // create a temp Image to test font metrics on
         BufferedImage fontImage =
             new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
index 732e0d721bfffb2bf4deec137d38fa1eba7fbd9b..5e4ec99aa0a6d687887f570ac933895a34fd9855 100644 (file)
@@ -51,7 +51,7 @@
 package org.apache.fop.render.awt;
 
 // FOP
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 // Java
 import java.awt.Graphics2D;
@@ -74,7 +74,7 @@ public class FontSetup {
      * @param fontInfo the font info object to set up
      * @param graphics needed for acces to font metrics
      */
-    public static void setup(FontInfo fontInfo, Graphics2D graphics) {
+    public static void setup(Document fontInfo, Graphics2D graphics) {
         FontMetricsMapper metric;
         int normal, bold, bolditalic, italic;
 
@@ -140,52 +140,52 @@ public class FontSetup {
         // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic());
 
         /* any is treated as serif */
-        fontInfo.addFontProperties("F5", "any", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "any", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "any", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "any", "oblique", FontInfo.BOLD);
-
-        fontInfo.addFontProperties("F1", "sans-serif", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F3", "sans-serif", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F5", "serif", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "serif", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F9", "monospace", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F11", "monospace", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "italic", FontInfo.BOLD);
-
-        fontInfo.addFontProperties("F1", "Helvetica", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F3", "Helvetica", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F5", "Times", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "Times", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F9", "Courier", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F11", "Courier", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F13", "Symbol", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", FontInfo.NORMAL);
+        fontInfo.addFontProperties("F5", "any", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "any", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "any", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "any", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "any", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F8", "any", "oblique", Document.BOLD);
+
+        fontInfo.addFontProperties("F1", "sans-serif", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F3", "sans-serif", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F5", "serif", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "serif", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "serif", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "serif", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F9", "monospace", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F11", "monospace", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "italic", Document.BOLD);
+
+        fontInfo.addFontProperties("F1", "Helvetica", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F3", "Helvetica", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F5", "Times", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "Times", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F9", "Courier", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F11", "Courier", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F13", "Symbol", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Document.NORMAL);
 
         // Custom type 1 fonts step 2/2
         // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL);
@@ -193,20 +193,20 @@ public class FontSetup {
         // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", FontInfo.BOLD);
 
         /* for compatibility with PassiveTex */
-        fontInfo.addFontProperties("F5", "Times-Roman", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "Times-Roman", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F5", "Times Roman", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "Times Roman", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "italic", FontInfo.BOLD);
+        fontInfo.addFontProperties("F5", "Times-Roman", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "Times-Roman", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F5", "Times Roman", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "Times Roman", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "italic", Document.BOLD);
         fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
-                                   "normal", FontInfo.NORMAL);
+                                   "normal", Document.NORMAL);
     }
 
 }
index b00e924fcb412df08294474b80828fa887294593..7687328d9387e3f6b514d59b745243b37614fedc 100644 (file)
@@ -57,7 +57,7 @@ import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontDescriptor;
 import org.apache.fop.fonts.FontUtil;
 import org.apache.fop.fonts.LazyFont;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.pdf.PDFDocument;
 import org.apache.fop.pdf.PDFResources;
 // FOP (base 14 fonts)
@@ -98,7 +98,7 @@ public class FontSetup {
      * @param fontInfo the font info object to set up
      * @param embedList ???
      */
-    public static void setup(FontInfo fontInfo, List embedList) {
+    public static void setup(Document fontInfo, List embedList) {
 
         fontInfo.addMetrics("F1", new Helvetica());
         fontInfo.addMetrics("F2", new HelveticaOblique());
@@ -121,52 +121,52 @@ public class FontSetup {
         // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic());
 
         /* any is treated as serif */
-        fontInfo.addFontProperties("F5", "any", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "any", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "any", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "any", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "any", "oblique", FontInfo.BOLD);
+        fontInfo.addFontProperties("F5", "any", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "any", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "any", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "any", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "any", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F8", "any", "oblique", Document.BOLD);
 
-        fontInfo.addFontProperties("F1", "sans-serif", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "sans-serif", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F3", "sans-serif", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "sans-serif", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F5", "serif", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "serif", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "serif", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "serif", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F9", "monospace", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "monospace", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F11", "monospace", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "monospace", "italic", FontInfo.BOLD);
+        fontInfo.addFontProperties("F1", "sans-serif", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "sans-serif", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F3", "sans-serif", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F4", "sans-serif", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F5", "serif", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "serif", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "serif", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "serif", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "serif", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F9", "monospace", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "monospace", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F11", "monospace", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F12", "monospace", "italic", Document.BOLD);
 
-        fontInfo.addFontProperties("F1", "Helvetica", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F2", "Helvetica", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F3", "Helvetica", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F4", "Helvetica", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F5", "Times", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "Times", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F9", "Courier", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F10", "Courier", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F11", "Courier", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F12", "Courier", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F13", "Symbol", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", FontInfo.NORMAL);
+        fontInfo.addFontProperties("F1", "Helvetica", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F2", "Helvetica", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F3", "Helvetica", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F4", "Helvetica", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F5", "Times", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "Times", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F9", "Courier", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F10", "Courier", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F11", "Courier", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F12", "Courier", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F13", "Symbol", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", Document.NORMAL);
 
         // Custom type 1 fonts step 2/2
         // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL);
@@ -174,20 +174,20 @@ public class FontSetup {
         // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", FontInfo.BOLD);
 
         /* for compatibility with PassiveTex */
-        fontInfo.addFontProperties("F5", "Times-Roman", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times-Roman", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "Times-Roman", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times-Roman", "italic", FontInfo.BOLD);
-        fontInfo.addFontProperties("F5", "Times Roman", "normal", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "oblique", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F6", "Times Roman", "italic", FontInfo.NORMAL);
-        fontInfo.addFontProperties("F7", "Times Roman", "normal", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "oblique", FontInfo.BOLD);
-        fontInfo.addFontProperties("F8", "Times Roman", "italic", FontInfo.BOLD);
+        fontInfo.addFontProperties("F5", "Times-Roman", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times-Roman", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "Times-Roman", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times-Roman", "italic", Document.BOLD);
+        fontInfo.addFontProperties("F5", "Times Roman", "normal", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "oblique", Document.NORMAL);
+        fontInfo.addFontProperties("F6", "Times Roman", "italic", Document.NORMAL);
+        fontInfo.addFontProperties("F7", "Times Roman", "normal", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "oblique", Document.BOLD);
+        fontInfo.addFontProperties("F8", "Times Roman", "italic", Document.BOLD);
         fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
-                                   "normal", FontInfo.NORMAL);
+                                   "normal", Document.NORMAL);
 
         /* Add configured fonts */
         addConfiguredFonts(fontInfo, embedList, 15);
@@ -200,7 +200,7 @@ public class FontSetup {
      * @param fontInfos ???
      * @param num starting index for internal font numbering
      */
-    public static void addConfiguredFonts(FontInfo fontInfo, List fontInfos, int num) {
+    public static void addConfiguredFonts(Document fontInfo, List fontInfos, int num) {
         if (fontInfos == null) {
             return; //No fonts to process
         }
@@ -248,7 +248,7 @@ public class FontSetup {
      * @param resources PDFResources object to attach the font to
      * @param fontInfo font info object to get font information from
      */
-    public static void addToResources(PDFDocument doc, PDFResources resources, FontInfo fontInfo) {
+    public static void addToResources(PDFDocument doc, PDFResources resources, Document fontInfo) {
         Map fonts = fontInfo.getUsedFonts();
         Iterator e = fonts.keySet().iterator();
         while (e.hasNext()) {
index 3fd9a224c6ec4c629a5ee93281512d22224f8e11..2850be8c64645b2684f791def54f5b6f9b27d70d 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.pdf;
 
 // Java
@@ -273,7 +273,7 @@ public class PDFRenderer extends PrintRenderer {
         this.pdfDoc.setCreator(creator);
         this.pdfDoc.setFilterMap(filterMap);
         this.pdfDoc.outputHeader(stream);
-        
+
         //Setup encryption if necessary
         PDFEncryptionManager.setupPDFEncryption(userAgent, this.pdfDoc, getLogger());
     }
@@ -352,27 +352,27 @@ public class PDFRenderer extends PrintRenderer {
             renderOutline(outline.getSubData(i), pdfOutline);
         }
     }
-    
+
     /** Saves the graphics state of the rendering engine. */
     protected void saveGraphicsState() {
         currentStream.add("q\n");
     }
-    
+
     /** Restores the last graphics state of the rendering engine. */
     protected void restoreGraphicsState() {
         currentStream.add("Q\n");
     }
-    
+
     /** Indicates the beginning of a text object. */
     protected void beginTextObject() {
         currentStream.add("BT\n");
     }
-        
+
     /** Indicates the end of a text object. */
     protected void endTextObject() {
         currentStream.add("ET\n");
     }
-        
+
     /**
      * Start the next page sequence.
      * For the pdf renderer there is no concept of page sequences
@@ -421,7 +421,7 @@ public class PDFRenderer extends PrintRenderer {
      * immediately to the output stream.
      * @see org.apache.fop.render.Renderer#renderPage(PageViewport)
      */
-    public void renderPage(PageViewport page) 
+    public void renderPage(PageViewport page)
                 throws IOException, FOPException {
         if (pages != null
                 && (currentPage = (PDFPage) pages.get(page)) != null) {
@@ -537,8 +537,8 @@ public class PDFRenderer extends PrintRenderer {
      * @param width the width of the area
      * @param height the height of the area
      */
-    protected void drawBackAndBorders(Area block, 
-                    float startx, float starty, 
+    protected void drawBackAndBorders(Area block,
+                    float startx, float starty,
                     float width, float height) {
         // draw background then border
 
@@ -1172,7 +1172,7 @@ public class PDFRenderer extends PrintRenderer {
         context.setProperty(PDFXMLHandler.OUTPUT_STREAM, ostream);
         context.setProperty(PDFXMLHandler.PDF_STATE, currentState);
         context.setProperty(PDFXMLHandler.PDF_PAGE, currentPage);
-        context.setProperty(PDFXMLHandler.PDF_CONTEXT, 
+        context.setProperty(PDFXMLHandler.PDF_CONTEXT,
                     currentContext == null ? currentPage : currentContext);
         context.setProperty(PDFXMLHandler.PDF_CONTEXT, currentContext);
         context.setProperty(PDFXMLHandler.PDF_STREAM, currentStream);
@@ -1291,7 +1291,7 @@ public class PDFRenderer extends PrintRenderer {
             }
 
         }
-        
+
         restoreGraphicsState();
         beginTextObject();
         super.renderLeader(area);
index f58d71da65abfd7e4ba04298d7f69bd0892a467c..2a627bf78c4edc6c20984502c1f7355754e7e514 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.pdf;
 
 import org.apache.fop.render.XMLHandler;
@@ -62,9 +62,10 @@ import org.apache.fop.svg.PDFTextElementBridge;
 import org.apache.fop.svg.PDFAElementBridge;
 import org.apache.fop.svg.PDFGraphics2D;
 import org.apache.fop.svg.SVGUserAgent;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
-import org.w3c.dom.Document;
+/* org.w3c.dom.Document is not imported to avoid conflict with
+   org.apache.fop.control.Document */
 
 import java.io.OutputStream;
 
@@ -166,7 +167,7 @@ public class PDFXMLHandler implements XMLHandler {
      * @param ns the namespace of the XML document
      * @throws Exception any sort of exception could be thrown and shuld be handled
      */
-    public void handleXML(RendererContext context, Document doc,
+    public void handleXML(RendererContext context, org.w3c.dom.Document doc,
                           String ns) throws Exception {
         PDFInfo pdfi = getPDFInfo(context);
 
@@ -194,7 +195,7 @@ public class PDFXMLHandler implements XMLHandler {
         pdfi.currentStream = (PDFStream)context.getProperty(PDF_STREAM);
         pdfi.width = ((Integer)context.getProperty(PDF_WIDTH)).intValue();
         pdfi.height = ((Integer)context.getProperty(PDF_HEIGHT)).intValue();
-        pdfi.fi = (FontInfo)context.getProperty(PDF_FONT_INFO);
+        pdfi.fi = (Document)context.getProperty(PDF_FONT_INFO);
         pdfi.currentFontName = (String)context.getProperty(PDF_FONT_NAME);
         pdfi.currentFontSize = ((Integer)context.getProperty(PDF_FONT_SIZE)).intValue();
         pdfi.currentXPosition = ((Integer)context.getProperty(PDF_XPOS)).intValue();
@@ -223,7 +224,7 @@ public class PDFXMLHandler implements XMLHandler {
         /** see PDF_HEIGHT */
         public int height;
         /** see PDF_FONT_INFO */
-        public FontInfo fi;
+        public Document fi;
         /** see PDF_FONT_NAME */
         public String currentFontName;
         /** see PDF_FONT_SIZE */
@@ -245,7 +246,8 @@ public class PDFXMLHandler implements XMLHandler {
          * @param doc the svg document
          * @param pdfInfo the pdf information of the current context
          */
-        protected void renderSVGDocument(RendererContext context, Document doc, PDFInfo pdfInfo) {
+        protected void renderSVGDocument(RendererContext context,
+                org.w3c.dom.Document doc, PDFInfo pdfInfo) {
             int xOffset = pdfInfo.currentXPosition;
             int yOffset = pdfInfo.currentYPosition;
 
index 7ab57905f87a27c73cf3dcabe751f44e1882a954..c48fe82aa13ee394cb2bbe4bcd018c22a357ff05 100644 (file)
@@ -62,7 +62,7 @@ import java.io.IOException;
 
 //FOP
 import org.apache.fop.render.pdf.FontSetup;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 /**
  * This class is a wrapper for the <tt>PSGraphics2D</tt> that
@@ -94,7 +94,7 @@ public class PSDocumentGraphics2D extends PSGraphics2D {
         super(textAsShapes);
 
         if (!textAsShapes) {
-            fontInfo = new FontInfo();
+            fontInfo = new Document();
             FontSetup.setup(fontInfo, null);
             //FontState fontState = new FontState("Helvetica", "normal",
             //                          FontInfo.NORMAL, 12, 0);
@@ -187,7 +187,7 @@ public class PSDocumentGraphics2D extends PSGraphics2D {
      * Get the font info for this PostScript document.
      * @return the font information
      */
-    public FontInfo getFontInfo() {
+    public Document getFontInfo() {
         return fontInfo;
     }
 
index e5d26327a55129fe7507710913edac3995e5e2c1..068d6272edcb2b542b1438d2ae4221610f83cb29 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.ps;
 
 //Java
@@ -83,7 +83,7 @@ import java.awt.image.renderable.RenderableImage;
 import java.io.IOException;
 
 // FOP
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.layout.FontState;
 
 // Batik
@@ -114,10 +114,10 @@ public class PSGraphics2D extends AbstractGraphics2D {
 
     /** Currently valid FontState */
     protected FontState fontState;
-    
+
     /** Overriding FontState */
     protected FontState overrideFontState = null;
-    
+
     /**
      * the current (internal) font name
      */
@@ -144,7 +144,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
     protected Color currentColour = new Color(0, 0, 0);
 
     /** FontInfo containing all available fonts */
-    protected FontInfo fontInfo;
+    protected Document fontInfo;
 
     /**
      * Create a new Graphics2D that generates PostScript code.
@@ -521,13 +521,13 @@ public class PSGraphics2D extends AbstractGraphics2D {
             Shape imclip = getClip();
             writeClip(imclip);
             Color c = getColor();
-            gen.writeln(gen.formatDouble(c.getRed() / 255.0) + " " 
-                      + gen.formatDouble(c.getGreen() / 255.0) + " " 
+            gen.writeln(gen.formatDouble(c.getRed() / 255.0) + " "
+                      + gen.formatDouble(c.getGreen() / 255.0) + " "
                       + gen.formatDouble(c.getBlue() / 255.0) + " setrgbcolor");
-            
+
             applyPaint(getPaint(), false);
             applyStroke(getStroke());
-            
+
             gen.writeln("newpath");
             PathIterator iter = s.getPathIterator(getTransform());
             while (!iter.isDone()) {
@@ -554,9 +554,9 @@ public class PSGraphics2D extends AbstractGraphics2D {
                               + " M");
                     break;
                 case PathIterator.SEG_QUADTO:
-                    gen.writeln(gen.formatDouble(1000 * vals[0]) + " " 
-                              + gen.formatDouble(1000 * vals[1]) + " " 
-                              + gen.formatDouble(1000 * vals[2]) + " " 
+                    gen.writeln(gen.formatDouble(1000 * vals[0]) + " "
+                              + gen.formatDouble(1000 * vals[1]) + " "
+                              + gen.formatDouble(1000 * vals[2]) + " "
                               + gen.formatDouble(1000 * vals[3]) + " QUADTO ");
                     break;
                 case PathIterator.SEG_CLOSE:
@@ -606,9 +606,9 @@ public class PSGraphics2D extends AbstractGraphics2D {
                               + " M");
                     break;
                 case PathIterator.SEG_QUADTO:
-                    gen.writeln(gen.formatDouble(1000 * vals[0]) + " " 
-                              + gen.formatDouble(1000 * vals[1]) + " " 
-                              + gen.formatDouble(1000 * vals[2]) + " " 
+                    gen.writeln(gen.formatDouble(1000 * vals[0]) + " "
+                              + gen.formatDouble(1000 * vals[1]) + " "
+                              + gen.formatDouble(1000 * vals[2]) + " "
                               + gen.formatDouble(1000 * vals[3]) + " QUADTO ");
                     break;
                 case PathIterator.SEG_CLOSE:
@@ -689,7 +689,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
         try {
             if (stroke instanceof BasicStroke) {
                 BasicStroke bs = (BasicStroke)stroke;
-            
+
                 float[] da = bs.getDashArray();
                 if (da != null) {
                     gen.writeln("[");
@@ -715,7 +715,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
                     gen.writeln(2 + " setlinecap");
                     break;
                 }
-            
+
                 int lj = bs.getLineJoin();
                 switch (lj) {
                 case BasicStroke.JOIN_MITER:
@@ -730,7 +730,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
                 }
                 float lw = bs.getLineWidth();
                 gen.writeln(gen.formatDouble(1000 * lw) + " setlinewidth");
-            
+
                 float ml = bs.getMiterLimit();
                 gen.writeln(gen.formatDouble(1000 * ml) + " setmiterlimit");
             }
@@ -834,7 +834,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
             int siz = gFont.getSize();
             String style = gFont.isItalic() ? "italic" : "normal";
             String weight = gFont.isBold() ? "bold" : "normal";
-            
+
             //try {
                 //fontState = new FontState(n, fontState.getFontMetrics(),siz);
             //} catch (org.apache.fop.apps.FOPException fope) {
@@ -847,10 +847,10 @@ public class PSGraphics2D extends AbstractGraphics2D {
         Shape imclip = getClip();
         writeClip(imclip);
         Color c = getColor();
-        gen.writeln(c.getRed() / 255.0 + " " 
-                  + c.getGreen() / 255.0 + " " 
+        gen.writeln(c.getRed() / 255.0 + " "
+                  + c.getGreen() / 255.0 + " "
                   + c.getBlue() / 255.0 + " setrgbcolor");
-  
+
         AffineTransform trans = getTransform();
         trans.translate(x, y);
         double[] vals = new double[6];
@@ -859,10 +859,10 @@ public class PSGraphics2D extends AbstractGraphics2D {
                   + gen.formatDouble(1000 * vals[5]) + " moveto ");
         //String fontWeight = fontState.getFontWeight();
         StringBuffer sb = new StringBuffer();
-  
+
         int l = s.length();
 
-        if ((currentFontName != fontState.getFontName()) 
+        if ((currentFontName != fontState.getFontName())
                 || (currentFontSize != fontState.getFontSize())) {
             gen.writeln(fontState.getFontName() + " " + fontState.getFontSize() + " F");
             currentFontName = fontState.getFontName();
@@ -886,7 +886,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
         psString = " (" + sb.toString() + ") " + " t ";
 
         gen.writeln(" 1.0 -1.0 scale");
-        gen.writeln(psString);        
+        gen.writeln(psString);
         gen.writeln(" 1.0 -1.0 scale");
       } catch (IOException ioe) {
           handleIOException(ioe);
@@ -922,7 +922,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
                            float y) {
         try {
             System.err.println("drawString(AttributedCharacterIterator)");
-            
+
             gen.writeln("BT");
             Shape imclip = getClip();
             writeClip(imclip);
@@ -932,16 +932,16 @@ public class PSGraphics2D extends AbstractGraphics2D {
             c = getBackground();
             Color col = new Color(c.getRed(), c.getGreen(), c.getBlue());
             //gen.writeln(col.getColorSpaceOut(false));
-            
+
             AffineTransform trans = getTransform();
             trans.translate(x, y);
             double[] vals = new double[6];
             trans.getMatrix(vals);
-            
+
             for (char ch = iterator.first(); ch != CharacterIterator.DONE;
                     ch = iterator.next()) {
                 //Map attr = iterator.getAttributes();
-            
+
                 gen.writeln(gen.formatDouble(vals[0]) + " "
                           + gen.formatDouble(vals[1]) + " "
                           + gen.formatDouble(vals[2]) + " "
@@ -951,7 +951,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
                           + gen.formatDouble(vals[6]) + " Tm [" + ch
                           + "]");
             }
-            
+
             gen.writeln("ET");
         } catch (IOException ioe) {
             handleIOException(ioe);
@@ -982,9 +982,9 @@ public class PSGraphics2D extends AbstractGraphics2D {
             gen.writeln(gen.formatDouble(c.getRed() / 255.0) + " "
                       + gen.formatDouble(c.getGreen() / 255.0) + " "
                       + gen.formatDouble(c.getBlue() / 255.0) + " setrgbcolor");
-            
+
             applyPaint(getPaint(), true);
-            
+
             gen.writeln("newpath");
             PathIterator iter = s.getPathIterator(getTransform());
             while (!iter.isDone()) {
@@ -1011,9 +1011,9 @@ public class PSGraphics2D extends AbstractGraphics2D {
                               + " M");
                     break;
                 case PathIterator.SEG_QUADTO:
-                    gen.writeln(gen.formatDouble(1000 * vals[0]) + " " 
-                              + gen.formatDouble(1000 * vals[1]) + " " 
-                              + gen.formatDouble(1000 * vals[2]) + " " 
+                    gen.writeln(gen.formatDouble(1000 * vals[0]) + " "
+                              + gen.formatDouble(1000 * vals[1]) + " "
+                              + gen.formatDouble(1000 * vals[2]) + " "
                               + gen.formatDouble(1000 * vals[3]) + " QUADTO ");
                     break;
                 case PathIterator.SEG_CLOSE:
@@ -1039,7 +1039,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
      * @param nonzero ???
      * @exception IOException In case of an I/O problem
      */
-    protected void doDrawing(boolean fill, boolean stroke, boolean nonzero) 
+    protected void doDrawing(boolean fill, boolean stroke, boolean nonzero)
                 throws IOException {
         if (fill) {
             if (stroke) {
@@ -1091,7 +1091,7 @@ public class PSGraphics2D extends AbstractGraphics2D {
     public void setOverrideFontState(FontState infont) {
         overrideFontState = infont;
     }
-    
+
     /**
      * Gets the font metrics for the specified font.
      * @return    the font metrics for the specified font.
index 870490446a0f5de99205d1f0797a31d2bebbd1be..dadfaae199821d3e697aa426f57d9ae68f432307 100644 (file)
@@ -56,7 +56,7 @@ import java.util.Map;
 
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.Glyphs;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 /**
  * This class defines the basic resources (procsets) used by FOP's PostScript
@@ -209,7 +209,7 @@ public final class PSProcSets {
      * @param fontInfo available fonts
      * @throws IOException in case of an I/O problem
      */
-    public static void writeFontDict(PSGenerator gen, FontInfo fontInfo) 
+    public static void writeFontDict(PSGenerator gen, Document fontInfo) 
                 throws IOException {
         gen.writeln("%%BeginResource: procset FOPFonts");
         gen.writeln("%%Title: Font setup (shortcuts) for this file");
index 191f46ee35838670b4866168bdfcebe8a27d44cb..180bb766f3a0ae4deed53520e3ec776b283d4059 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.ps;
 
 // Java
@@ -73,7 +73,7 @@ import org.apache.fop.area.inline.Word;
 import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.fo.FOUserAgent;
 import org.apache.fop.fonts.Font;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.render.AbstractRenderer;
 import org.apache.fop.render.RendererContext;
 
@@ -81,7 +81,9 @@ import org.apache.fop.image.FopImage;
 import org.apache.fop.image.ImageFactory;
 import org.apache.fop.traits.BorderProps;
 
-import org.w3c.dom.Document;
+/* org.w3c.dom.Document is not imported to avoid conflict with
+   org.apache.fop.control.Document */
+
 /**
  * Renderer that renders to PostScript.
  * <br>
@@ -96,7 +98,7 @@ import org.w3c.dom.Document;
  * <br>
  * The PS renderer operates in millipoints as the layout engine. Since PostScript
  * initially uses points, scaling is applied as needed.
- * 
+ *
  * @author <a href="mailto:fop-dev@xml.apache.org">Apache XML FOP Development Team</a>
  * @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
  * @version $Id: PSRenderer.java,v 1.31 2003/03/11 08:42:24 jeremias Exp $
@@ -122,7 +124,7 @@ public class PSRenderer extends AbstractRenderer {
     private float currGreen;
     private float currBlue;
 
-    private FontInfo fontInfo;
+    private Document fontInfo;
 
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
@@ -131,7 +133,7 @@ public class PSRenderer extends AbstractRenderer {
         super.configure(cfg);
         this.autoRotateLandscape = cfg.getChild("auto-rotate-landscape").getValueAsBoolean(false);
     }
-    
+
     /**
      * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent)
      */
@@ -201,7 +203,7 @@ public class PSRenderer extends AbstractRenderer {
             handleIOTrouble(ioe);
         }
     }
-    
+
     /** Restores the last graphics state of the rendering engine. */
     public void restoreGraphicsState() {
         try {
@@ -211,12 +213,12 @@ public class PSRenderer extends AbstractRenderer {
             handleIOTrouble(ioe);
         }
     }
-    
+
     /** Indicates the beginning of a text object. */
     protected void beginTextObject() {
         writeln("BT");
     }
-        
+
     /** Indicates the end of a text object. */
     protected void endTextObject() {
         writeln("ET");
@@ -232,7 +234,7 @@ public class PSRenderer extends AbstractRenderer {
      * @param f F part
      */
     protected void concatMatrix(double a, double b,
-                                double c, double d, 
+                                double c, double d,
                                 double e, double f) {
         try {
             gen.concatMatrix(a, b, c, d, e, f);
@@ -240,7 +242,7 @@ public class PSRenderer extends AbstractRenderer {
             handleIOTrouble(ioe);
         }
     }
-    
+
     /**
      * Concats the transformations matrix.
      * @param matrix Matrix to use
@@ -252,13 +254,13 @@ public class PSRenderer extends AbstractRenderer {
             handleIOTrouble(ioe);
         }
     }
-                                
+
     /**
      * Set up the font info
      *
      * @param fontInfo the font info object to set up
      */
-    public void setupFontInfo(FontInfo fontInfo) {
+    public void setupFontInfo(Document fontInfo) {
         /* use PDF's font setup to get PDF metrics */
         org.apache.fop.render.pdf.FontSetup.setup(fontInfo, null);
         this.fontInfo = fontInfo;
@@ -338,22 +340,22 @@ public class PSRenderer extends AbstractRenderer {
         //Setup for PostScript generation
         this.gen = new PSGenerator(outputStream);
         this.currentPageNumber = 0;
-        
+
         //PostScript Header
         writeln(DSCConstants.PS_ADOBE_30);
         gen.writeDSCComment(DSCConstants.CREATOR, new String[] {"FOP " + this.producer});
         gen.writeDSCComment(DSCConstants.CREATION_DATE, new Object[] {new java.util.Date()});
         gen.writeDSCComment(DSCConstants.PAGES, new Object[] {PSGenerator.ATEND});
         gen.writeDSCComment(DSCConstants.END_COMMENTS);
-        
+
         //Defaults
         gen.writeDSCComment(DSCConstants.BEGIN_DEFAULTS);
         gen.writeDSCComment(DSCConstants.END_DEFAULTS);
-        
+
         //Prolog
         gen.writeDSCComment(DSCConstants.BEGIN_PROLOG);
         gen.writeDSCComment(DSCConstants.END_PROLOG);
-        
+
         //Setup
         gen.writeDSCComment(DSCConstants.BEGIN_SETUP);
         PSProcSets.writeFOPStdProcSet(gen);
@@ -379,9 +381,9 @@ public class PSRenderer extends AbstractRenderer {
     public void renderPage(PageViewport page)
             throws IOException, FOPException {
         getLogger().debug("renderPage(): " + page);
-        
+
         this.currentPageNumber++;
-        gen.writeDSCComment(DSCConstants.PAGE, new Object[] 
+        gen.writeDSCComment(DSCConstants.PAGE, new Object[]
                 {page.getPageNumber(),
                  new Integer(this.currentPageNumber)});
         final Integer zero = new Integer(0);
@@ -416,22 +418,22 @@ public class PSRenderer extends AbstractRenderer {
                      new Double(pspageheight)});
             if (this.autoRotateLandscape) {
                 gen.writeDSCComment(DSCConstants.PAGE_ORIENTATION, "Portrait");
-            }                
+            }
         }
-        gen.writeDSCComment(DSCConstants.BEGIN_PAGE_SETUP);         
+        gen.writeDSCComment(DSCConstants.BEGIN_PAGE_SETUP);
         if (rotate) {
             gen.writeln(Math.round(pspageheight) + " 0 translate");
             gen.writeln("90 rotate");
         }
         gen.writeln("0.001 0.001 scale");
         concatMatrix(1, 0, 0, -1, 0, pageheight);
-        
-        gen.writeDSCComment(DSCConstants.END_PAGE_SETUP);         
-        
+
+        gen.writeDSCComment(DSCConstants.END_PAGE_SETUP);
+
         //Process page
         super.renderPage(page);
-        
-        writeln("showpage");        
+
+        writeln("showpage");
         gen.writeDSCComment(DSCConstants.PAGE_TRAILER);
         gen.writeDSCComment(DSCConstants.END_PAGE);
     }
@@ -446,7 +448,7 @@ public class PSRenderer extends AbstractRenderer {
     protected void paintText(int rx, int bl, String text, Font font) {
         saveGraphicsState();
         writeln("1 0 0 -1 " + rx + " " + bl + " Tm");
-        
+
         int initialSize = text.length();
         initialSize += initialSize / 2;
         StringBuffer sb = new StringBuffer(initialSize);
@@ -470,19 +472,19 @@ public class PSRenderer extends AbstractRenderer {
 
         // This assumes that *all* CIDFonts use a /ToUnicode mapping
         Font f = (Font)fontInfo.getFonts().get(fontname);
-        
+
         //Determine position
         int rx = currentBlockIPPosition;
         int bl = currentBPPosition + area.getOffset();
 
         useFont(fontname, fontsize);
-        
+
         paintText(rx, bl, area.getWord(), f);
 
 /*
         String psString = null;
         if (area.getFontState().getLetterSpacing() > 0) {
-            //float f = area.getFontState().getLetterSpacing() 
+            //float f = area.getFontState().getLetterSpacing()
             //    * 1000 / this.currentFontSize;
             float f = area.getFontState().getLetterSpacing();
             psString = (new StringBuffer().append(f).append(" 0.0 (")
@@ -620,7 +622,7 @@ public class PSRenderer extends AbstractRenderer {
         }
         currentFontName = saveFontName;
     }
-    
+
     /**
      * @see org.apache.fop.render.AbstractRenderer#startVParea(CTM)
      */
@@ -628,15 +630,15 @@ public class PSRenderer extends AbstractRenderer {
         // Set the given CTM in the graphics state
         //currentState.push();
         //currentState.setTransform(new AffineTransform(CTMHelper.toPDFArray(ctm)));
-        
+
         saveGraphicsState();
         // multiply with current CTM
         //writeln(CTMHelper.toPDFString(ctm) + " cm\n");
         final double[] matrix = ctm.toArray();
         concatMatrix(matrix);
-        
+
         // Set clip?
-        beginTextObject();        
+        beginTextObject();
     }
 
     /**
@@ -695,7 +697,7 @@ public class PSRenderer extends AbstractRenderer {
      * @param height the height of the area
      */
     protected void drawBackAndBorders(Area block,
-                                    float startx, float starty, 
+                                    float startx, float starty,
                                     float width, float height) {
         // draw background then border
 
@@ -821,10 +823,10 @@ public class PSRenderer extends AbstractRenderer {
         writeln(startx + " " + starty + " M ");
         writeln(endx + " " + endy + " lineto");
     }
-    
+
     private void updateColor(ColorType col, boolean fill, StringBuffer pdf) {
-        writeln(gen.formatDouble(col.getRed()) + " " 
-                        + gen.formatDouble(col.getGreen()) + " " 
+        writeln(gen.formatDouble(col.getRed()) + " "
+                        + gen.formatDouble(col.getGreen()) + " "
                         + gen.formatDouble(col.getBlue()) + " setrgbcolor");
     }
 
@@ -832,7 +834,7 @@ public class PSRenderer extends AbstractRenderer {
      * @see org.apache.fop.render.AbstractRenderer#renderForeignObject(ForeignObject, Rectangle2D)
      */
     public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
-        Document doc = fo.getDocument();
+        org.w3c.dom.Document doc = fo.getDocument();
         String ns = fo.getNameSpace();
         renderDocument(doc, ns, pos);
     }
@@ -843,7 +845,7 @@ public class PSRenderer extends AbstractRenderer {
      * @param ns Namespace for the XML document
      * @param pos Position for the generated graphic/image
      */
-    public void renderDocument(Document doc, String ns, Rectangle2D pos) {
+    public void renderDocument(org.w3c.dom.Document doc, String ns, Rectangle2D pos) {
         RendererContext context;
         context = new RendererContext(MIME_TYPE);
         context.setUserAgent(userAgent);
@@ -859,13 +861,13 @@ public class PSRenderer extends AbstractRenderer {
         context.setProperty(PSXMLHandler.PS_YPOS,
                             new Integer(currentBPPosition + (int) pos.getY()));
         //context.setProperty("strokeSVGText", options.get("strokeSVGText"));
-        
+
         /*
         context.setProperty(PDFXMLHandler.PDF_DOCUMENT, pdfDoc);
         context.setProperty(PDFXMLHandler.OUTPUT_STREAM, ostream);
         context.setProperty(PDFXMLHandler.PDF_STATE, currentState);
         context.setProperty(PDFXMLHandler.PDF_PAGE, currentPage);
-        context.setProperty(PDFXMLHandler.PDF_CONTEXT, 
+        context.setProperty(PDFXMLHandler.PDF_CONTEXT,
                     currentContext == null ? currentPage: currentContext);
         context.setProperty(PDFXMLHandler.PDF_CONTEXT, currentContext);
         context.setProperty(PDFXMLHandler.PDF_STREAM, currentStream);
@@ -881,12 +883,12 @@ public class PSRenderer extends AbstractRenderer {
                             new Integer((int) pos.getWidth()));
         context.setProperty(PDFXMLHandler.PDF_HEIGHT,
                             new Integer((int) pos.getHeight()));
-        */           
+        */
         userAgent.renderXML(context, doc, ns);
 
     }
 
-    
+
 
 
 }
index e7bc31fe8c9ebc677e14ef66553bceba1bc74c73..d2db5233a07bfab2e8734b525b4beb21aeb60ee9 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.ps;
 
 //import org.apache.batik.gvt.TextNode;
@@ -56,7 +56,7 @@ import org.apache.batik.bridge.BridgeContext;
 //import org.apache.batik.bridge.TextUtilities;
 import org.apache.batik.gvt.GraphicsNode;
 
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -70,14 +70,14 @@ import org.w3c.dom.Node;
  * @version $Id: PSTextElementBridge.java,v 1.2 2003/03/07 09:46:30 jeremias Exp $
  */
 public class PSTextElementBridge extends SVGTextElementBridge {
-    
+
     //private PSTextPainter textPainter;
 
     /**
      * Constructs a new bridge for the &lt;text> element.
      * @param fi the font infomration
      */
-    public PSTextElementBridge(FontInfo fi) {
+    public PSTextElementBridge(Document fi) {
         //textPainter = new PSTextPainter(fi);
     }
 
@@ -127,7 +127,7 @@ public class PSTextElementBridge extends SVGTextElementBridge {
         }
         */
 
-        
+
         for (Node n = element.getFirstChild();
                 n != null;
                 n = n.getNextSibling()) {
index d24bedb0ab0aeed99f1c765187bf46e66c29c52d..f357fa28357f2efc953744f3f2a7513cc24176b3 100644 (file)
@@ -74,7 +74,7 @@ import org.apache.batik.gvt.renderer.StrokingTextPainter;
 
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.layout.FontState;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 /**
  * Renders the attributed character iterator of a <tt>TextNode</tt>.
@@ -91,7 +91,7 @@ import org.apache.fop.layout.FontInfo;
  * @version $Id: PSTextPainter.java,v 1.15 2003/01/08 14:03:55 jeremias Exp $
  */
 public class PSTextPainter implements TextPainter {
-    private FontInfo fontInfo;
+    private Document fontInfo;
 
     /**
      * Use the stroking text painter to get the bounds and shape.
@@ -104,7 +104,7 @@ public class PSTextPainter implements TextPainter {
      * Create a new PS text painter with the given font information.
      * @param fi the fint info
      */
-    public PSTextPainter(FontInfo fi) {
+    public PSTextPainter(Document fi) {
         fontInfo = fi;
     }
 
@@ -186,11 +186,11 @@ public class PSTextPainter implements TextPainter {
         String style = ((posture != null) && (posture.floatValue() > 0.0))
                        ? "italic" : "normal";
         int weight = ((taWeight != null)
-                       &&  (taWeight.floatValue() > 1.0)) ? FontInfo.BOLD
-                       : FontInfo.NORMAL;
+                       &&  (taWeight.floatValue() > 1.0)) ? Document.BOLD
+                       : Document.NORMAL;
 
         FontState fontState = null;
-        FontInfo fi = fontInfo;
+        Document fi = fontInfo;
         boolean found = false;
         String fontFamily = null;
         if (gvtFonts != null) {
@@ -215,7 +215,7 @@ public class PSTextPainter implements TextPainter {
         }
         if (!found) {
             String fname =
-              fontInfo.fontLookup("any", style, FontInfo.NORMAL);
+              fontInfo.fontLookup("any", style, Document.NORMAL);
             FontMetrics metrics = fontInfo.getMetricsFor(fname);
             int fsize = (int)(size.floatValue() * 1000);
             fontState = new FontState(fname, metrics, fsize);
@@ -225,7 +225,7 @@ public class PSTextPainter implements TextPainter {
             }
         }
         int fStyle = Font.PLAIN;
-        if (weight == FontInfo.BOLD) {
+        if (weight == Document.BOLD) {
             if (style.equals("italic")) {
                 fStyle = Font.BOLD | Font.ITALIC;
             } else {
index ff23dc6eb56ebb8e096b26cd63aabd4756636e35..d5be860d3c0b4f74bcc2e47721624acd42625ca9 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.ps;
 
 
@@ -160,7 +160,7 @@ public class PSTranscoder extends AbstractFOPTranscoder {
         //AffineTransform currentTransform = new AffineTransform(1, 0, 0, 1, 0, 0);
         //pdfAElementBridge.setCurrentTransform(currentTransform);
         //ctx.putBridge(pdfAElementBridge);
-        
+
         //ctx.putBridge(new PSImageElementBridge());
         GraphicsNode gvtRoot;
         try {
@@ -245,13 +245,13 @@ public class PSTranscoder extends AbstractFOPTranscoder {
         try {
             graphics.setupDocument(output.getOutputStream(), w, h);
             graphics.setSVGDimension(docWidth, docHeight);
-    
+
             if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) {
                 graphics.setBackgroundColor((Color)hints.get(ImageTranscoder.KEY_BACKGROUND_COLOR));
             }
             graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
             graphics.setTransform(px);
-    
+
             gvtRoot.paint(graphics);
 
             graphics.finish();
index 3b4ddcdd15d423e0884caf10d1c7f33e43787580..524d05cfacbb4ae81c23956077905b58a970430e 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.ps;
 
 // Java
@@ -55,7 +55,8 @@ import java.awt.geom.AffineTransform;
 import java.io.IOException;
 
 // DOM
-import org.w3c.dom.Document;
+/* org.w3c.dom.Document is not imported to avoid conflict with
+   org.apache.fop.control.Document */
 import org.w3c.dom.svg.SVGDocument;
 import org.w3c.dom.svg.SVGSVGElement;
 
@@ -67,10 +68,10 @@ import org.apache.batik.gvt.GraphicsNode;
 import org.apache.batik.gvt.TextPainter;
 
 // FOP
+import org.apache.fop.control.Document;
 import org.apache.fop.render.XMLHandler;
 import org.apache.fop.render.RendererContext;
 import org.apache.fop.svg.SVGUserAgent;
-import org.apache.fop.layout.FontInfo;
 
 /**
  * PostScript XML handler.
@@ -128,7 +129,7 @@ public class PSXMLHandler implements XMLHandler {
      * @param ns the namespace of the XML document
      * @throws Exception any sort of exception could be thrown and shuld be handled
      */
-    public void handleXML(RendererContext context, Document doc,
+    public void handleXML(RendererContext context, org.w3c.dom.Document doc,
                           String ns) throws Exception {
         PSInfo psi = getPSInfo(context);
 
@@ -149,7 +150,7 @@ public class PSXMLHandler implements XMLHandler {
     public static PSInfo getPSInfo(RendererContext context) {
         PSInfo psi = new PSInfo();
         psi.psGenerator = (PSGenerator)context.getProperty(PS_GENERATOR);
-        psi.fontInfo = (FontInfo)context.getProperty(PS_FONT_INFO);
+        psi.fontInfo = (org.apache.fop.control.Document)context.getProperty(PS_FONT_INFO);
         psi.width = ((Integer)context.getProperty(PS_WIDTH)).intValue();
         psi.height = ((Integer)context.getProperty(PS_HEIGHT)).intValue();
         psi.currentXPosition = ((Integer)context.getProperty(PS_XPOS)).intValue();
@@ -161,11 +162,11 @@ public class PSXMLHandler implements XMLHandler {
      * PostScript information structure for drawing the XML document.
      */
     public static class PSInfo {
-        
+
         /** see PS_GENERATOR */
         private PSGenerator psGenerator;
         /** see PS_FONT_INFO */
-        private FontInfo fontInfo;
+        private org.apache.fop.control.Document fontInfo;
         /** see PS_PAGE_WIDTH */
         private int width;
         /** see PS_PAGE_HEIGHT */
@@ -194,7 +195,7 @@ public class PSXMLHandler implements XMLHandler {
          * Returns the fontInfo.
          * @return FontInfo
          */
-        public FontInfo getFontInfo() {
+        public org.apache.fop.control.Document getFontInfo() {
             return fontInfo;
         }
 
@@ -202,7 +203,7 @@ public class PSXMLHandler implements XMLHandler {
          * Sets the fontInfo.
          * @param fontInfo The fontInfo to set
          */
-        public void setFontInfo(FontInfo fontInfo) {
+        public void setFontInfo(org.apache.fop.control.Document fontInfo) {
             this.fontInfo = fontInfo;
         }
 
@@ -283,7 +284,8 @@ public class PSXMLHandler implements XMLHandler {
          * @param doc the svg document
          * @param psInfo the pdf information of the current context
          */
-        protected void renderSVGDocument(RendererContext context, Document doc, PSInfo psInfo) {
+        protected void renderSVGDocument(RendererContext context,
+                org.w3c.dom.Document doc, PSInfo psInfo) {
             int xOffset = psInfo.currentXPosition;
             int yOffset = psInfo.currentYPosition;
             PSGenerator gen = psInfo.psGenerator;
@@ -303,9 +305,9 @@ public class PSXMLHandler implements XMLHandler {
             transform.translate(xOffset / 1000f, yOffset / 1000f);
             //aBridge.setCurrentTransform(transform);
             //ctx.putBridge(aBridge);
-          
+
             TextPainter textPainter = new PSTextPainter(psInfo.getFontInfo());
-            ctx.setTextPainter(textPainter);            
+            ctx.setTextPainter(textPainter);
             GraphicsNode root;
             try {
                 root = builder.build(ctx, doc);
@@ -336,16 +338,16 @@ public class PSXMLHandler implements XMLHandler {
                 // and positive is down and to the right. (0,0) is where the
                 // viewBox puts it.
                 gen.concatMatrix(sx, 0, 0, sy, xOffset, yOffset);
-                
+
                 SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
-                AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, 
+                AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg,
                                     w / 1000f, h / 1000f);
                 if (!at.isIdentity()) {
                     double[] vals = new double[6];
                     at.getMatrix(vals);
                     gen.concatMatrix(vals);
                 }
-                
+
                 /*
                 if (psInfo.pdfContext == null) {
                     psInfo.pdfContext = psInfo.pdfPage;
@@ -365,7 +367,7 @@ public class PSXMLHandler implements XMLHandler {
                     context.getUserAgent().getLogger().error("SVG graphic could not be rendered: "
                                            + e.getMessage(), e);
                 }
-                
+
                 psInfo.psGenerator.restoreGraphicsState();
                 //psInfo.pdfState.pop();
                 gen.writeln("%SVG graphic end ---");
index 9936087c5bd742f1fe98653f14fb62b62b157e81..4007821f2cb404dbffeeffbd117012f4f5c3cc3f 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.svg;
 
 import org.apache.fop.apps.FOPException;
@@ -57,14 +57,15 @@ import org.apache.fop.area.inline.ForeignObject;
 import org.apache.fop.area.inline.Leader;
 import org.apache.fop.area.inline.Word;
 import org.apache.fop.svg.SVGUtilities;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.fo.FOUserAgent;
 import org.apache.fop.fo.properties.RuleStyle;
 
 import org.w3c.dom.Node;
 import org.w3c.dom.svg.SVGSVGElement;
 import org.w3c.dom.svg.SVGDocument;
-import org.w3c.dom.Document;
+/* org.w3c.dom.Document is not imported to avoid conflict with
+   org.apache.fop.control.Document */
 import org.w3c.dom.Element;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Text;
@@ -93,14 +94,14 @@ import org.apache.fop.render.RendererContext;
  * This is the SVG renderer.
  */
 public class SVGRenderer extends AbstractRenderer implements XMLHandler {
-    
+
     /** SVG MIME type */
     public static final String SVG_MIME_TYPE = "image/svg+xml";
-    
+
     /** SVG namespace */
     public static final String SVG_NAMESPACE = SVGDOMImplementation.SVG_NAMESPACE_URI;
-    
-    private Document svgDocument;
+
+    private org.w3c.dom.Document svgDocument;
     private Element svgRoot;
     private Element currentPageG = null;
     private Element lastLink = null;
@@ -166,7 +167,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
     /**
      * @see org.apache.fop.render.Renderer#setupFontInfo(FontInfo)
      */
-    public void setupFontInfo(FontInfo fontInfo) {
+    public void setupFontInfo(Document fontInfo) {
         // create a temp Image to test font metrics on
         BufferedImage fontImage =
           new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
@@ -185,7 +186,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
         svgRoot = svgDocument.getDocumentElement();
         /*
         ProcessingInstruction pi =
-            svgDocument.createProcessingInstruction("xml", 
+            svgDocument.createProcessingInstruction("xml",
                         " version=\"1.0\" encoding=\"ISO-8859-1\"");
         svgDocument.insertBefore(pi, svgRoot);
         */
@@ -269,7 +270,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
 
         // if there is a link from the last page
         if (lastLink != null) {
-            lastLink.setAttributeNS(null, "xlink:href", "#svgView(viewBox(" 
+            lastLink.setAttributeNS(null, "xlink:href", "#svgView(viewBox("
                                     + totalWidth + ", "
                                     + sequenceHeight + ", "
                                     + pageWidth + ", "
@@ -313,10 +314,10 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
             lastPageLink.setAttributeNS(null, "xlink:href", lastViewbox);
         } else {
             lastPageLink.setAttributeNS(null, "xlink:href",
-                    "#svgView(viewBox(" 
+                    "#svgView(viewBox("
                         + totalWidth + ", "
-                        + (sequenceHeight - pageHeight) + ", " 
-                        + pageWidth + ", " 
+                        + (sequenceHeight - pageHeight) + ", "
+                        + pageWidth + ", "
                         + pageHeight + "))");
         }
         pagesGroup.appendChild(lastPageLink);
@@ -335,10 +336,10 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
         rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden");
         lastLink.appendChild(rect);
 
-        lastViewbox = "#svgView(viewBox(" 
-                    + totalWidth + ", " 
-                    + (sequenceHeight - pageHeight) + ", " 
-                    + pageWidth + ", " 
+        lastViewbox = "#svgView(viewBox("
+                    + totalWidth + ", "
+                    + (sequenceHeight - pageHeight) + ", "
+                    + pageWidth + ", "
                     + pageHeight + "))";
 
         pageNumber++;
@@ -350,7 +351,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
      * @param fo the foreign object
      */
     public void renderForeignObject(ForeignObject fo) {
-        Document doc = fo.getDocument();
+        org.w3c.dom.Document doc = fo.getDocument();
         String ns = fo.getNameSpace();
         userAgent.renderXML(context, doc, ns);
     }
@@ -358,7 +359,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
     /**
      * @see org.apache.fop.render.XMLHandler#handleXML(RendererContext, Document, String)
      */
-    public void handleXML(RendererContext context, Document doc,
+    public void handleXML(RendererContext context, org.w3c.dom.Document doc,
                           String ns) throws Exception {
         if (SVG_NAMESPACE.equals(ns)) {
             if (!(doc instanceof SVGDocument)) {
index 238dda6c11d5649e8e22adfea98797fb8e628411..f6d37d587879f692eeaa9a95787ef2a6c4e71dd8 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.render.xml;
 
 // Java
@@ -60,14 +60,15 @@ import java.util.Iterator;
 import java.awt.geom.Rectangle2D;
 
 // XML
-import org.w3c.dom.Document;
+/* org.w3c.dom.Document is not imported to avoid conflict with
+   org.apache.fop.control.Document */
 
 // FOP
 import org.apache.fop.render.AbstractRenderer;
 import org.apache.fop.render.RendererContext;
 import org.apache.fop.render.XMLHandler;
 import org.apache.fop.fo.FOUserAgent;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.area.BeforeFloat;
 import org.apache.fop.area.Block;
@@ -101,7 +102,7 @@ import org.apache.fop.fo.properties.RuleStyle;
  * which can be rendered to any renderer.
  */
 public class XMLRenderer extends AbstractRenderer {
-    
+
     /** XML MIME type */
     public static final String XML_MIME_TYPE = "text/xml";
 
@@ -207,7 +208,7 @@ public class XMLRenderer extends AbstractRenderer {
      *
      * @param fontInfo the font info object to set up
      */
-    public void setupFontInfo(FontInfo fontInfo) {
+    public void setupFontInfo(Document fontInfo) {
 
         /* use PDF's font setup to get PDF metrics */
         org.apache.fop.render.pdf.FontSetup.setup(fontInfo, null);
@@ -423,7 +424,7 @@ public class XMLRenderer extends AbstractRenderer {
      */
     public void renderForeignObject(ForeignObject fo) {
         writeStartTag("<foreignObject>");
-        Document doc = fo.getDocument();
+        org.w3c.dom.Document doc = fo.getDocument();
         String ns = fo.getNameSpace();
         context.setProperty(XMLXMLHandler.WRITER, writer);
         userAgent.renderXML(context, doc, ns);
@@ -501,9 +502,9 @@ public class XMLRenderer extends AbstractRenderer {
                 style = "ridge";
                 break;
         }
-        writeElement("<leader width=\"" + area.getWidth() 
+        writeElement("<leader width=\"" + area.getWidth()
                         + "\" ruleStyle=\"" + style
-                        + "\" ruleThickness=\"" + area.getRuleThickness() 
+                        + "\" ruleThickness=\"" + area.getRuleThickness()
                         + "\"/>");
         super.renderLeader(area);
     }
index f952eb4dcf81482c38363a609db2b4a3d2299dde..0d9933973bb2d184805f7d6fd3e92008ec531d73 100644 (file)
@@ -72,7 +72,7 @@ import org.apache.fop.fo.flow.TableRow;
 import org.apache.fop.fo.pagination.Flow;
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fo.properties.Constants;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.rtf.rtflib.rtfdoc.RtfAttributes;
 import org.apache.fop.rtf.rtflib.rtfdoc.RtfColorTable;
 import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea;
@@ -90,7 +90,7 @@ import org.xml.sax.SAXException;
  */
 public class RTFHandler extends FOInputHandler {
 
-    private FontInfo fontInfo = new FontInfo();
+    private Document fontInfo = new Document();
     private RtfFile rtfFile;
     private final OutputStream os;
     private RtfSection sect;
@@ -122,7 +122,7 @@ public class RTFHandler extends FOInputHandler {
     /**
      * @see org.apache.fop.fo.FOInputHandler#getFontInfo()
      */
-    public FontInfo getFontInfo() {
+    public Document getFontInfo() {
         return this.fontInfo;
     }
 
index 58d33264d01090eb253e5d28db9f7792f70e131f..458c58e0346d137c5a93a4bfea5f1a8f12b03d29 100644 (file)
@@ -69,7 +69,7 @@ import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.logger.ConsoleLogger;
 import org.apache.avalon.framework.logger.LogEnabled;
 import org.apache.avalon.framework.logger.Logger;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 import java.awt.Graphics;
 import java.awt.Font;
@@ -119,7 +119,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D
         super(textAsShapes);
 
         if (!textAsShapes) {
-            fontInfo = new FontInfo();
+            fontInfo = new Document();
             FontSetup.setup(fontInfo, null);
             //FontState fontState = new FontState("Helvetica", "normal",
             //                          FontInfo.NORMAL, 12, 0);
@@ -195,7 +195,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D
      */
     public void initialize() throws Exception {
         if (this.fontInfo == null) {
-            fontInfo = new FontInfo();
+            fontInfo = new Document();
             FontSetup.setup(fontInfo, this.fontList);
             //FontState fontState = new FontState("Helvetica", "normal",
             //                          FontInfo.NORMAL, 12, 0);
@@ -244,7 +244,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D
      * Get the font info for this pdf document.
      * @return the font information
      */
-    public FontInfo getFontInfo() {
+    public Document getFontInfo() {
         return fontInfo;
     }
 
index 915a364bcc3a8fade266df31de9e1da9676f6d1a..94329d619185de019ba6cacb691d410e8e1680b1 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.svg;
 
 import org.apache.fop.pdf.PDFResourceContext;
@@ -64,7 +64,7 @@ import org.apache.fop.pdf.PDFDocument;
 import org.apache.fop.pdf.PDFLink;
 import org.apache.fop.pdf.PDFAnnotList;
 import org.apache.fop.pdf.BitmapImage;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.layout.FontState;
 import org.apache.fop.render.pdf.FontSetup;
 import org.apache.fop.fonts.FontMetrics;
@@ -153,7 +153,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
     /**
      * The current font information.
      */
-    protected FontInfo fontInfo;
+    protected Document fontInfo;
 
     /**
      * The override font state used when drawing text and the font cannot be
@@ -197,7 +197,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
      * @param font the current font name
      * @param size the current font size
      */
-    public PDFGraphics2D(boolean textAsShapes, FontInfo fi, PDFDocument doc,
+    public PDFGraphics2D(boolean textAsShapes, Document fi, PDFDocument doc,
                          PDFResourceContext page, String pref, String font, float size) {
         super(textAsShapes);
         pdfDoc = doc;
@@ -315,7 +315,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
         b = trans.createTransformedShape(b);
         if (b != null) {
             Rectangle rect = b.getBounds();
-    
+
             if (linkType != PDFLink.EXTERNAL) {
                 String pdfdest = "/FitR " + dest;
                 resourceContext.addAnnotation(
@@ -982,7 +982,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
     private void createPattern(PatternPaint pp, boolean fill) {
         Rectangle2D rect = pp.getPatternRect();
 
-        FontInfo fi = new FontInfo();
+        Document fi = new Document();
         FontSetup.setup(fi, null);
 
         PDFResources res = pdfDoc.getFactory().makeResources();
@@ -1207,7 +1207,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
             }
             int siz = gFont.getSize();
             String style = gFont.isItalic() ? "italic" : "normal";
-            int weight = gFont.isBold() ? FontInfo.BOLD : FontInfo.NORMAL;
+            int weight = gFont.isBold() ? Document.BOLD : Document.NORMAL;
             String fname = fontInfo.fontLookup(n, style, weight);
             FontMetrics metrics = fontInfo.getMetricsFor(fname);
             fontState = new FontState(fname, metrics, siz * 1000);
index 664324a2b229b6e99618694efacb4037e361c0b3..1f7eaaa5d10e91cdb0ec14168428cef055c69656 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.svg;
 
 import org.apache.batik.gvt.TextNode;
@@ -56,7 +56,7 @@ import org.apache.batik.bridge.BridgeContext;
 import org.apache.batik.bridge.TextUtilities;
 import org.apache.batik.gvt.GraphicsNode;
 
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -75,7 +75,7 @@ public class PDFTextElementBridge extends SVGTextElementBridge {
      * Constructs a new bridge for the &lt;text> element.
      * @param fi the font infomration
      */
-    public PDFTextElementBridge(FontInfo fi) {
+    public PDFTextElementBridge(Document fi) {
         pdfTextPainter = new PDFTextPainter(fi);
     }
 
index 2c01034b36cbad22de578b738fbba2e9bc00a829..a3645d2e30d5efd181b8c7060223d2b3995ff29e 100644 (file)
@@ -74,7 +74,7 @@ import org.apache.batik.gvt.renderer.StrokingTextPainter;
 
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.layout.FontState;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 
 /**
  * Renders the attributed character iterator of a <tt>TextNode</tt>.
@@ -91,7 +91,7 @@ import org.apache.fop.layout.FontInfo;
  * @version $Id: PDFTextPainter.java,v 1.16 2003/03/07 09:51:25 jeremias Exp $
  */
 public class PDFTextPainter implements TextPainter {
-    private FontInfo fontInfo;
+    private Document fontInfo;
 
     /**
      * Use the stroking text painter to get the bounds and shape.
@@ -104,7 +104,7 @@ public class PDFTextPainter implements TextPainter {
      * Create a new PDF text painter with the given font information.
      * @param fi the fint info
      */
-    public PDFTextPainter(FontInfo fi) {
+    public PDFTextPainter(Document fi) {
         fontInfo = fi;
     }
 
@@ -186,11 +186,11 @@ public class PDFTextPainter implements TextPainter {
         String style = ((posture != null) && (posture.floatValue() > 0.0))
                        ? "italic" : "normal";
         int weight = ((taWeight != null)
-                       &&  (taWeight.floatValue() > 1.0)) ? FontInfo.BOLD
-                       : FontInfo.NORMAL;
+                       &&  (taWeight.floatValue() > 1.0)) ? Document.BOLD
+                       : Document.NORMAL;
 
         FontState fontState = null;
-        FontInfo fi = fontInfo;
+        Document fi = fontInfo;
         boolean found = false;
         String fontFamily = null;
         if (gvtFonts != null) {
@@ -215,7 +215,7 @@ public class PDFTextPainter implements TextPainter {
         }
         if (!found) {
             String fname =
-              fontInfo.fontLookup("any", style, FontInfo.NORMAL);
+              fontInfo.fontLookup("any", style, Document.NORMAL);
             FontMetrics metrics = fontInfo.getMetricsFor(fname);
             int fsize = (int)(size.floatValue() * 1000);
             fontState = new FontState(fname, metrics, fsize);
@@ -225,7 +225,7 @@ public class PDFTextPainter implements TextPainter {
             }
         }
         int fStyle = Font.PLAIN;
-        if (weight == FontInfo.BOLD) {
+        if (weight == Document.BOLD) {
             if (style.equals("italic")) {
                 fStyle = Font.BOLD | Font.ITALIC;
             } else {
index 8ccc05a45a8ff56a5d4162e7ff8eb66b05a3a671..6b69c659be832081fc3ed0b84e2bc3d92b686a58 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.svg;
 
 import java.awt.Color;
@@ -104,7 +104,7 @@ import org.w3c.dom.svg.SVGSVGElement;
  * @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
  * @version $Id: PDFTranscoder.java,v 1.24 2003/03/07 09:51:26 jeremias Exp $
  */
-public class PDFTranscoder extends AbstractFOPTranscoder 
+public class PDFTranscoder extends AbstractFOPTranscoder
         implements Configurable {
 
     private Configuration cfg;
@@ -115,7 +115,7 @@ public class PDFTranscoder extends AbstractFOPTranscoder
     public PDFTranscoder() {
         super();
         this.handler = new FOPErrorHandler();
-        
+
     }
 
     /**
index c2f463dfa62ab8bde192dd636d01681dc800e966..5f06e5bf033e720e7821002fdfa6168430a981b6 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    The Apache Software License, Version 1.1
  * ============================================================================
- * 
+ *
  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without modifica-
  * tion, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 
+ *
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * 3. The end-user documentation included with the redistribution, if any, must
  *    include the following acknowledgment: "This product includes software
  *    developed by the Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself, if
  *    and wherever such third-party acknowledgments normally appear.
- * 
+ *
  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  *    endorse or promote products derived from this software without prior
  *    written permission. For written permission, please contact
  *    apache@apache.org.
- * 
+ *
  * 5. Products derived from this software may not be called "Apache", nor may
  *    "Apache" appear in their name, without prior written permission of the
  *    Apache Software Foundation.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * ============================================================================
- * 
+ *
  * This software consists of voluntary contributions made by many individuals
  * on behalf of the Apache Software Foundation and was originally created by
  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  * Software Foundation, please see <http://www.apache.org/>.
- */ 
+ */
 package org.apache.fop.tools;
 
 // Java
@@ -65,7 +65,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Element;
-import org.w3c.dom.Document;
+/* org.w3c.dom.Document is not imported to avoid conflict with
+   org.apache.fop.control.Document */
 
 // Batik
 import org.apache.batik.dom.svg.SVGDOMImplementation;
@@ -99,7 +100,7 @@ import org.apache.fop.area.inline.Leader;
 import org.apache.fop.area.inline.Space;
 import org.apache.fop.area.inline.Viewport;
 import org.apache.fop.area.inline.Word;
-import org.apache.fop.layout.FontInfo;
+import org.apache.fop.control.Document;
 import org.apache.fop.layout.FontState;
 import org.apache.fop.render.Renderer;
 import org.apache.fop.render.pdf.PDFRenderer;
@@ -168,7 +169,7 @@ public class AreaTreeBuilder extends AbstractLogEnabled {
             rend = new SVGRenderer();
         }
         setupLogger(rend);
-        FontInfo fi = new FontInfo();
+        Document fi = new Document();
         rend.setupFontInfo(fi);
         FOUserAgent ua = new FOUserAgent();
         setupLogger(ua);
@@ -247,10 +248,10 @@ public class AreaTreeBuilder extends AbstractLogEnabled {
 class TreeLoader extends AbstractLogEnabled {
     private AreaTree areaTree;
     private AreaTreeModel model;
-    private FontInfo fontInfo;
+    private Document fontInfo;
     private FontState currentFontState;
 
-    TreeLoader(FontInfo fi) {
+    TreeLoader(Document fi) {
         fontInfo = fi;
     }
 
@@ -259,7 +260,7 @@ class TreeLoader extends AbstractLogEnabled {
     }
 
     public void buildAreaTree(InputStream is) {
-        Document doc = null;
+        org.w3c.dom.Document doc = null;
         try {
             DocumentBuilderFactory fact =
               DocumentBuilderFactory.newInstance();
@@ -558,7 +559,7 @@ class TreeLoader extends AbstractLogEnabled {
                 Character ch =
                   new Character(getString((Element) obj).charAt(0));
                 addTraits((Element) obj, ch);
-                String fname = fontInfo.fontLookup("sans-serif", "normal", FontInfo.NORMAL);
+                String fname = fontInfo.fontLookup("sans-serif", "normal", Document.NORMAL);
                 FontMetrics metrics = fontInfo.getMetricsFor(fname);
                 currentFontState =
                     new FontState(fname, metrics, 12000);
@@ -583,7 +584,7 @@ class TreeLoader extends AbstractLogEnabled {
                     list.add(leader);
                 }
             } else if (obj.getNodeName().equals("word")) {
-                String fname = fontInfo.fontLookup("sans-serif", "normal", FontInfo.NORMAL);
+                String fname = fontInfo.fontLookup("sans-serif", "normal", Document.NORMAL);
                 FontMetrics metrics = fontInfo.getMetricsFor(fname);
                 currentFontState =
                     new FontState(fname, metrics, 12000);
@@ -637,7 +638,7 @@ class TreeLoader extends AbstractLogEnabled {
     }
 
     ForeignObject getForeignObject(Element root) {
-        Document doc;
+        org.w3c.dom.Document doc;
         String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
 
         NodeList childs = root.getChildNodes();