From: Peter Bernard West Date: Tue, 18 May 2004 23:05:27 +0000 (+0000) Subject: Layout W.I.P. X-Git-Tag: Defoe_export~155 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0beda864eeb87060d19bb5799a34e372c4c38fa2;p=xmlgraphics-fop.git Layout W.I.P. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197607 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index 70517d50c..d0aba6029 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -18,6 +18,7 @@ */ package org.apache.fop.fo; +import java.awt.GraphicsEnvironment; import java.awt.geom.Rectangle2D; import java.util.BitSet; import java.util.HashMap; @@ -190,6 +191,10 @@ public class FONode extends SyncedNode implements AreaListener { /** The number of markers on this FO. */ protected int numMarkers = 0; + private GraphicsEnvironment gEnv = null; + protected GraphicsEnvironment getGraphicsEnvironment() { + return gEnv; + } /** * @param foTree an FOTree to which this node belongs * @param type the fo type of this FONode. @@ -225,6 +230,12 @@ public class FONode extends SyncedNode implements AreaListener { exprParser = foTree.exprParser; propertySet = new PropertyValue[PropNames.LAST_PROPERTY_INDEX + 1]; foAttributes = new FOAttributes(event, this); + if (parent == null) { + // Setup the graphics environment + gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); + } else { + gEnv = parent.getGraphicsEnvironment(); + } if ((stateFlags & MC_MARKER) == 0) { processAttributes(); } diff --git a/src/java/org/apache/fop/fo/FoRoot.java b/src/java/org/apache/fop/fo/FoRoot.java index b797db403..ed3b42066 100644 --- a/src/java/org/apache/fop/fo/FoRoot.java +++ b/src/java/org/apache/fop/fo/FoRoot.java @@ -21,7 +21,6 @@ package org.apache.fop.fo; import java.util.Arrays; import java.util.NoSuchElementException; - import org.apache.fop.apps.FOPException; import org.apache.fop.area.Area; import org.apache.fop.datastructs.TreeException; diff --git a/src/java/org/apache/fop/fo/flow/FoPageSequence.java b/src/java/org/apache/fop/fo/flow/FoPageSequence.java index 44c1b356e..6a5040377 100644 --- a/src/java/org/apache/fop/fo/flow/FoPageSequence.java +++ b/src/java/org/apache/fop/fo/flow/FoPageSequence.java @@ -21,6 +21,10 @@ package org.apache.fop.fo.flow; // FOP +import java.awt.Graphics2D; +import java.awt.GraphicsEnvironment; +import java.awt.font.FontRenderContext; +import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; @@ -195,6 +199,12 @@ public class FoPageSequence extends FONode { { super(foTree, FObjectNames.PAGE_SEQUENCE, parent, event, FONode.PAGESEQ_SET, sparsePropsMap, sparseIndices); + // Set up the graphics environment + pageSpread = + new BufferedImage(20*72, 12*72, BufferedImage.TYPE_INT_RGB); + g2D = pageSpread.createGraphics(); + frcontext = g2D.getFontRenderContext(); + XmlEvent ev; // Look for optional title log.finer("page-sequence title"); @@ -293,6 +303,23 @@ public class FoPageSequence extends FONode { makeSparsePropsSet(); } + private GraphicsEnvironment gEnv = null; + public GraphicsEnvironment getGraphicsEnvironment() { + return gEnv; + } + private BufferedImage pageSpread = null; + public BufferedImage getPageSpread() { + return pageSpread; + } + private Graphics2D g2D = null; + public Graphics2D getGraphics2D() { + return g2D; + } + private FontRenderContext frcontext = null; + public FontRenderContext getFontRenderContext() { + return frcontext; + } + public Area getReferenceRectangle() throws FOPException { // TODO Reference rectangle is assumed to be equivalent to the // "auto" value on "page-height" and "page-width". The diff --git a/src/java/org/apache/fop/fo/flow/FoPcdata.java b/src/java/org/apache/fop/fo/flow/FoPcdata.java index 32788e394..1136a4a9c 100644 --- a/src/java/org/apache/fop/fo/flow/FoPcdata.java +++ b/src/java/org/apache/fop/fo/flow/FoPcdata.java @@ -143,4 +143,14 @@ public class FoPcdata extends FOPageSeqNode { return characters; } + // PCDATA provides sequences of inline-areas to fill line-areas in the + // parent block area. + // Generate a text-layout for the PCDATA. + /** + * Generate a + */ + private void processText() { + + } + } diff --git a/src/java/org/apache/fop/render/awt/FontTest.java b/src/java/org/apache/fop/render/awt/FontTest.java index 7ca83dbf1..115acb725 100644 --- a/src/java/org/apache/fop/render/awt/FontTest.java +++ b/src/java/org/apache/fop/render/awt/FontTest.java @@ -47,9 +47,10 @@ public class FontTest { GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = gEnv.getAllFonts(); String[] families = gEnv.getAvailableFontFamilyNames(); - BufferedImage fontImage = - new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); - Graphics2D g2D = fontImage.createGraphics(); + BufferedImage pageSpread = + new BufferedImage(20*72, 12*72, BufferedImage.TYPE_INT_RGB); + //Graphics2D g2D = fontImage.createGraphics(); + Graphics2D g2D = pageSpread.createGraphics(); FontRenderContext frc = g2D.getFontRenderContext(); }