*/
protected int currentIPPosition = 0;
- /**
- * current inline progression position in block
- */
- protected int currentBlockIPPosition = 0;
-
/**
* the block progression position of the containing block used for
* absolutely positioned blocks
// set origin for the region to 0,0.
currentBPPosition = 0;
currentIPPosition = 0;
- currentBlockIPPosition = currentIPPosition;
RegionReference region = port.getRegion();
handleRegionTraits(port);
* @param blocks The block areas
*/
protected void renderBlocks(Block parent, List blocks) {
+ int saveIP = currentIPPosition;
+
// the position of the containing block is used for
// absolutely positioned areas
int contBP = currentBPPosition;
for (int count = 0; count < blocks.size(); count++) {
Object obj = blocks.get(count);
if (obj instanceof Block) {
+ currentIPPosition = saveIP;
containingBPPosition = contBP;
containingIPPosition = contIP;
renderBlock((Block) obj);
// a line area is rendered from the top left position
// of the line, each inline object is offset from there
LineArea line = (LineArea) obj;
- currentBlockIPPosition =
- currentIPPosition + line.getStartIndent();
+ currentIPPosition = saveIP + line.getStartIndent();
renderLineArea(line);
currentBPPosition += line.getAllocBPD();
}
+ currentIPPosition = saveIP;
}
}
renderBlocks(block, children);
// stacked and relative blocks effect stacking
+ currentIPPosition = saveIP;
currentBPPosition = saveBP + block.getAllocBPD();
}
- currentIPPosition = saveIP;
}
}
/** @see org.apache.fop.render.Renderer */
protected void renderCharacter(Character ch) {
- currentBlockIPPosition += ch.getAllocIPD();
+ currentIPPosition += ch.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
// for the current block by the width or height of the space
// it may also have styling (only on this object) that needs
// handling
- currentBlockIPPosition += space.getAllocIPD();
+ currentIPPosition += space.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
protected void renderLeader(Leader area) {
- currentBlockIPPosition += area.getAllocIPD();
+ currentIPPosition += area.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
protected void renderText(TextArea text) {
- currentBlockIPPosition += text.getAllocIPD();
+ currentIPPosition += text.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
protected void renderInlineParent(InlineParent ip) {
- int saveIP = currentBlockIPPosition;
+ int saveIP = currentIPPosition;
Iterator iter = ip.getChildAreas().iterator();
while (iter.hasNext()) {
renderInlineArea((InlineArea) iter.next());
}
- currentBlockIPPosition = saveIP + ip.getAllocIPD();
+ currentIPPosition = saveIP + ip.getAllocIPD();
}
/** @see org.apache.fop.render.Renderer */
} else if (content instanceof ForeignObject) {
renderForeignObject((ForeignObject) content, contpos);
}
- currentBlockIPPosition += viewport.getAllocIPD();
+ currentIPPosition += viewport.getAllocIPD();
currentBPPosition = saveBP;
}
/** @see org.apache.fop.render.Renderer */
public void renderContainer(Container cont) {
int saveIP = currentIPPosition;
- currentIPPosition = currentBlockIPPosition;
- int saveBlockIP = currentBlockIPPosition;
int saveBP = currentBPPosition;
List blocks = cont.getBlocks();
renderBlocks(null, blocks);
currentIPPosition = saveIP;
- currentBlockIPPosition = saveBlockIP;
currentBPPosition = saveBP;
}
graphics.setFont(new java.awt.Font("monospaced", java.awt.Font.PLAIN,
10));
- int rx = currentBlockIPPosition;
+ int rx = currentIPPosition;
int bl = currentBPPosition + text.getOffset();
int newx = (int) (rx + 500) / 1000;
graphics.drawString(s, 220, 200);
// TODO: render text decorations
- currentBlockIPPosition += text.getAllocIPD();
+ currentIPPosition += text.getAllocIPD();
}
/** @see org.apache.fop.render.AbstractRenderer */
* @param ip the inline parent area
*/
public void renderInlineParent(InlineParent ip) {
- float start = (currentBlockIPPosition + ipMarginOffset) / 1000f;
+ float start = (currentIPPosition + ipMarginOffset) / 1000f;
float top = (ip.getOffset() + currentBPPosition + bpMarginOffset) / 1000f;
float width = ip.getIPD() / 1000f;
float height = ip.getBPD() / 1000f;
// word.getOffset() = only height of text itself
// currentBlockIPPosition: 0 for beginning of line; nonzero
// where previous line area failed to take up entire allocated space
- int rx = currentBlockIPPosition + ipMarginOffset;
+ int rx = currentIPPosition + ipMarginOffset;
int bl = currentBPPosition + bpMarginOffset + ch.getOffset();
/* System.out.println("Text = " + ch.getTextArea() +
// word.getOffset() = only height of text itself
// currentBlockIPPosition: 0 for beginning of line; nonzero
// where previous line area failed to take up entire allocated space
- int rx = currentBlockIPPosition + ipMarginOffset;
+ int rx = currentIPPosition + ipMarginOffset;
int bl = currentBPPosition + bpMarginOffset + text.getOffset();
/* System.out.println("Text = " + text.getTextArea() +
saveGraphicsState();
currentStream.add(((float) w) + " 0 0 "
+ ((float) -h) + " "
- + (((float) currentBlockIPPosition + ipMarginOffset) / 1000f + x) + " "
+ + (((float) currentIPPosition + ipMarginOffset) / 1000f + x) + " "
+ (((float)(currentBPPosition + bpMarginOffset + 1000 * h)) / 1000f
+ y) + " cm\n" + "/Im" + xobj + " Do\n");
restoreGraphicsState();
context.setProperty(PDFXMLHandler.PDF_CONTEXT, currentContext);
context.setProperty(PDFXMLHandler.PDF_STREAM, currentStream);
context.setProperty(PDFXMLHandler.PDF_XPOS,
- new Integer(currentBlockIPPosition + (int) pos.getX()));
+ new Integer(currentIPPosition + (int) pos.getX()));
context.setProperty(PDFXMLHandler.PDF_YPOS,
new Integer(currentBPPosition + (int) pos.getY()));
context.setProperty(PDFXMLHandler.PDF_FONT_INFO, fontInfo);
public void renderViewport(Viewport viewport) {
closeText();
- float x = currentBlockIPPosition / 1000f;
+ float x = currentIPPosition / 1000f;
float y = (currentBPPosition + viewport.getOffset()) / 1000f;
float width = viewport.getIPD() / 1000f;
float height = viewport.getBPD() / 1000f;
alt = true;
break;
}
- float startx = ((float) currentBlockIPPosition) / 1000f;
+ float startx = ((float) currentIPPosition) / 1000f;
float starty = ((currentBPPosition + area.getOffset()) / 1000f);
- float endx = (currentBlockIPPosition + area.getIPD()) / 1000f;
+ float endx = (currentIPPosition + area.getIPD()) / 1000f;
if (!alt) {
currentStream.add(area.getRuleThickness() / 1000f + " w\n");
drawLine(startx, starty, endx, starty);
Typeface f = (Typeface) fontInfo.getFonts().get(fontname);
//Determine position
- int rx = currentBlockIPPosition;
+ int rx = currentIPPosition;
int bl = currentBPPosition + area.getOffset();
useFont(fontname, fontsize);
context.setProperty(PSXMLHandler.PS_HEIGHT,
new Integer((int) pos.getHeight()));
context.setProperty(PSXMLHandler.PS_XPOS,
- new Integer(currentBlockIPPosition + (int) pos.getX()));
+ new Integer(currentIPPosition + (int) pos.getX()));
context.setProperty(PSXMLHandler.PS_YPOS,
new Integer(currentBPPosition + (int) pos.getY()));
//context.setProperty("strokeSVGText", options.get("strokeSVGText"));
Element view = svgDocument.createElementNS(SVG_NAMESPACE, "svg");
Node newsvg = svgDocument.importNode(svg, true);
//view.setAttributeNS(null, "viewBox", "0 0 ");
- view.setAttributeNS(null, "x",
- "" + currentBlockIPPosition / 1000f);
+ view.setAttributeNS(null, "x", "" + currentIPPosition / 1000f);
view.setAttributeNS(null, "y", "" + currentBPPosition / 1000f);
// this fixes a problem where the xmlns is repeated sometimes
break;
}
Element line = SVGUtilities.createLine(svgDocument,
- currentBlockIPPosition / 1000,
+ currentIPPosition / 1000,
(currentBPPosition + area.getOffset()
- area.getRuleThickness() / 2) / 1000,
- (currentBlockIPPosition + area.getIPD()) / 1000,
+ (currentIPPosition + area.getIPD()) / 1000,
(currentBPPosition + area.getOffset()
- area.getRuleThickness() / 2) / 1000);
line.setAttributeNS(null, "style", style);
*/
public void renderText(TextArea text) {
Element textElement = SVGUtilities.createText(svgDocument,
- currentBlockIPPosition / 1000,
+ currentIPPosition / 1000,
(currentBPPosition + text.getOffset()) / 1000,
text.getTextArea());
currentPageG.appendChild(textElement);
*/
public void renderCharacter(org.apache.fop.area.inline.Character ch) {
Element text = SVGUtilities.createText(svgDocument,
- currentBlockIPPosition / 1000,
+ currentIPPosition / 1000,
(currentBPPosition + ch.getOffset()) / 1000,
"" + ch.getChar());
currentPageG.appendChild(text);