diff options
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r-- | src/java/org/apache/fop/render/AbstractRenderer.java | 33 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pdf/PDFRenderer.java | 12 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/xml/XMLRenderer.java | 29 |
3 files changed, 52 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 5a08e6082..4153c8547 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -52,6 +52,7 @@ import org.apache.fop.area.inline.Container; import org.apache.fop.area.inline.ForeignObject; import org.apache.fop.area.inline.Image; import org.apache.fop.area.inline.InlineArea; +import org.apache.fop.area.inline.InlineBlockParent; import org.apache.fop.area.inline.InlineParent; import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.Space; @@ -116,22 +117,22 @@ public abstract class AbstractRenderer } /** - * @see org.apache.fop.render.Renderer + * @see org.apache.fop.render.Renderer#setupFontInfo(FontInfo) */ public abstract void setupFontInfo(FontInfo fontInfo); /** - * @see org.apache.fop.render.Renderer + * @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent) */ public void setUserAgent(FOUserAgent agent) { userAgent = agent; } - /** @see org.apache.fop.render.Renderer */ + /** @see org.apache.fop.render.Renderer#startRenderer(OutputStream) */ public void startRenderer(OutputStream outputStream) throws IOException { } - /** @see org.apache.fop.render.Renderer */ + /** @see org.apache.fop.render.Renderer#stopRenderer() */ public void stopRenderer() throws IOException { } @@ -148,7 +149,7 @@ public abstract class AbstractRenderer } /** - * @see org.apache.fop.render.Renderer + * @see org.apache.fop.render.Renderer#processOffDocumentItem(OffDocumentItem) */ public void processOffDocumentItem(OffDocumentItem oDI) { } @@ -159,7 +160,7 @@ public abstract class AbstractRenderer * page should not be rendered. The page will be rendered at a later time * by the call to render page. * - * @see org.apache.fop.render.Renderer + * @see org.apache.fop.render.Renderer#preparePage(PageViewport) */ public void preparePage(PageViewport page) { } @@ -196,14 +197,14 @@ public abstract class AbstractRenderer return sb.toString(); } - /** @see org.apache.fop.render.Renderer */ + /** @see org.apache.fop.render.Renderer#startPageSequence(LineArea) */ public void startPageSequence(LineArea seqTitle) { //do nothing } // normally this would be overriden to create a page in the // output - /** @see org.apache.fop.render.Renderer */ + /** @see org.apache.fop.render.Renderer#renderPage(PageViewport) */ public void renderPage(PageViewport page) throws IOException, FOPException { @@ -501,6 +502,7 @@ public abstract class AbstractRenderer + parent.getStartIndent() + line.getStartIndent(); renderLineArea(line); + //InlineArea child = (InlineArea) line.getInlineAreas().get(0); currentBPPosition += line.getAllocBPD(); } currentIPPosition = saveIP; @@ -584,6 +586,8 @@ public abstract class AbstractRenderer renderText((TextArea) inlineArea); } else if (inlineArea instanceof InlineParent) { renderInlineParent((InlineParent) inlineArea); + } else if (inlineArea instanceof InlineBlockParent) { + renderInlineBlockParent((InlineBlockParent) inlineArea); } else if (inlineArea instanceof Space) { renderInlineSpace((Space) inlineArea); } else if (inlineArea instanceof Character) { @@ -596,12 +600,10 @@ public abstract class AbstractRenderer } - /** @see org.apache.fop.render.Renderer */ protected void renderCharacter(Character ch) { currentIPPosition += ch.getAllocIPD(); } - /** @see org.apache.fop.render.Renderer */ protected void renderInlineSpace(Space space) { // an inline space moves the inline progression position // for the current block by the width or height of the space @@ -610,17 +612,14 @@ public abstract class AbstractRenderer currentIPPosition += space.getAllocIPD(); } - /** @see org.apache.fop.render.Renderer */ protected void renderLeader(Leader area) { currentIPPosition += area.getAllocIPD(); } - /** @see org.apache.fop.render.Renderer */ protected void renderText(TextArea text) { currentIPPosition += text.getAllocIPD(); } - /** @see org.apache.fop.render.Renderer */ protected void renderInlineParent(InlineParent ip) { int saveIP = currentIPPosition; Iterator iter = ip.getChildAreas().iterator(); @@ -630,7 +629,13 @@ public abstract class AbstractRenderer currentIPPosition = saveIP + ip.getAllocIPD(); } - /** @see org.apache.fop.render.Renderer */ + protected void renderInlineBlockParent(InlineBlockParent ibp) { + // For inline content the BP position is updated by the enclosing line area + int saveBP = currentBPPosition; + renderBlock(ibp.getChildArea()); + currentBPPosition = saveBP; + } + protected void renderViewport(Viewport viewport) { Area content = viewport.getContent(); int saveBP = currentBPPosition; diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 16c6aeb78..aeb04e11c 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -51,6 +51,7 @@ import org.apache.fop.area.OffDocumentItem; import org.apache.fop.area.BookmarkData; import org.apache.fop.area.inline.Character; import org.apache.fop.area.inline.InlineArea; +import org.apache.fop.area.inline.InlineBlockParent; import org.apache.fop.area.inline.TextArea; import org.apache.fop.area.inline.Viewport; import org.apache.fop.area.inline.ForeignObject; @@ -1302,6 +1303,17 @@ public class PDFRenderer extends PrintRenderer { } } + /** @see org.apache.fop.render.AbstractRenderer */ + protected void renderInlineBlockParent(InlineBlockParent ibp) { + float start = currentIPPosition / 1000f; + float top = (ibp.getOffset() + currentBPPosition) / 1000f; + float width = ibp.getIPD() / 1000f; + float height = ibp.getBPD() / 1000f; + drawBackAndBorders(ibp, start, top, width, height); + + super.renderInlineBlockParent(ibp); + } + /** * @see org.apache.fop.render.Renderer#renderCharacter(Character) */ diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index 54e2e0673..30f95a8f4 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -60,6 +60,7 @@ import org.apache.fop.area.inline.Container; import org.apache.fop.area.inline.ForeignObject; import org.apache.fop.area.inline.Image; import org.apache.fop.area.inline.InlineArea; +import org.apache.fop.area.inline.InlineBlockParent; import org.apache.fop.area.inline.InlineParent; import org.apache.fop.area.inline.Leader; import org.apache.fop.area.inline.Space; @@ -513,13 +514,14 @@ public class XMLRenderer extends AbstractRenderer { atts.clear(); addAreaAttributes(line); addTraitAttributes(line); + addAttribute("vpos", currentBPPosition); startElement("lineArea", atts); super.renderLineArea(line); endElement("lineArea"); } /** - * @see org.apache.fop.render.Renderer#renderViewport(Viewport) + * @see org.apache.fop.render.AbstractRenderer#renderViewport(Viewport) */ protected void renderViewport(Viewport viewport) { atts.clear(); @@ -544,7 +546,7 @@ public class XMLRenderer extends AbstractRenderer { } /** - * @see org.apache.fop.render.Renderer#renderContainer(Container) + * @see org.apache.fop.render.AbstractRenderer#renderContainer(Container) */ public void renderContainer(Container cont) { startElement("container"); @@ -570,7 +572,7 @@ public class XMLRenderer extends AbstractRenderer { } /** - * @see org.apache.fop.render.Renderer#renderCharacter(Character) + * @see org.apache.fop.render.AbstractRenderer#renderCharacter(Character) */ protected void renderCharacter(org.apache.fop.area.inline.Character ch) { atts.clear(); @@ -582,7 +584,7 @@ public class XMLRenderer extends AbstractRenderer { } /** - * @see org.apache.fop.render.Renderer#renderInlineSpace(Space) + * @see org.apache.fop.render.AbstractRenderer#renderInlineSpace(Space) */ protected void renderInlineSpace(Space space) { atts.clear(); @@ -592,7 +594,7 @@ public class XMLRenderer extends AbstractRenderer { } /** - * @see org.apache.fop.render.Renderer#renderText(TextArea) + * @see org.apache.fop.render.AbstractRenderer#renderText(TextArea) */ protected void renderText(TextArea text) { atts.clear(); @@ -603,6 +605,7 @@ public class XMLRenderer extends AbstractRenderer { addAttribute("tlsadjust", text.getTextLetterSpaceAdjust()); } addAttribute("vpos", text.getOffset()); + addAreaAttributes(text); addTraitAttributes(text); startElement("text", atts); characters(text.getTextArea()); @@ -611,18 +614,28 @@ public class XMLRenderer extends AbstractRenderer { } /** - * @see org.apache.fop.render.Renderer#renderInlineParent(InlineParent) + * @see org.apache.fop.render.AbstractRenderer#renderInlineParent(InlineParent) */ protected void renderInlineParent(InlineParent ip) { atts.clear(); + addAreaAttributes(ip); addTraitAttributes(ip); startElement("inlineparent", atts); super.renderInlineParent(ip); endElement("inlineparent"); } + protected void renderInlineBlockParent(InlineBlockParent ibp) { + atts.clear(); + addAreaAttributes(ibp); + addTraitAttributes(ibp); + startElement("inlineblockparent", atts); + super.renderInlineBlockParent(ibp); + endElement("inlineblockparent"); + } + /** - * @see org.apache.fop.render.Renderer#renderLeader(Leader) + * @see org.apache.fop.render.AbstractRenderer#renderLeader(Leader) */ protected void renderLeader(Leader area) { String style = "solid"; @@ -656,7 +669,7 @@ public class XMLRenderer extends AbstractRenderer { super.renderLeader(area); } - /** @see org.apache.fop.render.AbstractRenderer */ + /** @see org.apache.fop.render.AbstractRenderer#getMimeType() */ public String getMimeType() { return XML_MIME_TYPE; } |