Selaa lähdekoodia

More apps.Document->fonts.FontInfo conversion.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197535 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Glen Mazza 20 vuotta sitten
vanhempi
commit
d3952e1a02

+ 3
- 11
src/java/org/apache/fop/render/ps/AbstractPSDocumentGraphics2D.java Näytä tiedosto

@@ -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);
}
}

@@ -115,14 +115,6 @@ public abstract class AbstractPSDocumentGraphics2D extends PSGraphics2D {
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

+ 1
- 1
src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java Näytä tiedosto

@@ -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));


+ 3
- 3
src/java/org/apache/fop/render/ps/EPSDocumentGraphics2D.java Näytä tiedosto

@@ -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");
}
}

+ 6
- 6
src/java/org/apache/fop/render/ps/PSDocumentGraphics2D.java Näytä tiedosto

@@ -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");
}
}

+ 14
- 8
src/java/org/apache/fop/render/ps/PSGraphics2D.java Näytä tiedosto

@@ -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.
@@ -159,6 +159,14 @@ public class PSGraphics2D extends AbstractGraphics2D {
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
@@ -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 {

+ 10
- 10
src/java/org/apache/fop/render/ps/PSTextPainter.java Näytä tiedosto

@@ -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);
}

+ 5
- 4
src/java/org/apache/fop/render/ps/PSXMLHandler.java Näytä tiedosto

@@ -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;
}


Loading…
Peruuta
Tallenna