import java.io.IOException;
//FOP
-import org.apache.fop.apps.Document;
+import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontSetup;
/**
super(textAsShapes);
if (!textAsShapes) {
- this.document = new Document(null);
- FontSetup.setup(this.document.getFontInfo(), null);
+ fontInfo = new FontInfo();
+ FontSetup.setup(fontInfo, null);
}
}
setupDocument(stream, width, height);
}
- /**
- * 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
}*/
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));
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);
}
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");
}
}
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;
/**
super(textAsShapes);
if (!textAsShapes) {
- this.document = new Document(null);
- FontSetup.setup(this.document.getFontInfo(), null);
+ fontInfo = new FontInfo();
+ FontSetup.setup(fontInfo, null);
}
}
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);
}
gen.writeln("/PageSize [" + width + " " + height + "]");
gen.writeln("/ImagingBBox null");
gen.writeln(">> setpagedevice");
- if (this.document != null) {
+ if (fontInfo != null) {
gen.writeln("FOPFonts begin");
}
}
//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
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.
return new PSGraphics2D(this);
}
+ /**
+ * 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
this.gen = null;
this.font = null;
this.currentColour = null;
- this.document = null;
+ this.fontInfo = null;
}
/**
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 {
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>.
/** 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.
/**
* 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;
}
/**
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);
}
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;
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();
/** 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 */
* Returns the fontInfo.
* @return FontInfo
*/
- public org.apache.fop.apps.Document getFontInfo() {
+ public FontInfo getFontInfo() {
return fontInfo;
}
* 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;
}