gmazza 2004/06/17 21:13:54
Modified: src/java/org/apache/fop/apps Document.java Driver.java
src/java/org/apache/fop/area AreaTree.java
src/java/org/apache/fop/fo FOInputHandler.java
FOTreeHandler.java FObjMixed.java
PropertyManager.java
src/java/org/apache/fop/fo/flow Leader.java PageNumber.java
PageNumberCitation.java
src/java/org/apache/fop/fo/pagination PageSequence.java
Title.java
src/java/org/apache/fop/layoutmgr BlockLayoutManager.java
src/java/org/apache/fop/render/mif MIFHandler.java
src/java/org/apache/fop/render/rtf RTFHandler.java
src/java/org/apache/fop/tools AreaTreeBuilder.java
Log:
1. FOTreeBuilder modified to handle more of the renderer initialization.
2. AreaTree now takes a Renderer as a constructor, handles RenderPagesModel
initialization.
3. FontInfo object moved from Driver/Document to fo.FOInputHandler.
4. getFontState/getFontInfo now take a fontInfo object directly instead of a
apps.Document.
5. validity checking added to PageSequence.java
Revision Changes Path
1.23 +1 -15 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Document.java 17 Jun 2004 07:02:13 -0000 1.22
+++ Document.java 18 Jun 2004 04:13:53 -0000 1.23
@@ -20,7 +20,6 @@
// FOP
import org.apache.fop.fo.FOInputHandler;
-import org.apache.fop.fonts.FontInfo;
import org.apache.fop.render.Renderer;
// SAX
@@ -35,9 +34,6 @@
/** The parent Driver object */
private Driver driver;
- /** The Font information relevant for this document */
- private FontInfo fontInfo;
-
/** The Renderer being used for this document */
protected Renderer renderer;
@@ -53,15 +49,6 @@
*/
public Document(Driver driver) {
this.driver = driver;
- this.fontInfo = new FontInfo();
- }
-
- /**
- * Retrieve the font information for this document
- * @return the FontInfo instance for this document
- */
- public FontInfo getFontInfo() {
- return this.fontInfo;
}
/**
@@ -74,7 +61,6 @@
/**
* Get the renderer for this document
- *
* @return the renderer for this document
*/
public Renderer getRenderer() {
1.68 +2 -14 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.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- Driver.java 17 Jun 2004 07:02:13 -0000 1.67
+++ Driver.java 18 Jun 2004 04:13:53 -0000 1.68
@@ -488,19 +488,7 @@
}
currentDocument.renderer = renderer;
- foInputHandler = new FOTreeHandler(currentDocument, true);
-
- try {
- renderer.setupFontInfo(currentDocument.getFontInfo());
- // check that the "any,normal,400" font exists
- if (!currentDocument.getFontInfo().isSetupValid()) {
- throw new FOPException(
- "No default font defined by OutputConverter");
- }
- renderer.startRenderer(stream);
- } catch (IOException e) {
- throw new FOPException(e);
- }
+ foInputHandler = new FOTreeHandler(currentDocument, stream, true);
}
currentDocument.foInputHandler = foInputHandler;
1.13 +4 -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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AreaTree.java 17 Jun 2004 04:46:08 -0000 1.12
+++ AreaTree.java 18 Jun 2004 04:13:53 -0000 1.13
@@ -21,6 +21,7 @@
import org.apache.fop.area.extensions.BookmarkData;
import org.apache.fop.fo.extensions.Outline;
import org.apache.fop.fo.extensions.Bookmarks;
+import org.apache.fop.render.Renderer;
import java.util.ArrayList;
import java.util.List;
@@ -67,7 +68,9 @@
/**
* Constructor.
*/
- public AreaTree () {
+ public AreaTree (Renderer renderer) {
+ // this.atModel = new CachedRenderPagesModel(renderer);
+ setTreeModel(new RenderPagesModel(renderer));
}
1.20 +16 -1 xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java
Index: FOInputHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- FOInputHandler.java 17 Jun 2004 07:02:13 -0000 1.19
+++ FOInputHandler.java 18 Jun 2004 04:13:53 -0000 1.20
@@ -45,6 +45,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.fonts.FontInfo;
import org.apache.commons.logging.Log;
import org.xml.sax.SAXException;
@@ -67,6 +68,11 @@
*/
public Document doc = null;
+ /**
+ * The Font information relevant for this document
+ */
+ protected FontInfo fontInfo;
+
/**
* logging instance
*/
@@ -85,6 +91,7 @@
*/
public FOInputHandler(Document document) {
doc = document;
+ this.fontInfo = new FontInfo();
}
/**
@@ -125,6 +132,14 @@
*/
public Driver getDriver() {
return doc.getDriver();
+ }
+
+ /**
+ * Retrieve the font information for this document
+ * @return the FontInfo instance for this document
+ */
+ public FontInfo getFontInfo() {
+ return this.fontInfo;
}
/**
1.22 +18 -15 xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java
Index: FOTreeHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeHandler.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- FOTreeHandler.java 17 Jun 2004 07:02:13 -0000 1.21
+++ FOTreeHandler.java 18 Jun 2004 04:13:53 -0000 1.22
@@ -20,6 +20,7 @@
// Java
import java.io.IOException;
+import java.io.OutputStream;
import java.util.HashSet;
import java.util.Iterator;
@@ -30,7 +31,6 @@
import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.area.AreaTree;
-import org.apache.fop.area.RenderPagesModel;
import org.apache.fop.area.Title;
import org.apache.fop.fo.extensions.Bookmarks;
import org.apache.fop.fo.flow.BasicLink;
@@ -104,15 +104,27 @@
* Main constructor
* @param document the apps.Document implementation that governs this
* FO Tree
+ * @param OutputStream stream to use to output results of renderer
+ *
* @param store if true then use the store pages model and keep the
* area tree in memory
*/
- public FOTreeHandler(Document doc, boolean store) {
+ public FOTreeHandler(Document doc, OutputStream stream, boolean store) throws
FOPException {
super(doc);
- areaTree = new AreaTree();
- // this.atModel = new CachedRenderPagesModel(renderer);
- areaTree.setTreeModel(new RenderPagesModel(doc.getRenderer()));
+ areaTree = new AreaTree(doc.getRenderer());
+
+ try {
+ doc.getRenderer().setupFontInfo(fontInfo);
+ // check that the "any,normal,400" font exists
+ if (!fontInfo.isSetupValid()) {
+ throw new FOPException(
+ "No default font defined by OutputConverter");
+ }
+ doc.getRenderer().startRenderer(stream);
+ } catch (IOException e) {
+ throw new FOPException(e);
+ }
if (collectStatistics) {
runtime = Runtime.getRuntime();
@@ -480,15 +492,6 @@
* @see org.apache.fop.fo.FOInputHandler#characters(char[], int, int)
*/
public void characters(char[] data, int start, int length) {
- }
-
- /**
- * Get the font information for the layout handler.
- *
- * @return the font information
- */
- public Document getFontInfo() {
- return doc;
}
/**
1.26 +2 -2 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java
Index: FObjMixed.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- FObjMixed.java 16 Jun 2004 00:27:26 -0000 1.25
+++ FObjMixed.java 18 Jun 2004 04:13:53 -0000 1.26
@@ -46,8 +46,8 @@
if (textInfo == null) {
// Really only need one of these, but need to get fontInfo
// stored in propMgr for later use.
- propMgr.setFontInfo(getFOInputHandler().getDocument());
- textInfo =
propMgr.getTextLayoutProps(getFOInputHandler().getDocument());
+ propMgr.setFontInfo(getFOInputHandler().getFontInfo());
+ textInfo =
propMgr.getTextLayoutProps(getFOInputHandler().getFontInfo());
}
FOText ft = new FOText(data, start, length, textInfo, this);
1.30 +16 -18 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.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- PropertyManager.java 15 Jun 2004 06:26:55 -0000 1.29
+++ PropertyManager.java 18 Jun 2004 04:13:53 -0000 1.30
@@ -19,9 +19,9 @@
package org.apache.fop.fo;
// FOP
-import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fonts.Font;
+import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
@@ -45,7 +45,7 @@
public class PropertyManager implements Constants {
private PropertyList propertyList;
- private Document document = null;
+ private FontInfo fontInfo = null;
private Font fontState = null;
private CommonBorderAndPadding borderAndPadding = null;
private CommonHyphenation hyphProps = null;
@@ -71,13 +71,12 @@
}
/**
- * Sets the Document object telling the property manager which fonts are
+ * Sets the FontInfo object telling the property manager which fonts are
* available.
- * @param document apps.Document implementation containing font
- * information
+ * @param fontInfo FontInfo object
*/
- public void setFontInfo(Document document) {
- this.document = document;
+ public void setFontInfo(FontInfo fontInfo) {
+ this.fontInfo = fontInfo;
}
@@ -88,12 +87,12 @@
* information
* @return a FontState object
*/
- public Font getFontState(Document document) {
+ public Font getFontState(FontInfo fontInfo) {
if (fontState == null) {
- if (document == null) {
- document = this.document;
- } else if (this.document == null) {
- this.document = document;
+ if (fontInfo == null) {
+ fontInfo = this.fontInfo;
+ } else if (this.fontInfo == null) {
+ this.fontInfo = fontInfo;
}
/[EMAIL PROTECTED] this is ugly. need to improve. */
@@ -122,9 +121,9 @@
// various kinds of keywords too
int fontSize = propertyList.get(PR_FONT_SIZE).getLength().getValue();
//int fontVariant = propertyList.get("font-variant").getEnum();
- String fname = document.getFontInfo().fontLookup(fontFamily, fontStyle,
+ String fname = fontInfo.fontLookup(fontFamily, fontStyle,
fontWeight);
- FontMetrics metrics = document.getFontInfo().getMetricsFor(fname);
+ FontMetrics metrics = fontInfo.getMetricsFor(fname);
fontState = new Font(fname, metrics, fontSize);
}
return fontState;
@@ -458,14 +457,13 @@
/**
* Constructs a TextInfo objects. If it was constructed before it is
* reused.
- * @param document apps.Document implementation containing list of
- * available fonts
+ * @param fontInfo FontInfo object containing list of available fonts
* @return a TextInfo object
*/
- public TextInfo getTextLayoutProps(Document document) {
+ public TextInfo getTextLayoutProps(FontInfo fontInfo) {
if (textInfo == null) {
textInfo = new TextInfo();
- textInfo.fs = getFontState(document);
+ textInfo.fs = getFontState(fontInfo);
textInfo.color = propertyList.get(PR_COLOR).getColorType();
textInfo.verticalAlign =
1.27 +1 -1 xml-fop/src/java/org/apache/fop/fo/flow/Leader.java
Index: Leader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Leader.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Leader.java 16 Jun 2004 00:27:26 -0000 1.26
+++ Leader.java 18 Jun 2004 04:13:53 -0000 1.27
@@ -66,7 +66,7 @@
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- this.fontState = propMgr.getFontState(getFOInputHandler().getDocument());
+ this.fontState = propMgr.getFontState(getFOInputHandler().getFontInfo());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
1.24 +1 -1 xml-fop/src/java/org/apache/fop/fo/flow/PageNumber.java
Index: PageNumber.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/PageNumber.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- PageNumber.java 16 Jun 2004 00:27:26 -0000 1.23
+++ PageNumber.java 18 Jun 2004 04:13:53 -0000 1.24
@@ -77,7 +77,7 @@
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- this.fontState = propMgr.getFontState(getFOInputHandler().getDocument());
+ this.fontState = propMgr.getFontState(getFOInputHandler().getFontInfo());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
1.24 +1 -1 xml-fop/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
Index: PageNumberCitation.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/PageNumberCitation.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- PageNumberCitation.java 16 Jun 2004 00:27:26 -0000 1.23
+++ PageNumberCitation.java 18 Jun 2004 04:13:53 -0000 1.24
@@ -82,7 +82,7 @@
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- this.fontState = propMgr.getFontState(getFOInputHandler().getDocument());
+ this.fontState = propMgr.getFontState(getFOInputHandler().getFontInfo());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
1.27 +99 -80 xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java
Index: PageSequence.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- PageSequence.java 16 Jun 2004 23:40:58 -0000 1.26
+++ PageSequence.java 18 Jun 2004 04:13:53 -0000 1.27
@@ -23,10 +23,12 @@
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.apps.FOPException;
@@ -131,6 +133,103 @@
}
/**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ XSL/FOP Content Model: (title?,static-content*,flow)
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName) {
+ if (nsURI == FOElementMapping.URI) {
+ if (localName.equals("title")) {
+ if (titleFO != null) {
+ tooManyNodesError(loc, "fo:title");
+ } else if (flowMap.size() > 0) {
+ nodesOutOfOrderError(loc, "fo:title", "fo:static-content");
+ } else if (mainFlow != null) {
+ nodesOutOfOrderError(loc, "fo:title", "fo:flow");
+ }
+ } else if (localName.equals("static-content")) {
+ if (mainFlow != null) {
+ nodesOutOfOrderError(loc, "fo:static-content", "fo:flow");
+ }
+ } else if (localName.equals("flow")) {
+ if (mainFlow != null) {
+ tooManyNodesError(loc, "fo:flow");
+ }
+ } else {
+ invalidChildError(loc, nsURI, localName);
+ }
+ } else {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+
+ /**
+ * Signal end of this xml element.
+ * This passes the end page sequence to the structure handler
+ * so it can act upon that.
+ */
+ protected void end() {
+ if (mainFlow == null) {
+ missingChildElementError("(title?,static-content*,flow)");
+ }
+ try {
+ getFOInputHandler().endPageSequence(this);
+ } catch (FOPException fopex) {
+ getLogger().error("Error in PageSequence.end(): "
+ + fopex.getMessage(), fopex);
+ }
+ }
+
+ /**
+ * Validate the child being added and initialize internal variables.
+ * XSL content model for page-sequence:
+ * <pre>(title?,static-content*,flow)</pre>
+ *
+ * @param child The flow object child to be added to the PageSequence.
+ */
+ public void addChild(FONode child) {
+ try {
+ String childName = child.getName();
+ if (childName.equals("fo:title")) {
+ this.titleFO = (Title)child;
+ } else if (childName.equals("fo:flow")) {
+ this.mainFlow = (Flow)child;
+ String flowName = this.mainFlow.getFlowName();
+ if (flowMap.containsKey(flowName)) {
+ throw new FOPException("flow-name "
+ + flowName
+ + " is not unique within an fo:page-sequence");
+ }
+ if (!this.layoutMasterSet.regionNameExists(flowName)) {
+ getLogger().error("region-name '"
+ + flowName
+ + "' doesn't exist in the layout-master-set.");
+ }
+ // Don't add main flow to the flow map
+// addFlow(mainFlow);
+ startStructuredPageSequence();
+ super.addChild(child); // For getChildren
+ } else if (childName.equals("fo:static-content")) {
+ String flowName = ((StaticContent)child).getFlowName();
+ if (flowMap.containsKey(flowName)) {
+ throw new FOPException("flow-name " + flowName
+ + " is not unique within an fo:page-sequence");
+ }
+ if (!this.layoutMasterSet.regionNameExists(flowName)) {
+ throw new FOPException("region-name '" + flowName
+ + "' doesn't exist in the layout-master-set.");
+ }
+ flowMap.put(flowName, child);
+// addFlow((Flow)child);
+ startStructuredPageSequence();
+ }
+ } catch (FOPException fopex) {
+ getLogger().error("Error in PageSequence.addChild(): "
+ + fopex.getMessage(), fopex);
+ }
+ }
+
+
+ /**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
@@ -221,73 +320,6 @@
/**
- * Validate the child being added and initialize internal variables.
- * XSL content model for page-sequence:
- * <pre>(title?,static-content*,flow)</pre>
- *
- * @param child The flow object child to be added to the PageSequence.
- */
- public void addChild(FONode child) {
- try {
- String childName = child.getName();
- if (childName.equals("fo:title")) {
- if (this.flowMap.size() > 0) {
- getLogger().warn("fo:title should be first in page-sequence");
- } else {
- this.titleFO = (Title)child;
- }
- } else if (childName.equals("fo:flow")) {
- if (this.mainFlow != null) {
- throw new FOPException("Only a single fo:flow permitted"
- + " per fo:page-sequence");
- } else {
- this.mainFlow = (Flow)child;
- String flowName = this.mainFlow.getFlowName();
- if (flowMap.containsKey(flowName)) {
- throw new FOPException("flow-name "
- + flowName
- + " is not unique within an
fo:page-sequence");
- }
- if (!this.layoutMasterSet.regionNameExists(flowName)) {
- getLogger().error("region-name '"
- + flowName
- + "' doesn't exist in the
layout-master-set.");
- }
- // Don't add main flow to the flow map
-// addFlow(mainFlow);
- startStructuredPageSequence();
- super.addChild(child); // For getChildren
- }
- } else if (childName.equals("fo:static-content")) {
- if (this.mainFlow != null) {
- throw new FOPException(childName
- + " must precede fo:flow; ignoring");
- }
- String flowName = ((StaticContent)child).getFlowName();
- if (flowMap.containsKey(flowName)) {
- throw new FOPException("flow-name " + flowName
- + " is not unique within an
fo:page-sequence");
- }
- if (!this.layoutMasterSet.regionNameExists(flowName)) {
- getLogger().error("region-name '" + flowName
- + "' doesn't exist in the
layout-master-set.");
- }
- flowMap.put(flowName, child);
-// addFlow((Flow)child);
- startStructuredPageSequence();
- } else {
- // Ignore it!
- getLogger().warn("FO '" + childName
- + "' not a legal page-sequence child.");
- return;
- }
- } catch (FOPException fopex) {
- getLogger().error("Error in PageSequence.addChild(): "
- + fopex.getMessage(), fopex);
- }
- }
-
- /**
* Start the page-sequence logic in the Structured Handler
*/
private void startStructuredPageSequence() {
@@ -297,19 +329,6 @@
}
}
- /**
- * Signal end of this xml element.
- * This passes the end page sequence to the structure handler
- * so it can act upon that.
- */
- protected void end() {
- try {
- getFOInputHandler().endPageSequence(this);
- } catch (FOPException fopex) {
- getLogger().error("Error in PageSequence.end(): "
- + fopex.getMessage(), fopex);
- }
- }
/**
* Initialize the current page number for the start of the page sequence.
1.19 +2 -2 xml-fop/src/java/org/apache/fop/fo/pagination/Title.java
Index: Title.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Title.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Title.java 16 Jun 2004 00:27:26 -0000 1.18
+++ Title.java 18 Jun 2004 04:13:53 -0000 1.19
@@ -59,7 +59,7 @@
CommonBackground bProps = propMgr.getBackgroundProps();
// Common Font Properties
- Font fontState = propMgr.getFontState(getFOInputHandler().getDocument());
+ Font fontState = propMgr.getFontState(getFOInputHandler().getFontInfo());
// Common Margin Properties-Inline
CommonMarginInline mProps = propMgr.getMarginInlineProps();
1.23 +1 -1
xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
Index: BlockLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- BlockLayoutManager.java 16 Jun 2004 00:27:27 -0000 1.22
+++ BlockLayoutManager.java 18 Jun 2004 04:13:53 -0000 1.23
@@ -74,7 +74,7 @@
childLMiter = new BlockLMiter(this, childLMiter);
userAgent = inBlock.getUserAgent();
setBlockTextInfo(inBlock.getPropertyManager().getTextLayoutProps(
- inBlock.getFOInputHandler().getDocument()));
+ inBlock.getFOInputHandler().getFontInfo()));
}
private void setBlockTextInfo(TextInfo ti) {
1.9 +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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MIFHandler.java 22 Apr 2004 21:38:40 -0000 1.8
+++ MIFHandler.java 18 Jun 2004 04:13:53 -0000 1.9
@@ -75,7 +75,7 @@
public MIFHandler(Document doc, OutputStream os) {
super(doc);
outStream = os;
- FontSetup.setup(doc.getFontInfo(), null);
+ FontSetup.setup(fontInfo, null);
}
/**
1.26 +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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- RTFHandler.java 22 May 2004 21:44:38 -0000 1.25
+++ RTFHandler.java 18 Jun 2004 04:13:54 -0000 1.26
@@ -131,7 +131,7 @@
bDefer = false;
bDeferredExecution = false;
iNestCount=0;
- FontSetup.setup(doc.getFontInfo(), null);
+ FontSetup.setup(fontInfo, null);
log.warn(ALPHA_WARNING);
}
1.18 +13 -11 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- AreaTreeBuilder.java 17 Jun 2004 04:46:08 -0000 1.17
+++ AreaTreeBuilder.java 18 Jun 2004 04:13:54 -0000 1.18
@@ -160,13 +160,13 @@
}
rend.setLogger(logger);
- org.apache.fop.apps.Document doc = new org.apache.fop.apps.Document(null);
- rend.setupFontInfo(doc.getFontInfo());
+ FontInfo fontInfo = new FontInfo();
+ rend.setupFontInfo(fontInfo);
FOUserAgent ua = new FOUserAgent();
rend.setUserAgent(ua);
StorePagesModel sm = AreaTree.createStorePagesModel();
- TreeLoader tl = new TreeLoader(doc);
+ TreeLoader tl = new TreeLoader(rend, fontInfo);
tl.setLogger(logger);
tl.setTreeModel(sm);
try {
@@ -238,12 +238,14 @@
class TreeLoader {
private AreaTree areaTree;
private AreaTreeModel model;
- private org.apache.fop.apps.Document document;
+ private Renderer renderer;
+ private FontInfo fontInfo;
private Font currentFontState;
private Log logger = null;
- TreeLoader(org.apache.fop.apps.Document doc) {
- document = doc;
+ TreeLoader(Renderer renderer, FontInfo fontInfo) {
+ this.renderer = renderer;
+ this.fontInfo = fontInfo;
}
/**
@@ -271,7 +273,7 @@
Element root = null;
root = doc.getDocumentElement();
- areaTree = new AreaTree();
+ areaTree = new AreaTree(renderer);
areaTree.setTreeModel(model);
readAreaTree(root);
@@ -558,8 +560,8 @@
Character ch =
new Character(getString((Element) obj).charAt(0));
addTraits((Element) obj, ch);
- String fname = document.getFontInfo().fontLookup("sans-serif",
"normal", Font.NORMAL);
- FontMetrics metrics = document.getFontInfo().getMetricsFor(fname);
+ String fname = fontInfo.fontLookup("sans-serif", "normal",
Font.NORMAL);
+ FontMetrics metrics = fontInfo.getMetricsFor(fname);
currentFontState =
new Font(fname, metrics, 12000);
@@ -583,8 +585,8 @@
list.add(leader);
}
} else if (obj.getNodeName().equals("word")) {
- String fname = document.getFontInfo().fontLookup("sans-serif",
"normal", Font.NORMAL);
- FontMetrics metrics = document.getFontInfo().getMetricsFor(fname);
+ String fname = fontInfo.fontLookup("sans-serif", "normal",
Font.NORMAL);
+ FontMetrics metrics = fontInfo.getMetricsFor(fname);
currentFontState =
new Font(fname, metrics, 12000);
TextArea text = getText((Element) obj);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]