Browse Source

Flailing about with the requirements for Java 2D layout


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197617 13f79535-47bb-0310-9956-ffa450edef68
tags/Defoe_export
Peter Bernard West 20 years ago
parent
commit
5ef950add6

+ 0
- 11
src/java/org/apache/fop/fo/FONode.java View File

@@ -18,7 +18,6 @@
*/
package org.apache.fop.fo;

import java.awt.GraphicsEnvironment;
import java.awt.geom.Rectangle2D;
import java.util.BitSet;
import java.util.HashMap;
@@ -191,10 +190,6 @@ 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 <tt>FOTree</tt> to which this node belongs
* @param type the fo type of this FONode.
@@ -230,12 +225,6 @@ 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();
}

+ 36
- 10
src/java/org/apache/fop/fo/FOTree.java View File

@@ -18,6 +18,9 @@
*/
package org.apache.fop.fo;

import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.font.FontRenderContext;
import java.util.logging.Level;
import java.util.logging.Logger;

@@ -92,17 +95,40 @@ public class FOTree extends Tree implements Runnable {
PropertyConsts.pconsts.getInitialValue(PropNames.FONT_SIZE);
if ( ! (prop instanceof Numeric) || ! ((Numeric)prop).isLength())
throw new PropertyException("Initial font-size is not a Length");
// Set up the rendering context
}


/*
for (int i = 1; i <= PropNames.LAST_PROPERTY_INDEX; i++) {
if (i == PropNames.FONT_SIZE) continue;
// Set up the initial values for each property
PropertyConsts.pconsts.getInitialValue(i);
//System.out.println("....Setting initial value for " + i);
}
*/

/** The graphics environment in which FOP is operating */
private GraphicsEnvironment gEnv = null;
/**
* Gets the FOP <code>GraphicsEnvironment</code>
* @return the environment
*/
protected GraphicsEnvironment getGraphicsEnvironment() {
return gEnv;
}
/** The object which controls drawing and text rendering in the page spread
*/
private Graphics2D g2D = null;
/**
* Gets the <code>Graphics2D</code> rendering and drawing control object
* for area layout
* @return
*/
public Graphics2D getGraphics2D() {
return g2D;
}
/** The <code>FontRenderContext</code> object garnered from the
* <code>Graphics2D</code> control object for area layout
*/
private FontRenderContext frcontext = null;
/**
* Gets the <code>FontRenderContext</code> derived from the graphics
* control object
* @return
*/
public FontRenderContext getFontRenderContext() {
return frcontext;
}

/**

+ 12
- 23
src/java/org/apache/fop/fo/flow/FoPageSequence.java View File

@@ -20,10 +20,6 @@

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;
@@ -186,6 +182,18 @@ public class FoPageSequence extends FONode {
}
return (Page)firstPage;
}

/** An image on which to draw areas */
private BufferedImage pageSpread = null;
/**
* Gets the page spread image from which the <code>Graphics2D</code> and
* <code>FontRenderContext</code> have been derived.
* @return the page spread
*/
public BufferedImage getPageSpread() {
return pageSpread;
}

/**
* @param foTree the FO tree being built
* @param parent the parent FONode of this node
@@ -202,8 +210,6 @@ public class FoPageSequence extends FONode {
// 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
@@ -303,23 +309,6 @@ 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

+ 4
- 2
src/java/org/apache/fop/fo/flow/FoPcdata.java View File

@@ -147,10 +147,12 @@ public class FoPcdata extends FOPageSeqNode {
// parent block area.
// Generate a text-layout for the PCDATA.
/**
* Generate a
* Generates a TextMeasurer from the PCDATA text. The font and text
* attributes of the text are applied.
*/
private void processText() {
// Get the font
//
}

}

Loading…
Cancel
Save