aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/ps
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-04-24 06:08:13 +0000
committerGlen Mazza <gmazza@apache.org>2004-04-24 06:08:13 +0000
commitd3952e1a023863c747e3459be616153865174d56 (patch)
tree81f5c7dbe1443aa4e9c394337cfc99a279f50325 /src/java/org/apache/fop/render/ps
parent6720d9487f23b844a1d336d46b21162260e69a5f (diff)
downloadxmlgraphics-fop-d3952e1a023863c747e3459be616153865174d56.tar.gz
xmlgraphics-fop-d3952e1a023863c747e3459be616153865174d56.zip
More apps.Document->fonts.FontInfo conversion.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197535 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/ps')
-rw-r--r--src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java14
-rw-r--r--src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java2
-rw-r--r--src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java6
-rw-r--r--src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java12
-rw-r--r--src/java/org/apache/fop/render/ps/PSGraphics2D.java22
-rw-r--r--src/java/org/apache/fop/render/ps/PSTextPainter.java20
-rw-r--r--src/java/org/apache/fop/render/ps/PSXMLHandler.java9
7 files changed, 42 insertions, 43 deletions
diff --git a/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java
index f8ffd9938..4d447dba6 100644
--- a/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java
@@ -26,7 +26,7 @@ import java.io.OutputStream;
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 @@ public abstract class AbstractPSDocumentGraphics2D extends PSGraphics2D {
super(textAsShapes);
if (!textAsShapes) {
- this.document = new Document(null);
- FontSetup.setup(this.document.getFontInfo(), null);
+ fontInfo = new FontInfo();
+ FontSetup.setup(fontInfo, null);
}
}
@@ -116,14 +116,6 @@ public abstract class AbstractPSDocumentGraphics2D extends PSGraphics2D {
}
/**
- * Get the context document.
- * @return the context document
- */
- public Document getDocument() {
- return this.document;
- }
-
- /**
* Set the dimensions of the SVG document that will be drawn.
* This is useful if the dimensions of the SVG document are different
* from the PostScript document that is to be created.
diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
index 567197606..68afbba3c 100644
--- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
+++ b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
@@ -84,7 +84,7 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder {
}*/
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));
diff --git a/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java
index 73f7b3fac..c52f5ef8d 100644
--- a/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java
@@ -69,8 +69,8 @@ public class EPSDocumentGraphics2D extends AbstractPSDocumentGraphics2D {
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 @@ public class EPSDocumentGraphics2D extends AbstractPSDocumentGraphics2D {
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");
}
}
diff --git a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java
index 73da1b243..29e85603e 100644
--- a/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java
@@ -24,8 +24,8 @@ import java.io.OutputStream;
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 @@ public class PSDocumentGraphics2D extends AbstractPSDocumentGraphics2D {
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 @@ public class PSDocumentGraphics2D extends AbstractPSDocumentGraphics2D {
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 @@ public class PSDocumentGraphics2D extends AbstractPSDocumentGraphics2D {
gen.writeln("/PageSize [" + width + " " + height + "]");
gen.writeln("/ImagingBBox null");
gen.writeln(">> setpagedevice");
- if (this.document != null) {
+ if (fontInfo != null) {
gen.writeln("FOPFonts begin");
}
}
diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2D.java b/src/java/org/apache/fop/render/ps/PSGraphics2D.java
index 587cf2acf..039f3d483 100644
--- a/src/java/org/apache/fop/render/ps/PSGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/PSGraphics2D.java
@@ -60,8 +60,8 @@ import org.apache.commons.logging.LogFactory;
//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 @@ public class PSGraphics2D extends AbstractGraphics2D {
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 @@ public class PSGraphics2D extends AbstractGraphics2D {
}
/**
+ * 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 @@ public class PSGraphics2D extends AbstractGraphics2D {
this.gen = null;
this.font = null;
this.currentColour = null;
- this.document = null;
+ this.fontInfo = null;
}
/**
@@ -873,13 +881,11 @@ public class PSGraphics2D extends AbstractGraphics2D {
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 {
diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java
index 89cb0cfae..10ac6a781 100644
--- a/src/java/org/apache/fop/render/ps/PSTextPainter.java
+++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java
@@ -47,7 +47,7 @@ import org.apache.commons.logging.LogFactory;
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 @@ public class PSTextPainter implements TextPainter {
/** 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 @@ public class PSTextPainter implements TextPainter {
/**
* 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 @@ public class PSTextPainter implements TextPainter {
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);
}
diff --git a/src/java/org/apache/fop/render/ps/PSXMLHandler.java b/src/java/org/apache/fop/render/ps/PSXMLHandler.java
index 522ef0b79..671a78dab 100644
--- a/src/java/org/apache/fop/render/ps/PSXMLHandler.java
+++ b/src/java/org/apache/fop/render/ps/PSXMLHandler.java
@@ -34,6 +34,7 @@ import org.apache.batik.bridge.BridgeContext;
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 class PSXMLHandler implements XMLHandler {
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 @@ public class PSXMLHandler implements XMLHandler {
/** 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 @@ public class PSXMLHandler implements XMLHandler {
* Returns the fontInfo.
* @return FontInfo
*/
- public org.apache.fop.apps.Document getFontInfo() {
+ public FontInfo getFontInfo() {
return fontInfo;
}
@@ -169,7 +170,7 @@ public class PSXMLHandler implements XMLHandler {
* 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;
}