diff options
Diffstat (limited to 'src/java/org/apache')
34 files changed, 485 insertions, 476 deletions
diff --git a/src/java/org/apache/fop/layout/FontInfo.java b/src/java/org/apache/fop/control/Document.java index 6560fab97..396ab1cc9 100644 --- a/src/java/org/apache/fop/layout/FontInfo.java +++ b/src/java/org/apache/fop/control/Document.java @@ -1,5 +1,5 @@ /* - * $Id: FontInfo.java,v 1.20 2003/03/06 22:19:16 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. */ -package org.apache.fop.layout; +package org.apache.fop.control; // Java import java.util.Map; @@ -65,7 +65,7 @@ import org.apache.fop.fonts.FontMetrics; * Currently font supported font-variant small-caps is not * implemented. */ -public class FontInfo { +public class Document { /** Default fallback key */ public static final String DEFAULT_FONT = "any,normal,400"; @@ -86,7 +86,7 @@ public class FontInfo { /** * Main constructor */ - public FontInfo() { + public Document() { this.triplets = new java.util.HashMap(); this.fonts = new java.util.HashMap(); this.usedFonts = new java.util.HashMap(); diff --git a/src/java/org/apache/fop/fo/FOInputHandler.java b/src/java/org/apache/fop/fo/FOInputHandler.java index a3734e465..8e06247f4 100644 --- a/src/java/org/apache/fop/fo/FOInputHandler.java +++ b/src/java/org/apache/fop/fo/FOInputHandler.java @@ -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; } diff --git a/src/java/org/apache/fop/fo/FOTreeHandler.java b/src/java/org/apache/fop/fo/FOTreeHandler.java index 67fe255d6..f3fede6a0 100644 --- a/src/java/org/apache/fop/fo/FOTreeHandler.java +++ b/src/java/org/apache/fop/fo/FOTreeHandler.java @@ -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; } diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java index fc791d439..4f6739f30 100644 --- a/src/java/org/apache/fop/fo/FObjMixed.java +++ b/src/java/org/apache/fop/fo/FObjMixed.java @@ -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 diff --git a/src/java/org/apache/fop/fo/PropertyManager.java b/src/java/org/apache/fop/fo/PropertyManager.java index 6dbbc85ef..dc5d9f918 100644 --- a/src/java/org/apache/fop/fo/PropertyManager.java +++ b/src/java/org/apache/fop/fo/PropertyManager.java @@ -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); diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index ea3f9790c..285aef2e8 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -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; diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index af8b3ea57..f6488bd1a 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -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; diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 367fd3e51..53a2bafde 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -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/mif/MIFHandler.java b/src/java/org/apache/fop/mif/MIFHandler.java index 97f47c401..a5b65b4c0 100644 --- a/src/java/org/apache/fop/mif/MIFHandler.java +++ b/src/java/org/apache/fop/mif/MIFHandler.java @@ -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; } diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 3e27bd5d6..979946ff8 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -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) { diff --git a/src/java/org/apache/fop/render/PrintRenderer.java b/src/java/org/apache/fop/render/PrintRenderer.java index bd4cfedc5..cc5c66c3c 100644 --- a/src/java/org/apache/fop/render/PrintRenderer.java +++ b/src/java/org/apache/fop/render/PrintRenderer.java @@ -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); } diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/java/org/apache/fop/render/Renderer.java index d096c3381..8582f5e82 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/java/org/apache/fop/render/Renderer.java @@ -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. diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index 4314078cd..1a699f804 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -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); diff --git a/src/java/org/apache/fop/render/awt/FontSetup.java b/src/java/org/apache/fop/render/awt/FontSetup.java index 732e0d721..5e4ec99aa 100644 --- a/src/java/org/apache/fop/render/awt/FontSetup.java +++ b/src/java/org/apache/fop/render/awt/FontSetup.java @@ -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); } } diff --git a/src/java/org/apache/fop/render/pdf/FontSetup.java b/src/java/org/apache/fop/render/pdf/FontSetup.java index b00e924fc..7687328d9 100644 --- a/src/java/org/apache/fop/render/pdf/FontSetup.java +++ b/src/java/org/apache/fop/render/pdf/FontSetup.java @@ -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()) { diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 3fd9a224c..2850be8c6 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -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 @@ -42,12 +42,12 @@ * (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); diff --git a/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java b/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java index f58d71da6..2a627bf78 100644 --- a/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java +++ b/src/java/org/apache/fop/render/pdf/PDFXMLHandler.java @@ -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 @@ -42,12 +42,12 @@ * (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; diff --git a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java index 7ab57905f..c48fe82aa 100644 --- a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java @@ -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; } diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2D.java b/src/java/org/apache/fop/render/ps/PSGraphics2D.java index e5d26327a..068d6272e 100644 --- a/src/java/org/apache/fop/render/ps/PSGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/PSGraphics2D.java @@ -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 @@ -42,12 +42,12 @@ * (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. diff --git a/src/java/org/apache/fop/render/ps/PSProcSets.java b/src/java/org/apache/fop/render/ps/PSProcSets.java index 870490446..dadfaae19 100644 --- a/src/java/org/apache/fop/render/ps/PSProcSets.java +++ b/src/java/org/apache/fop/render/ps/PSProcSets.java @@ -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"); diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java index 191f46ee3..180bb766f 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderer.java +++ b/src/java/org/apache/fop/render/ps/PSRenderer.java @@ -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 @@ -42,12 +42,12 @@ * (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); } - + } diff --git a/src/java/org/apache/fop/render/ps/PSTextElementBridge.java b/src/java/org/apache/fop/render/ps/PSTextElementBridge.java index e7bc31fe8..d2db5233a 100644 --- a/src/java/org/apache/fop/render/ps/PSTextElementBridge.java +++ b/src/java/org/apache/fop/render/ps/PSTextElementBridge.java @@ -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 @@ -42,12 +42,12 @@ * (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 <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()) { diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index d24bedb0a..f357fa283 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -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 { diff --git a/src/java/org/apache/fop/render/ps/PSTranscoder.java b/src/java/org/apache/fop/render/ps/PSTranscoder.java index ff23dc6eb..d5be860d3 100644 --- a/src/java/org/apache/fop/render/ps/PSTranscoder.java +++ b/src/java/org/apache/fop/render/ps/PSTranscoder.java @@ -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 @@ -42,12 +42,12 @@ * (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(); diff --git a/src/java/org/apache/fop/render/ps/PSXMLHandler.java b/src/java/org/apache/fop/render/ps/PSXMLHandler.java index 3b4ddcdd1..524d05cfa 100644 --- a/src/java/org/apache/fop/render/ps/PSXMLHandler.java +++ b/src/java/org/apache/fop/render/ps/PSXMLHandler.java @@ -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 @@ -42,12 +42,12 @@ * (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 ---"); diff --git a/src/java/org/apache/fop/render/svg/SVGRenderer.java b/src/java/org/apache/fop/render/svg/SVGRenderer.java index 9936087c5..4007821f2 100644 --- a/src/java/org/apache/fop/render/svg/SVGRenderer.java +++ b/src/java/org/apache/fop/render/svg/SVGRenderer.java @@ -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 @@ -42,12 +42,12 @@ * (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)) { diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index 238dda6c1..f6d37d587 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -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 @@ -42,12 +42,12 @@ * (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); } diff --git a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java index f952eb4dc..0d9933973 100644 --- a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java +++ b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java @@ -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; } diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java index 58d33264d..458c58e03 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -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; } diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 915a364bc..94329d619 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -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 @@ -42,12 +42,12 @@ * (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); diff --git a/src/java/org/apache/fop/svg/PDFTextElementBridge.java b/src/java/org/apache/fop/svg/PDFTextElementBridge.java index 664324a2b..1f7eaaa5d 100644 --- a/src/java/org/apache/fop/svg/PDFTextElementBridge.java +++ b/src/java/org/apache/fop/svg/PDFTextElementBridge.java @@ -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 @@ -42,12 +42,12 @@ * (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 <text> element. * @param fi the font infomration */ - public PDFTextElementBridge(FontInfo fi) { + public PDFTextElementBridge(Document fi) { pdfTextPainter = new PDFTextPainter(fi); } diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/java/org/apache/fop/svg/PDFTextPainter.java index 2c01034b3..a3645d2e3 100644 --- a/src/java/org/apache/fop/svg/PDFTextPainter.java +++ b/src/java/org/apache/fop/svg/PDFTextPainter.java @@ -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 { diff --git a/src/java/org/apache/fop/svg/PDFTranscoder.java b/src/java/org/apache/fop/svg/PDFTranscoder.java index 8ccc05a45..6b69c659b 100644 --- a/src/java/org/apache/fop/svg/PDFTranscoder.java +++ b/src/java/org/apache/fop/svg/PDFTranscoder.java @@ -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 @@ -42,12 +42,12 @@ * (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(); - + } /** diff --git a/src/java/org/apache/fop/tools/AreaTreeBuilder.java b/src/java/org/apache/fop/tools/AreaTreeBuilder.java index c2f463dfa..5f06e5bf0 100644 --- a/src/java/org/apache/fop/tools/AreaTreeBuilder.java +++ b/src/java/org/apache/fop/tools/AreaTreeBuilder.java @@ -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 @@ -42,12 +42,12 @@ * (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(); |