gmazza 2004/04/23 23:08:13 Modified: src/java/org/apache/fop/render/ps AbstractPSDocumentGraphics2D.java AbstractPSTranscoder.java EPSDocumentGraphics2D.java PSDocumentGraphics2D.java PSGraphics2D.java PSTextPainter.java PSXMLHandler.java Log: More apps.Document->fonts.FontInfo conversion. Revision Changes Path 1.6 +5 -13 xml-fop/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java Index: AbstractPSDocumentGraphics2D.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- AbstractPSDocumentGraphics2D.java 22 Apr 2004 21:38:40 -0000 1.5 +++ AbstractPSDocumentGraphics2D.java 24 Apr 2004 06:08:13 -0000 1.6 @@ -26,7 +26,7 @@ import java.io.IOException; //FOP -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontSetup; /** @@ -68,8 +68,8 @@ super(textAsShapes); if (!textAsShapes) { - this.document = new Document(null); - FontSetup.setup(this.document.getFontInfo(), null); + fontInfo = new FontInfo(); + FontSetup.setup(fontInfo, null); } } @@ -113,14 +113,6 @@ int width, int height) throws IOException { this(textAsShapes); setupDocument(stream, width, height); - } - - /** - * Get the context document. - * @return the context document - */ - public Document getDocument() { - return this.document; } /** 1.5 +3 -3 xml-fop/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java Index: AbstractPSTranscoder.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AbstractPSTranscoder.java 31 Mar 2004 10:55:07 -0000 1.4 +++ AbstractPSTranscoder.java 24 Apr 2004 06:08:13 -0000 1.5 @@ -84,7 +84,7 @@ }*/ BridgeContext ctx = new BridgeContext(userAgent); - PSTextPainter textPainter = new PSTextPainter(graphics.getDocument()); + PSTextPainter textPainter = new PSTextPainter(graphics.getFontInfo()); ctx.setTextPainter(textPainter); ctx.putBridge(new PSTextElementBridge(textPainter)); 1.5 +5 -5 xml-fop/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java Index: EPSDocumentGraphics2D.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- EPSDocumentGraphics2D.java 22 Apr 2004 21:38:40 -0000 1.4 +++ EPSDocumentGraphics2D.java 24 Apr 2004 06:08:13 -0000 1.5 @@ -69,8 +69,8 @@ gen.writeDSCComment(DSCConstants.BEGIN_PROLOG); PSProcSets.writeFOPStdProcSet(gen); PSProcSets.writeFOPEPSProcSet(gen); - if (document != null) { - PSProcSets.writeFontDict(gen, document.getFontInfo()); + if (fontInfo != null) { + PSProcSets.writeFontDict(gen, fontInfo); } gen.writeDSCComment(DSCConstants.END_PROLOG); } @@ -82,7 +82,7 @@ gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] {ZERO, ZERO, new Integer(width), new Integer(height)}); gen.writeDSCComment(DSCConstants.BEGIN_PAGE_SETUP); - if (this.document != null) { + if (fontInfo != null) { gen.writeln("FOPFonts begin"); } } 1.13 +6 -6 xml-fop/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java Index: PSDocumentGraphics2D.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- PSDocumentGraphics2D.java 22 Apr 2004 21:38:40 -0000 1.12 +++ PSDocumentGraphics2D.java 24 Apr 2004 06:08:13 -0000 1.13 @@ -24,8 +24,8 @@ import java.io.IOException; //FOP -import org.apache.fop.apps.Document; import org.apache.fop.apps.Version; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontSetup; /** @@ -56,8 +56,8 @@ super(textAsShapes); if (!textAsShapes) { - this.document = new Document(null); - FontSetup.setup(this.document.getFontInfo(), null); + fontInfo = new FontInfo(); + FontSetup.setup(fontInfo, null); } } @@ -113,8 +113,8 @@ gen.writeDSCComment(DSCConstants.BEGIN_SETUP); PSProcSets.writeFOPStdProcSet(gen); PSProcSets.writeFOPEPSProcSet(gen); - if (document != null) { - PSProcSets.writeFontDict(gen, document.getFontInfo()); + if (fontInfo != null) { + PSProcSets.writeFontDict(gen, fontInfo); } gen.writeDSCComment(DSCConstants.END_SETUP); } @@ -130,7 +130,7 @@ gen.writeln("/PageSize [" + width + " " + height + "]"); gen.writeln("/ImagingBBox null"); gen.writeln(">> setpagedevice"); - if (this.document != null) { + if (fontInfo != null) { gen.writeln("FOPFonts begin"); } } 1.10 +14 -8 xml-fop/src/java/org/apache/fop/render/ps/PSGraphics2D.java Index: PSGraphics2D.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSGraphics2D.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- PSGraphics2D.java 22 Apr 2004 21:38:40 -0000 1.9 +++ PSGraphics2D.java 24 Apr 2004 06:08:13 -0000 1.10 @@ -60,8 +60,8 @@ //FOP import org.apache.fop.fonts.Font; +import org.apache.fop.fonts.FontInfo; import org.apache.fop.image.FopImage; -import org.apache.fop.apps.Document; /** * This concrete implementation of <tt>AbstractGraphics2D</tt> is a @@ -103,7 +103,7 @@ protected Color currentColour = new Color(0, 0, 0); /** FontInfo containing all available fonts */ - protected Document document; + protected FontInfo fontInfo; /** * Create a new Graphics2D that generates PostScript code. @@ -160,6 +160,14 @@ } /** + * Return the font information associated with this object + * @return the FontInfo object + */ + public FontInfo getFontInfo() { + return fontInfo; + } + + /** * Central handler for IOExceptions for this class. * @param ioe IOException to handle */ @@ -454,7 +462,7 @@ this.gen = null; this.font = null; this.currentColour = null; - this.document = null; + this.fontInfo = null; } /** @@ -873,13 +881,11 @@ String style = f.isItalic() ? "italic" : "normal"; int weight = f.isBold() ? Font.BOLD : Font.NORMAL; - String fontKey = this.document.getFontInfo().findAdjustWeight(fontFamily, style, weight); + String fontKey = fontInfo.findAdjustWeight(fontFamily, style, weight); if (fontKey == null) { - fontKey = this.document.getFontInfo().findAdjustWeight("sans-serif", style, weight); + fontKey = fontInfo.findAdjustWeight("sans-serif", style, weight); } - return new Font(fontKey, - this.document.getFontInfo().getMetricsFor(fontKey), - fontSize); + return new Font(fontKey, fontInfo.getMetricsFor(fontKey), fontSize); } private void establishCurrentFont() throws IOException { 1.14 +10 -10 xml-fop/src/java/org/apache/fop/render/ps/PSTextPainter.java Index: PSTextPainter.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSTextPainter.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- PSTextPainter.java 22 Apr 2004 21:38:40 -0000 1.13 +++ PSTextPainter.java 24 Apr 2004 06:08:13 -0000 1.14 @@ -47,7 +47,7 @@ import org.apache.fop.fonts.FontMetrics; import org.apache.fop.fonts.Font; -import org.apache.fop.apps.Document; +import org.apache.fop.fonts.FontInfo; /** * Renders the attributed character iterator of a <tt>TextNode</tt>. @@ -69,7 +69,7 @@ /** the logger for this class */ protected Log log = LogFactory.getLog(PSTextPainter.class); - private Document document; + private FontInfo fontInfo; /** * Use the stroking text painter to get the bounds and shape. @@ -80,10 +80,10 @@ /** * Create a new PS text painter with the given font information. - * @param document the context document + * @param fontInfo the FontInfo object */ - public PSTextPainter(Document document) { - this.document = document; + public PSTextPainter(FontInfo fontInfo) { + this.fontInfo = fontInfo; } /** @@ -386,18 +386,18 @@ return; }*/ fontFamily = fam.getFamilyName(); - if (document.getFontInfo().hasFont(fontFamily, style, weight)) { - String fname = document.getFontInfo().fontLookup( + if (fontInfo.hasFont(fontFamily, style, weight)) { + String fname = fontInfo.fontLookup( fontFamily, style, weight); - FontMetrics metrics = document.getFontInfo().getMetricsFor(fname); + FontMetrics metrics = fontInfo.getMetricsFor(fname); int fsize = (int)(fontSize.floatValue() * 1000); return new Font(fname, metrics, fsize); } } } - String fname = document.getFontInfo().fontLookup( + String fname = fontInfo.fontLookup( "any", style, Font.NORMAL); - FontMetrics metrics = document.getFontInfo().getMetricsFor(fname); + FontMetrics metrics = fontInfo.getMetricsFor(fname); int fsize = (int)(fontSize.floatValue() * 1000); return new Font(fname, metrics, fsize); } 1.13 +5 -4 xml-fop/src/java/org/apache/fop/render/ps/PSXMLHandler.java Index: PSXMLHandler.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/ps/PSXMLHandler.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- PSXMLHandler.java 21 Mar 2004 12:38:56 -0000 1.12 +++ PSXMLHandler.java 24 Apr 2004 06:08:13 -0000 1.13 @@ -34,6 +34,7 @@ import org.apache.batik.bridge.ViewBox; import org.apache.batik.gvt.GraphicsNode; // FOP +import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.XMLHandler; import org.apache.fop.render.RendererContext; import org.apache.fop.svg.SVGUserAgent; @@ -116,7 +117,7 @@ public static PSInfo getPSInfo(RendererContext context) { PSInfo psi = new PSInfo(); psi.psGenerator = (PSGenerator)context.getProperty(PS_GENERATOR); - psi.fontInfo = (org.apache.fop.apps.Document)context.getProperty(PS_FONT_INFO); + psi.fontInfo = (org.apache.fop.fonts.FontInfo) 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(); @@ -132,7 +133,7 @@ /** see PS_GENERATOR */ private PSGenerator psGenerator; /** see PS_FONT_INFO */ - private org.apache.fop.apps.Document fontInfo; + private org.apache.fop.fonts.FontInfo fontInfo; /** see PS_PAGE_WIDTH */ private int width; /** see PS_PAGE_HEIGHT */ @@ -161,7 +162,7 @@ * Returns the fontInfo. * @return FontInfo */ - public org.apache.fop.apps.Document getFontInfo() { + public FontInfo getFontInfo() { return fontInfo; } @@ -169,7 +170,7 @@ * Sets the fontInfo. * @param fontInfo The fontInfo to set */ - public void setFontInfo(org.apache.fop.apps.Document fontInfo) { + public void setFontInfo(FontInfo fontInfo) { this.fontInfo = fontInfo; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]