gmazza      2004/04/22 14:38:41

  Modified:    src/java/org/apache/fop/apps Document.java Driver.java
               src/java/org/apache/fop/area AreaTree.java
                        AreaTreeControl.java
               src/java/org/apache/fop/fo FONode.java FOTreeControl.java
                        PropertyManager.java
               src/java/org/apache/fop/fonts FontSetup.java
               src/java/org/apache/fop/pdf PDFFactory.java
                        PDFResources.java
               src/java/org/apache/fop/render AbstractRenderer.java
                        PrintRenderer.java Renderer.java
               src/java/org/apache/fop/render/awt AWTRenderer.java
                        FontSetup.java
               src/java/org/apache/fop/render/mif MIFHandler.java
               src/java/org/apache/fop/render/pdf PDFRenderer.java
                        PDFXMLHandler.java
               src/java/org/apache/fop/render/ps
                        AbstractPSDocumentGraphics2D.java
                        EPSDocumentGraphics2D.java
                        PSDocumentGraphics2D.java PSGraphics2D.java
                        PSProcSets.java PSRenderer.java PSTextPainter.java
               src/java/org/apache/fop/render/rtf RTFHandler.java
               src/java/org/apache/fop/render/svg SVGRenderer.java
               src/java/org/apache/fop/render/xml XMLRenderer.java
               src/java/org/apache/fop/svg PDFDocumentGraphics2D.java
                        PDFGraphics2D.java PDFTextElementBridge.java
                        PDFTextPainter.java
               src/java/org/apache/fop/tools AreaTreeBuilder.java
  Log:
  Patch #28525 applied -- new FontInfo class.
  
  Revision  Changes    Path
  1.13      +14 -205   xml-fop/src/java/org/apache/fop/apps/Document.java
  
  Index: Document.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Document.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Document.java     31 Mar 2004 10:55:05 -0000      1.12
  +++ Document.java     22 Apr 2004 21:38:39 -0000      1.13
  @@ -38,34 +38,27 @@
   import org.apache.fop.fo.FOTreeEvent;
   import org.apache.fop.fo.FOTreeListener;
   import org.apache.fop.fo.pagination.PageSequence;
  -import org.apache.fop.fonts.Font;
  -import org.apache.fop.fonts.FontMetrics;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.layout.LayoutStrategy;
   
  +import org.apache.commons.logging.Log;
  +
   // SAX
   import org.xml.sax.SAXException;
   
  -import org.apache.commons.logging.Log;
  -
   /**
    * Class storing information for the FOP Document being processed, and managing
    * the processing of it.
    */
   public class Document implements FOTreeControl, FOTreeListener,
           AreaTreeControl {
  -
  +            
       /** The parent Driver object */
       private Driver driver;
   
  -    /** 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;
  -
  +    /** The Font information relevant for this document */
  +    private FontInfo fontInfo;
  +    
       /**
        * the LayoutStrategy to be used to process this document
        * TODO: this actually belongs in the RenderContext class, when it is
  @@ -75,6 +68,7 @@
   
       /** The current AreaTree for the PageSequence being rendered. */
       public AreaTree areaTree;
  +
       /** The AreaTreeModel for the PageSequence being rendered. */
       public AreaTreeModel atModel;
   
  @@ -98,186 +92,15 @@
        */
       public Document(Driver driver) {
           this.driver = driver;
  -        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(Font.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);
  +        this.fontInfo = new FontInfo();
       }
   
       /**
  -     * 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
  +     * Retrieve the font information for this document
  +     * @return the FontInfo instance for this document
        */
  -    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(Font.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);
  +    public FontInfo getFontInfo() {
  +        return this.fontInfo;
       }
   
       /**
  @@ -370,20 +193,6 @@
        */
       public FOInputHandler getFOInputHandler() {
           return foInputHandler;
  -    }
  -
  -    /**
  -     * @return the Logger to be used for processing this Document
  -     */
  -    public Log getLogger() {
  -        return getDriver().getLogger();
  -    }
  -
  -    /**
  -     * @return the FOUserAgent used for processing this document
  -     */
  -    public FOUserAgent getUserAgent() {
  -        return getDriver().getUserAgent();
       }
   
   }
  
  
  
  1.56      +3 -3      xml-fop/src/java/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- Driver.java       31 Mar 2004 10:55:05 -0000      1.55
  +++ Driver.java       22 Apr 2004 21:38:39 -0000      1.56
  @@ -242,7 +242,7 @@
           userAgent = agent;
       }
   
  -    protected FOUserAgent getUserAgent() {
  +    public FOUserAgent getUserAgent() {
           if (userAgent == null) {
               userAgent = new FOUserAgent();
               userAgent.setLogger(getLogger());
  @@ -498,9 +498,9 @@
               //this.atModel = new CachedRenderPagesModel(renderer);
               currentDocument.areaTree.setTreeModel(currentDocument.atModel);
               try {
  -                renderer.setupFontInfo(currentDocument);
  +                renderer.setupFontInfo(currentDocument.getFontInfo());
                   // check that the "any,normal,400" font exists
  -                if (!currentDocument.isSetupValid()) {
  +                if (!currentDocument.getFontInfo().isSetupValid()) {
                       throw new FOPException(
                               "No default font defined by OutputConverter");
                   }
  
  
  
  1.9       +1 -1      xml-fop/src/java/org/apache/fop/area/AreaTree.java
  
  Index: AreaTree.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTree.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AreaTree.java     27 Feb 2004 17:41:26 -0000      1.8
  +++ AreaTree.java     22 Apr 2004 21:38:39 -0000      1.9
  @@ -222,7 +222,7 @@
           if (atControl.getBookmarks() == null) {
               return;
           }
  -        atControl.getLogger().debug("adding bookmarks to area tree");
  +        atControl.getDriver().getLogger().debug("adding bookmarks to area tree");
           BookmarkData data = new BookmarkData();
           for (int count = 0; count < atControl.getBookmarks().getOutlines().size(); 
count++) {
               Outline out = 
(Outline)(atControl.getBookmarks().getOutlines()).get(count);
  
  
  
  1.5       +4 -5      xml-fop/src/java/org/apache/fop/area/AreaTreeControl.java
  
  Index: AreaTreeControl.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTreeControl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AreaTreeControl.java      31 Mar 2004 10:55:06 -0000      1.4
  +++ AreaTreeControl.java      22 Apr 2004 21:38:39 -0000      1.5
  @@ -21,8 +21,7 @@
   
   // FOP
   import org.apache.fop.fo.extensions.Bookmarks;
  -
  -import org.apache.commons.logging.Log;
  +import org.apache.fop.apps.Driver;
   
   // Java
   import java.util.Set;
  @@ -42,9 +41,9 @@
       Bookmarks getBookmarks();
   
       /**
  -     * @return the Logger being used with this FO Tree
  +     * @return the Driver instance being used with this FO Tree
        */
  -    Log getLogger();
  +    Driver getDriver();
   
       /**
        * The current set of IDs in the document.
  
  
  
  1.17      +2 -2      xml-fop/src/java/org/apache/fop/fo/FONode.java
  
  Index: FONode.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FONode.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- FONode.java       31 Mar 2004 10:55:06 -0000      1.16
  +++ FONode.java       22 Apr 2004 21:38:39 -0000      1.17
  @@ -71,7 +71,7 @@
        * @return the logger
        */
       public Log getLogger() {
  -        return getFOTreeControl().getLogger();
  +        return getFOTreeControl().getDriver().getLogger();
       }
   
       /**
  @@ -79,7 +79,7 @@
        * @return FOUserAgent
        */
       public FOUserAgent getUserAgent() {
  -        return getFOTreeControl().getUserAgent();
  +        return getFOTreeControl().getDriver().getUserAgent();
       }
   
       /**
  
  
  
  1.11      +8 -35     xml-fop/src/java/org/apache/fop/fo/FOTreeControl.java
  
  Index: FOTreeControl.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeControl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FOTreeControl.java        31 Mar 2004 10:55:06 -0000      1.10
  +++ FOTreeControl.java        22 Apr 2004 21:38:39 -0000      1.11
  @@ -24,11 +24,10 @@
   import java.util.Set;
   
   // FOP
  -import org.apache.fop.apps.FOUserAgent;
  +import org.apache.fop.apps.Driver;
   import org.apache.fop.fo.extensions.Bookmarks;
   import org.apache.fop.fonts.FontMetrics;
  -
  -import org.apache.commons.logging.Log;
  +import org.apache.fop.fonts.FontInfo;
   
   /**
    * An interface for classes that are conceptually the parent class of the
  @@ -41,32 +40,6 @@
   public interface FOTreeControl {
   
       /**
  -     * @param family the font family
  -     * @param style the font style
  -     * @param weight the font weight
  -     * @return the String font name matching the parameters
  -     */
  -    String fontLookup(String family, String style,
  -                             int weight);
  -
  -    /**
  -     * @param fontName the String containing the font name for which a
  -     * FontMetrics object is desired
  -     * @return the FontMetrics object matching the fontName parameter
  -     */
  -    FontMetrics getMetricsFor(String fontName);
  -
  -    /**
  -     * @return true if the default font has been properly setup
  -     */
  -    boolean isSetupValid();
  -
  -    /**
  -     * @return a Map containing the Fonts used in this FO Tree
  -     */
  -    Map getFonts();
  -
  -    /**
        * Sets the Bookmark object which encapsulates the bookmarks for the FO
        * Tree.
        * @param bookmarks the Bookmark object encapsulating the bookmarks for this
  @@ -91,13 +64,13 @@
       FOInputHandler getFOInputHandler();
   
       /**
  -     * @return the Logger being used with this FO Tree
  +     * @return the Driver associated with this FO Tree
        */
  -    Log getLogger();
  -
  +    Driver getDriver();
  +    
       /**
  -     * @return the FOUserAgent used for processing this FO Tree
  +     * @return the FontInfo object associated with this FOTree
        */
  -    FOUserAgent getUserAgent();
  +    FontInfo getFontInfo();
   
   }
  
  
  
  1.25      +2 -2      xml-fop/src/java/org/apache/fop/fo/PropertyManager.java
  
  Index: PropertyManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyManager.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- PropertyManager.java      27 Feb 2004 17:57:40 -0000      1.24
  +++ PropertyManager.java      22 Apr 2004 21:38:39 -0000      1.25
  @@ -127,9 +127,9 @@
               // various kinds of keywords too
               int fontSize = propertyList.get(PR_FONT_SIZE).getLength().getValue();
               //int fontVariant = propertyList.get("font-variant").getEnum();
  -            String fname = foTreeControl.fontLookup(fontFamily, fontStyle,
  +            String fname = foTreeControl.getFontInfo().fontLookup(fontFamily, 
fontStyle,
                                                  fontWeight);
  -            FontMetrics metrics = foTreeControl.getMetricsFor(fname);
  +            FontMetrics metrics = foTreeControl.getFontInfo().getMetricsFor(fname);
               fontState = new Font(fname, metrics, fontSize);
           }
           return fontState;
  
  
  
  1.4       +7 -7      xml-fop/src/java/org/apache/fop/fonts/FontSetup.java
  
  Index: FontSetup.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fonts/FontSetup.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FontSetup.java    27 Feb 2004 17:47:14 -0000      1.3
  +++ FontSetup.java    22 Apr 2004 21:38:39 -0000      1.4
  @@ -61,7 +61,7 @@
        * @param fontInfo the font info object to set up
        * @param embedList ???
        */
  -    public static void setup(Document fontInfo, List embedList) {
  +    public static void setup(FontInfo fontInfo, List embedList) {
   
           fontInfo.addMetrics("F1", new Helvetica());
           fontInfo.addMetrics("F2", new HelveticaOblique());
  @@ -163,16 +163,16 @@
        * @param fontInfos ???
        * @param num starting index for internal font numbering
        */
  -    public static void addConfiguredFonts(Document fontInfo, List fontInfos, int 
num) {
  -        if (fontInfos == null) {
  +    public static void addConfiguredFonts(FontInfo fontInfo, List fontInfoList, int 
num) {
  +        if (fontInfoList == null) {
               return; //No fonts to process
           }
   
           String internalName = null;
           //FontReader reader = null;
   
  -        for (int i = 0; i < fontInfos.size(); i++) {
  -            EmbedFontInfo configFontInfo = (EmbedFontInfo)fontInfos.get(i);
  +        for (int i = 0; i < fontInfoList.size(); i++) {
  +            EmbedFontInfo configFontInfo = (EmbedFontInfo) fontInfoList.get(i);
   
               String metricsFile = configFontInfo.getMetricsFile();
               if (metricsFile != null) {
  @@ -191,7 +191,7 @@
   
                   List triplets = configFontInfo.getFontTriplets();
                   for (int c = 0; c < triplets.size(); c++) {
  -                    FontTriplet triplet = (FontTriplet)triplets.get(c);
  +                    FontTriplet triplet = (FontTriplet) triplets.get(c);
   
                       int weight = FontUtil.parseCSS2FontWeight(triplet.getWeight());
                       //System.out.println("Registering: "+triplet+" weight="+weight);
  
  
  
  1.11      +0 -1      xml-fop/src/java/org/apache/fop/pdf/PDFFactory.java
  
  Index: PDFFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFFactory.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PDFFactory.java   2 Apr 2004 09:14:51 -0000       1.10
  +++ PDFFactory.java   22 Apr 2004 21:38:39 -0000      1.11
  @@ -26,7 +26,6 @@
   import java.util.Map;
   
   // Apache libs
  -import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.commons.io.IOUtils;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  
  
  
  1.5       +2 -2      xml-fop/src/java/org/apache/fop/pdf/PDFResources.java
  
  Index: PDFResources.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFResources.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFResources.java 27 Feb 2004 17:50:31 -0000      1.4
  +++ PDFResources.java 22 Apr 2004 21:38:39 -0000      1.5
  @@ -18,7 +18,7 @@
    
   package org.apache.fop.pdf;
   
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.fonts.Typeface;
   import org.apache.fop.fonts.FontDescriptor;
   
  @@ -88,7 +88,7 @@
        * @param doc PDF document to add fonts to
        * @param fontInfo font info object to get font information from
        */
  -   public void addFonts(PDFDocument doc, Document fontInfo) {
  +   public void addFonts(PDFDocument doc, FontInfo fontInfo) {
           Map fonts = fontInfo.getUsedFonts();
           Iterator e = fonts.keySet().iterator();
           while (e.hasNext()) {
  
  
  
  1.26      +2 -2      xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java
  
  Index: AbstractRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AbstractRenderer.java     31 Mar 2004 10:55:07 -0000      1.25
  +++ AbstractRenderer.java     22 Apr 2004 21:38:39 -0000      1.26
  @@ -61,7 +61,7 @@
   import org.apache.fop.area.inline.Character;
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.fo.Constants;
  -import org.apache.fop.fo.FOTreeControl;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.fo.pagination.Region;
   import org.apache.commons.logging.Log;
   
  @@ -170,7 +170,7 @@
       /**
        *  @see org.apache.fop.render.Renderer
        */
  -    public abstract void setupFontInfo(FOTreeControl foTreeControl);
  +    public abstract void setupFontInfo(FontInfo fontInfo);
   
       /**
        *  @see org.apache.fop.render.Renderer
  
  
  
  1.8       +5 -5      xml-fop/src/java/org/apache/fop/render/PrintRenderer.java
  
  Index: PrintRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/PrintRenderer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PrintRenderer.java        27 Feb 2004 17:55:23 -0000      1.7
  +++ PrintRenderer.java        22 Apr 2004 21:38:39 -0000      1.8
  @@ -20,7 +20,7 @@
   
   // FOP
   import org.apache.fop.apps.Document;
  -import org.apache.fop.fo.FOTreeControl;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.fonts.FontSetup;
   
   // Java
  @@ -30,7 +30,7 @@
   public abstract class PrintRenderer extends AbstractRenderer {
   
       /** Font configuration */
  -    protected FOTreeControl fontInfo;
  +    protected FontInfo fontInfo;
   
       /** list of fonts */
       protected List fontList = null;
  @@ -40,9 +40,9 @@
        *
        * @param fontInfo  font info to set up
        */
  -    public void setupFontInfo(FOTreeControl foTreeControl) {
  -        this.fontInfo = foTreeControl;
  -        FontSetup.setup((Document)fontInfo, fontList);
  +    public void setupFontInfo(FontInfo inFontInfo) {
  +        this.fontInfo = inFontInfo;
  +        FontSetup.setup(fontInfo, fontList);
       }
   
   }
  
  
  
  1.10      +3 -3      xml-fop/src/java/org/apache/fop/render/Renderer.java
  
  Index: Renderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/Renderer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Renderer.java     31 Mar 2004 10:55:07 -0000      1.9
  +++ Renderer.java     22 Apr 2004 21:38:39 -0000      1.10
  @@ -35,7 +35,7 @@
   import org.apache.fop.area.inline.Space;
   import org.apache.fop.area.inline.Viewport;
   import org.apache.fop.area.inline.TextArea;
  -import org.apache.fop.fo.FOTreeControl;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.commons.logging.Log;
   
  @@ -92,9 +92,9 @@
       /**
        * Set up the given FontInfo.
        *
  -     * @param fontInfo  The fonts
  +     * @param fontInfo  The font information
        */
  -    void setupFontInfo(FOTreeControl foTreeControl);
  +    void setupFontInfo(FontInfo fontInfo);
   
       /**
        * Set up renderer options.
  
  
  
  1.22      +4 -4      xml-fop/src/java/org/apache/fop/render/awt/AWTRenderer.java
  
  Index: AWTRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/awt/AWTRenderer.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AWTRenderer.java  27 Feb 2004 17:51:22 -0000      1.21
  +++ AWTRenderer.java  22 Apr 2004 21:38:40 -0000      1.22
  @@ -45,7 +45,7 @@
   import java.util.Map;
   import java.util.Vector;
   
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.apps.InputHandler;
   import org.apache.fop.area.Area;
  @@ -79,7 +79,7 @@
       private BufferedImage currentPageImage = null;
       
       /** Font configuration */
  -    protected Document fontInfo;
  +    protected FontInfo fontInfo;
   
       /**
           The InputHandler associated with this Renderer.
  @@ -125,9 +125,9 @@
           return translator;
       }
   
  -    public void setupFontInfo(FOTreeControl foTreeControl) {
  +    public void setupFontInfo(FontInfo inFontInfo) {
           // create a temp Image to test font metrics on
  -        fontInfo = (Document) foTreeControl;
  +        fontInfo = inFontInfo;
           BufferedImage fontImage =
               new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
           FontSetup.setup(fontInfo, fontImage.createGraphics());
  
  
  
  1.6       +2 -2      xml-fop/src/java/org/apache/fop/render/awt/FontSetup.java
  
  Index: FontSetup.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/awt/FontSetup.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FontSetup.java    27 Feb 2004 17:51:22 -0000      1.5
  +++ FontSetup.java    22 Apr 2004 21:38:40 -0000      1.6
  @@ -19,7 +19,7 @@
   package org.apache.fop.render.awt;
   
   // FOP
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.fonts.Font;
   
   // Java
  @@ -43,7 +43,7 @@
        * @param fontInfo the font info object to set up
        * @param graphics needed for acces to font metrics
        */
  -    public static void setup(Document fontInfo, Graphics2D graphics) {
  +    public static void setup(FontInfo fontInfo, Graphics2D graphics) {
           FontMetricsMapper metric;
           int normal, bold, bolditalic, italic;
   
  
  
  
  1.8       +2 -2      xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java
  
  Index: MIFHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MIFHandler.java   27 Feb 2004 17:51:39 -0000      1.7
  +++ MIFHandler.java   22 Apr 2004 21:38:40 -0000      1.8
  @@ -75,7 +75,7 @@
       public MIFHandler(Document doc, OutputStream os) {
           super(doc);
           outStream = os;
  -        FontSetup.setup(doc, null);
  +        FontSetup.setup(doc.getFontInfo(), null);
       }
   
       /**
  
  
  
  1.40      +1 -2      xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- PDFRenderer.java  7 Apr 2004 14:39:43 -0000       1.39
  +++ PDFRenderer.java  22 Apr 2004 21:38:40 -0000      1.40
  @@ -262,8 +262,7 @@
        * @see org.apache.fop.render.Renderer#stopRenderer()
        */
       public void stopRenderer() throws IOException {
  -        pdfDoc.getResources().addFonts(pdfDoc,
  -            (org.apache.fop.apps.Document) fontInfo);
  +        pdfDoc.getResources().addFonts(pdfDoc, fontInfo);
           pdfDoc.outputTrailer(ostream);
   
           this.pdfDoc = null;
  
  
  
  1.10      +3 -3      xml-fop/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java
  
  Index: PDFXMLHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PDFXMLHandler.java        21 Mar 2004 12:38:56 -0000      1.9
  +++ PDFXMLHandler.java        22 Apr 2004 21:38:40 -0000      1.10
  @@ -30,7 +30,7 @@
   import org.apache.fop.svg.PDFAElementBridge;
   import org.apache.fop.svg.PDFGraphics2D;
   import org.apache.fop.svg.SVGUserAgent;
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   
   /* org.w3c.dom.Document is not imported to avoid conflict with
      org.apache.fop.control.Document */
  @@ -163,7 +163,7 @@
           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 = (Document)context.getProperty(PDF_FONT_INFO);
  +        pdfi.fi = (FontInfo) 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();
  @@ -192,7 +192,7 @@
           /** see PDF_HEIGHT */
           public int height;
           /** see PDF_FONT_INFO */
  -        public Document fi;
  +        public FontInfo fi;
           /** see PDF_FONT_NAME */
           public String currentFontName;
           /** see PDF_FONT_SIZE */
  
  
  
  1.5       +3 -3      
xml-fop/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java
  
  Index: AbstractPSDocumentGraphics2D.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractPSDocumentGraphics2D.java 27 Feb 2004 17:53:11 -0000      1.4
  +++ AbstractPSDocumentGraphics2D.java 22 Apr 2004 21:38:40 -0000      1.5
  @@ -69,7 +69,7 @@
   
           if (!textAsShapes) {
               this.document = new Document(null);
  -            FontSetup.setup(this.document, null);
  +            FontSetup.setup(this.document.getFontInfo(), null);
           }
       }
   
  
  
  
  1.4       +3 -3      
xml-fop/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java
  
  Index: EPSDocumentGraphics2D.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EPSDocumentGraphics2D.java        3 Apr 2004 13:35:09 -0000       1.3
  +++ EPSDocumentGraphics2D.java        22 Apr 2004 21:38:40 -0000      1.4
  @@ -70,7 +70,7 @@
           PSProcSets.writeFOPStdProcSet(gen);
           PSProcSets.writeFOPEPSProcSet(gen);
           if (document != null) {
  -            PSProcSets.writeFontDict(gen, document);
  +            PSProcSets.writeFontDict(gen, document.getFontInfo());
           }
           gen.writeDSCComment(DSCConstants.END_PROLOG);
       }
  
  
  
  1.12      +2 -2      
xml-fop/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java
  
  Index: PSDocumentGraphics2D.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PSDocumentGraphics2D.java 3 Apr 2004 13:35:09 -0000       1.11
  +++ PSDocumentGraphics2D.java 22 Apr 2004 21:38:40 -0000      1.12
  @@ -57,7 +57,7 @@
   
           if (!textAsShapes) {
               this.document = new Document(null);
  -            FontSetup.setup(this.document, null);
  +            FontSetup.setup(this.document.getFontInfo(), null);
           }
       }
   
  @@ -114,7 +114,7 @@
           PSProcSets.writeFOPStdProcSet(gen);
           PSProcSets.writeFOPEPSProcSet(gen);
           if (document != null) {
  -            PSProcSets.writeFontDict(gen, document);
  +            PSProcSets.writeFontDict(gen, document.getFontInfo());
           }
           gen.writeDSCComment(DSCConstants.END_SETUP);
       }
  
  
  
  1.9       +3 -3      xml-fop/src/java/org/apache/fop/render/ps/PSGraphics2D.java
  
  Index: PSGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSGraphics2D.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PSGraphics2D.java 3 Apr 2004 13:35:09 -0000       1.8
  +++ PSGraphics2D.java 22 Apr 2004 21:38:40 -0000      1.9
  @@ -873,12 +873,12 @@
           String style = f.isItalic() ? "italic" : "normal";
           int weight = f.isBold() ? Font.BOLD : Font.NORMAL;
                   
  -        String fontKey = this.document.findAdjustWeight(fontFamily, style, weight);
  +        String fontKey = this.document.getFontInfo().findAdjustWeight(fontFamily, 
style, weight);
           if (fontKey == null) {
  -            fontKey = this.document.findAdjustWeight("sans-serif", style, weight);
  +            fontKey = this.document.getFontInfo().findAdjustWeight("sans-serif", 
style, weight);
           }
           return new Font(fontKey, 
  -                this.document.getMetricsFor(fontKey), 
  +                this.document.getFontInfo().getMetricsFor(fontKey), 
                   fontSize);
       }
   
  
  
  
  1.9       +2 -2      xml-fop/src/java/org/apache/fop/render/ps/PSProcSets.java
  
  Index: PSProcSets.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSProcSets.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PSProcSets.java   27 Feb 2004 17:53:11 -0000      1.8
  +++ PSProcSets.java   22 Apr 2004 21:38:40 -0000      1.9
  @@ -24,7 +24,7 @@
   
   import org.apache.fop.fonts.Typeface;
   import org.apache.fop.fonts.Glyphs;
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   
   /**
    * This class defines the basic resources (procsets) used by FOP's PostScript
  @@ -185,7 +185,7 @@
        * @param fontInfo available fonts
        * @throws IOException in case of an I/O problem
        */
  -    public static void writeFontDict(PSGenerator gen, Document fontInfo) 
  +    public static void writeFontDict(PSGenerator gen, FontInfo fontInfo) 
                   throws IOException {
           gen.writeln("%%BeginResource: procset FOPFonts");
           gen.writeln("%%Title: Font setup (shortcuts) for this file");
  
  
  
  1.26      +9 -10     xml-fop/src/java/org/apache/fop/render/ps/PSRenderer.java
  
  Index: PSRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSRenderer.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- PSRenderer.java   3 Apr 2004 13:35:09 -0000       1.25
  +++ PSRenderer.java   22 Apr 2004 21:38:40 -0000      1.26
  @@ -41,7 +41,7 @@
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.fonts.FontSetup;
   import org.apache.fop.fonts.Typeface;
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.render.AbstractRenderer;
   import org.apache.fop.render.RendererContext;
   import org.apache.fop.fo.FOTreeControl;
  @@ -50,8 +50,7 @@
   import org.apache.fop.image.ImageFactory;
   import org.apache.fop.traits.BorderProps;
   
  -/* org.w3c.dom.Document is not imported to avoid conflict with
  -   org.apache.fop.control.Document */
  +import org.w3c.dom.Document;
   
   /**
    * Renderer that renders to PostScript.
  @@ -93,7 +92,7 @@
       private float currGreen;
       private float currBlue;
   
  -    private Document fontInfo;
  +    private FontInfo fontInfo;
   
       /**
        * @see 
org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
  @@ -229,9 +228,9 @@
        *
        * @param foTreeControl the font info object to set up
        */
  -    public void setupFontInfo(FOTreeControl foTreeControl) {
  -        FontSetup.setup((Document) foTreeControl, null);
  -        this.fontInfo = (Document) foTreeControl;
  +    public void setupFontInfo(FontInfo inFontInfo) {
  +        this.fontInfo = inFontInfo;
  +        FontSetup.setup(fontInfo, null);
       }
   
       /**
  @@ -451,7 +450,7 @@
           int fontsize = area.getTraitAsInteger(Trait.FONT_SIZE);
   
           // This assumes that *all* CIDFonts use a /ToUnicode mapping
  -        Typeface f = (Typeface)fontInfo.getFonts().get(fontname);
  +        Typeface f = (Typeface) fontInfo.getFonts().get(fontname);
   
           //Determine position
           int rx = currentBlockIPPosition;
  @@ -809,7 +808,7 @@
        * @see 
org.apache.fop.render.AbstractRenderer#renderForeignObject(ForeignObject, Rectangle2D)
        */
       public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
  -        org.w3c.dom.Document doc = fo.getDocument();
  +        Document doc = fo.getDocument();
           String ns = fo.getNameSpace();
           renderDocument(doc, ns, pos);
       }
  @@ -820,7 +819,7 @@
        * @param ns Namespace for the XML document
        * @param pos Position for the generated graphic/image
        */
  -    public void renderDocument(org.w3c.dom.Document doc, String ns, Rectangle2D 
pos) {
  +    public void renderDocument(Document doc, String ns, Rectangle2D pos) {
           RendererContext context;
           context = new RendererContext(MIME_TYPE);
           context.setUserAgent(userAgent);
  
  
  
  1.13      +5 -5      xml-fop/src/java/org/apache/fop/render/ps/PSTextPainter.java
  
  Index: PSTextPainter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSTextPainter.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PSTextPainter.java        3 Apr 2004 13:35:09 -0000       1.12
  +++ PSTextPainter.java        22 Apr 2004 21:38:40 -0000      1.13
  @@ -386,18 +386,18 @@
                       return;
                   }*/
                   fontFamily = fam.getFamilyName();
  -                if (document.hasFont(fontFamily, style, weight)) {
  -                    String fname = document.fontLookup(
  +                if (document.getFontInfo().hasFont(fontFamily, style, weight)) {
  +                    String fname = document.getFontInfo().fontLookup(
                               fontFamily, style, weight);
  -                    FontMetrics metrics = document.getMetricsFor(fname);
  +                    FontMetrics metrics = 
document.getFontInfo().getMetricsFor(fname);
                       int fsize = (int)(fontSize.floatValue() * 1000);
                       return new Font(fname, metrics, fsize);
                   }
               }
           }
  -        String fname = document.fontLookup(
  +        String fname = document.getFontInfo().fontLookup(
                   "any", style, Font.NORMAL);
  -        FontMetrics metrics = document.getMetricsFor(fname);
  +        FontMetrics metrics = document.getFontInfo().getMetricsFor(fname);
           int fsize = (int)(fontSize.floatValue() * 1000);
           return new Font(fname, metrics, fsize);
       }
  
  
  
  1.24      +2 -2      xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java
  
  Index: RTFHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- RTFHandler.java   4 Apr 2004 11:12:29 -0000       1.23
  +++ RTFHandler.java   22 Apr 2004 21:38:40 -0000      1.24
  @@ -131,7 +131,7 @@
           bDefer = false;
           bDeferredExecution = false;
           iNestCount=0;
  -        FontSetup.setup(doc, null);
  +        FontSetup.setup(doc.getFontInfo(), null);
           log.warn(ALPHA_WARNING);
       }
   
  
  
  
  1.14      +3 -3      xml-fop/src/java/org/apache/fop/render/svg/SVGRenderer.java
  
  Index: SVGRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/svg/SVGRenderer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SVGRenderer.java  27 Feb 2004 17:54:50 -0000      1.13
  +++ SVGRenderer.java  22 Apr 2004 21:38:40 -0000      1.14
  @@ -25,7 +25,7 @@
   import org.apache.fop.area.inline.Leader;
   import org.apache.fop.area.inline.TextArea;
   import org.apache.fop.svg.SVGUtilities;
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.fo.FOTreeControl;
   
  @@ -134,11 +134,11 @@
       /**
        * @see org.apache.fop.render.Renderer#setupFontInfo(FOTreeControl)
        */
  -    public void setupFontInfo(FOTreeControl foTreeControl) {
  +    public void setupFontInfo(FontInfo fontInfo) {
           // create a temp Image to test font metrics on
           BufferedImage fontImage =
             new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
  -        org.apache.fop.render.awt.FontSetup.setup((Document)foTreeControl,
  +        org.apache.fop.render.awt.FontSetup.setup(fontInfo,
                   fontImage.createGraphics());
       }
   
  
  
  
  1.19      +5 -7      xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java
  
  Index: XMLRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XMLRenderer.java  27 Feb 2004 17:55:12 -0000      1.18
  +++ XMLRenderer.java  22 Apr 2004 21:38:41 -0000      1.19
  @@ -27,16 +27,13 @@
   import java.util.Iterator;
   import java.awt.geom.Rectangle2D;
   
  -// XML
  -/* org.w3c.dom.Document is not imported to avoid conflict with
  -   org.apache.fop.control.Document */
  +import org.w3c.dom.Document;
   
   // FOP
   import org.apache.fop.render.AbstractRenderer;
   import org.apache.fop.render.RendererContext;
   import org.apache.fop.render.XMLHandler;
   import org.apache.fop.apps.FOUserAgent;
  -import org.apache.fop.apps.Document;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.area.BeforeFloat;
   import org.apache.fop.area.Block;
  @@ -61,6 +58,7 @@
   import org.apache.fop.area.inline.Viewport;
   import org.apache.fop.area.inline.TextArea;
   import org.apache.fop.fonts.FontSetup;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.fo.FOTreeControl;
   import org.apache.fop.fo.pagination.Region;
   
  @@ -178,8 +176,8 @@
        *
        * @param fontInfo the font info object to set up
        */
  -    public void setupFontInfo(FOTreeControl foTreeControl) {
  -        FontSetup.setup((Document) foTreeControl, null);
  +    public void setupFontInfo(FontInfo fontInfo) {
  +        FontSetup.setup(fontInfo, null);
       }
   
       private boolean isCoarseXml() {
  @@ -393,7 +391,7 @@
        */
       public void renderForeignObject(ForeignObject fo) {
           writeStartTag("<foreignObject>");
  -        org.w3c.dom.Document doc = fo.getDocument();
  +        Document doc = fo.getDocument();
           String ns = fo.getNameSpace();
           context.setProperty(XMLXMLHandler.WRITER, writer);
           renderXML(userAgent, context, doc, ns);
  
  
  
  1.11      +4 -4      xml-fop/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
  
  Index: PDFDocumentGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PDFDocumentGraphics2D.java        2 Apr 2004 09:16:49 -0000       1.10
  +++ PDFDocumentGraphics2D.java        22 Apr 2004 21:38:41 -0000      1.11
  @@ -28,6 +28,7 @@
   import org.apache.fop.pdf.PDFColor;
   import org.apache.fop.pdf.PDFAnnotList;
   import org.apache.fop.fonts.FontSetup;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.avalon.framework.CascadingRuntimeException;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.configuration.Configurable;
  @@ -35,7 +36,6 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.commons.logging.impl.SimpleLog;
   import org.apache.commons.logging.Log;
  -import org.apache.fop.apps.Document;
   
   import java.awt.Graphics;
   import java.awt.Font;
  @@ -86,7 +86,7 @@
           super(textAsShapes);
   
           if (!textAsShapes) {
  -            fontInfo = new Document(null);
  +            fontInfo = new FontInfo();
               FontSetup.setup(fontInfo, null);
               //FontState fontState = new FontState("Helvetica", "normal",
               //                          FontInfo.NORMAL, 12, 0);
  @@ -160,7 +160,7 @@
        */
       public void initialize() throws Exception {
           if (this.fontInfo == null) {
  -            fontInfo = new Document(null);
  +            fontInfo = new FontInfo();
               FontSetup.setup(fontInfo, this.fontList);
               //FontState fontState = new FontState("Helvetica", "normal",
               //                          FontInfo.NORMAL, 12, 0);
  @@ -209,7 +209,7 @@
        * Get the font info for this pdf document.
        * @return the font information
        */
  -    public Document getFontInfo() {
  +    public FontInfo getFontInfo() {
           return fontInfo;
       }
   
  
  
  
  1.16      +4 -4      xml-fop/src/java/org/apache/fop/svg/PDFGraphics2D.java
  
  Index: PDFGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFGraphics2D.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PDFGraphics2D.java        3 Apr 2004 09:55:08 -0000       1.15
  +++ PDFGraphics2D.java        22 Apr 2004 21:38:41 -0000      1.16
  @@ -32,7 +32,7 @@
   import org.apache.fop.pdf.PDFLink;
   import org.apache.fop.pdf.PDFAnnotList;
   import org.apache.fop.pdf.BitmapImage;
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.fonts.Font;
   import org.apache.fop.fonts.FontSetup;
   import org.apache.fop.fonts.FontMetrics;
  @@ -128,7 +128,7 @@
       /**
        * The current font information.
        */
  -    protected Document fontInfo;
  +    protected FontInfo fontInfo;
   
       /**
        * The override font state used when drawing text and the font cannot be
  @@ -172,7 +172,7 @@
        * @param font the current font name
        * @param size the current font size
        */
  -    public PDFGraphics2D(boolean textAsShapes, Document fi, PDFDocument doc,
  +    public PDFGraphics2D(boolean textAsShapes, FontInfo fi, PDFDocument doc,
                            PDFResourceContext page, String pref, String font, float 
size) {
           super(textAsShapes);
           pdfDoc = doc;
  @@ -943,7 +943,7 @@
       private void createPattern(PatternPaint pp, boolean fill) {
           Rectangle2D rect = pp.getPatternRect();
   
  -        Document fontInfo = new Document(null);
  +        FontInfo fontInfo = new FontInfo();
           FontSetup.setup(fontInfo, null);
   
           PDFResources res = pdfDoc.getFactory().makeResources();
  
  
  
  1.5       +2 -2      xml-fop/src/java/org/apache/fop/svg/PDFTextElementBridge.java
  
  Index: PDFTextElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFTextElementBridge.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFTextElementBridge.java 27 Feb 2004 17:55:51 -0000      1.4
  +++ PDFTextElementBridge.java 22 Apr 2004 21:38:41 -0000      1.5
  @@ -24,7 +24,7 @@
   import org.apache.batik.bridge.TextUtilities;
   import org.apache.batik.gvt.GraphicsNode;
   
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  @@ -43,7 +43,7 @@
        * Constructs a new bridge for the &lt;text> element.
        * @param fi the font infomration
        */
  -    public PDFTextElementBridge(Document fi) {
  +    public PDFTextElementBridge(FontInfo fi) {
           pdfTextPainter = new PDFTextPainter(fi);
       }
   
  
  
  
  1.10      +4 -4      xml-fop/src/java/org/apache/fop/svg/PDFTextPainter.java
  
  Index: PDFTextPainter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFTextPainter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PDFTextPainter.java       27 Feb 2004 17:55:51 -0000      1.9
  +++ PDFTextPainter.java       22 Apr 2004 21:38:41 -0000      1.10
  @@ -43,7 +43,7 @@
   
   import org.apache.fop.fonts.FontMetrics;
   import org.apache.fop.fonts.Font;
  -import org.apache.fop.apps.Document;
  +import org.apache.fop.fonts.FontInfo;
   
   /**
    * Renders the attributed character iterator of a <tt>TextNode</tt>.
  @@ -60,7 +60,7 @@
    * @version $Id$
    */
   public class PDFTextPainter implements TextPainter {
  -    private Document fontInfo;
  +    private FontInfo fontInfo;
   
       /**
        * Use the stroking text painter to get the bounds and shape.
  @@ -73,7 +73,7 @@
        * Create a new PDF text painter with the given font information.
        * @param fi the fint info
        */
  -    public PDFTextPainter(Document fi) {
  +    public PDFTextPainter(FontInfo fi) {
           fontInfo = fi;
       }
   
  @@ -164,7 +164,7 @@
                          : Font.NORMAL;
   
           Font fontState = null;
  -        Document fi = fontInfo;
  +        FontInfo fi = fontInfo;
           boolean found = false;
           String fontFamily = null;
           if (gvtFonts != null) {
  
  
  
  1.15      +16 -17    xml-fop/src/java/org/apache/fop/tools/AreaTreeBuilder.java
  
  Index: AreaTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/tools/AreaTreeBuilder.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AreaTreeBuilder.java      31 Mar 2004 10:55:07 -0000      1.14
  +++ AreaTreeBuilder.java      22 Apr 2004 21:38:41 -0000      1.15
  @@ -33,8 +33,7 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   import org.w3c.dom.Element;
  -/* org.w3c.dom.Document is not imported to avoid conflict with
  -   org.apache.fop.control.Document */
  +import org.w3c.dom.Document;
   
   // Batik
   import org.apache.batik.dom.svg.SVGDOMImplementation;
  @@ -68,8 +67,8 @@
   import org.apache.fop.area.inline.Space;
   import org.apache.fop.area.inline.Viewport;
   import org.apache.fop.area.inline.TextArea;
  -import org.apache.fop.apps.Document;
   import org.apache.fop.fonts.Font;
  +import org.apache.fop.fonts.FontInfo;
   import org.apache.fop.render.Renderer;
   import org.apache.fop.render.pdf.PDFRenderer;
   import org.apache.fop.render.svg.SVGRenderer;
  @@ -161,14 +160,14 @@
           }
   
           rend.setLogger(logger);
  -        Document fi = new Document(null);
  -        rend.setupFontInfo(fi);
  +        org.apache.fop.apps.Document doc = new org.apache.fop.apps.Document(null);
  +        rend.setupFontInfo(doc.getFontInfo());
           FOUserAgent ua = new FOUserAgent();
           ua.setLogger(logger);
           rend.setUserAgent(ua);
   
           StorePagesModel sm = AreaTree.createStorePagesModel();
  -        TreeLoader tl = new TreeLoader(fi);
  +        TreeLoader tl = new TreeLoader(doc);
           tl.setLogger(logger);
           tl.setTreeModel(sm);
           try {
  @@ -240,12 +239,12 @@
   class TreeLoader {
       private AreaTree areaTree;
       private AreaTreeModel model;
  -    private Document fontInfo;
  +    private org.apache.fop.apps.Document document;
       private Font currentFontState;
       private Log logger = null;
   
  -    TreeLoader(Document fi) {
  -        fontInfo = fi;
  +    TreeLoader(org.apache.fop.apps.Document doc) {
  +        document = doc;
       }
   
       /**
  @@ -261,7 +260,7 @@
       }
   
       public void buildAreaTree(InputStream is) {
  -        org.w3c.dom.Document doc = null;
  +        Document doc = null;
           try {
               DocumentBuilderFactory fact =
                 DocumentBuilderFactory.newInstance();
  @@ -273,7 +272,7 @@
           Element root = null;
           root = doc.getDocumentElement();
   
  -        areaTree = new AreaTree(fontInfo);
  +        areaTree = new AreaTree(document);
           areaTree.setTreeModel(model);
   
           readAreaTree(root);
  @@ -533,7 +532,7 @@
                       // error
                   }
                   LineArea line = new LineArea();
  -        addTraits((Element) obj, line);
  +                addTraits((Element) obj, line);
                   String height = ((Element) obj).getAttribute("height");
                   int h = Integer.parseInt(height);
                   line.setHeight(h);
  @@ -560,8 +559,8 @@
                   Character ch =
                     new Character(getString((Element) obj).charAt(0));
                   addTraits((Element) obj, ch);
  -                String fname = fontInfo.fontLookup("sans-serif", "normal", 
Font.NORMAL);
  -                FontMetrics metrics = fontInfo.getMetricsFor(fname);
  +                String fname = document.getFontInfo().fontLookup("sans-serif", 
"normal", Font.NORMAL);
  +                FontMetrics metrics = document.getFontInfo().getMetricsFor(fname);
                   currentFontState =
                       new Font(fname, metrics, 12000);
   
  @@ -585,8 +584,8 @@
                       list.add(leader);
                   }
               } else if (obj.getNodeName().equals("word")) {
  -                String fname = fontInfo.fontLookup("sans-serif", "normal", 
Font.NORMAL);
  -                FontMetrics metrics = fontInfo.getMetricsFor(fname);
  +                String fname = document.getFontInfo().fontLookup("sans-serif", 
"normal", Font.NORMAL);
  +                FontMetrics metrics = document.getFontInfo().getMetricsFor(fname);
                   currentFontState =
                       new Font(fname, metrics, 12000);
                   TextArea text = getText((Element) obj);
  @@ -639,7 +638,7 @@
       }
   
       ForeignObject getForeignObject(Element root) {
  -        org.w3c.dom.Document doc;
  +        Document doc;
           String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
   
           NodeList childs = root.getChildNodes();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to