Browse Source

Reverted changes for "ptr" to painter interface as announced in #46705. The pointer value is now provided through the IFContext so only the implementations that support it have to deal with it.

Also, the method signature changes in the renderers are now reverted. They are not necessary.
Found a few other smaller omissions (IFRenderer, IFSerializer) that didn't seem to have been merged properly from Trunk.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@764802 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_0
Jeremias Maerki 15 years ago
parent
commit
45e74b066f

+ 2
- 4
src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java View File

@@ -834,10 +834,8 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer {
* @param url the URI/URL of the image
* @param pos the position of the image
* @param foreignAttributes an optional Map with foreign attributes, may be null
* @param ptr used for accessibility
*/
protected abstract void drawImage(String url, Rectangle2D pos, Map foreignAttributes,
String ptr);
protected abstract void drawImage(String url, Rectangle2D pos, Map foreignAttributes);

/**
* Draw an image at the indicated location.
@@ -845,7 +843,7 @@ public abstract class AbstractPathOrientedRenderer extends PrintRenderer {
* @param pos the position of the image
*/
protected final void drawImage(String url, Rectangle2D pos) {
drawImage(url, pos, null, "");
drawImage(url, pos, null);
}

/**

+ 4
- 8
src/java/org/apache/fop/render/AbstractRenderer.java View File

@@ -738,13 +738,11 @@ public abstract class AbstractRenderer
currentBPPosition += viewport.getOffset();
Rectangle2D contpos = viewport.getContentPosition();
if (content instanceof Image) {
String ptr = (String) viewport.getTrait(Trait.PTR);
renderImage((Image) content, contpos, ptr);
renderImage((Image) content, contpos);
} else if (content instanceof Container) {
renderContainer((Container) content);
} else if (content instanceof ForeignObject) {
String ptr = (String) viewport.getTrait(Trait.PTR);
renderForeignObject((ForeignObject) content, contpos, ptr);
renderForeignObject((ForeignObject) content, contpos);
} else if (content instanceof InlineBlockParent) {
renderInlineBlockParent((InlineBlockParent) content);
}
@@ -757,10 +755,9 @@ public abstract class AbstractRenderer
*
* @param image The image
* @param pos The target position of the image
* @param ptr used for accessibility
* (todo) Make renderImage() protected
*/
public void renderImage(Image image, Rectangle2D pos, String ptr) {
public void renderImage(Image image, Rectangle2D pos) {
// Default: do nothing.
// Some renderers (ex. Text) don't support images.
}
@@ -784,10 +781,9 @@ public abstract class AbstractRenderer
*
* @param fo The foreign object area
* @param pos The target position of the foreign object
* @param ptr used for accessibility
* (todo) Make renderForeignObject() protected
*/
protected void renderForeignObject(ForeignObject fo, Rectangle2D pos, String ptr) {
protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
// Default: do nothing.
// Some renderers (ex. Text) don't support foreign objects.
}

+ 3
- 3
src/java/org/apache/fop/render/afp/AFPPainter.java View File

@@ -184,7 +184,7 @@ public class AFPPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
public void drawImage(String uri, Rectangle rect) throws IFException {
String name = documentHandler.getPageSegmentNameFor(uri);
if (name != null) {
float[] srcPts = {rect.x, rect.y};
@@ -196,7 +196,7 @@ public class AFPPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
public void drawImage(Document doc, Rectangle rect) throws IFException {
drawImageUsingDocument(doc, rect);
}

@@ -313,7 +313,7 @@ public class AFPPainter extends AbstractIFPainter {
/** {@inheritDoc} */
public void drawText(int x, int y,
final int letterSpacing, final int wordSpacing, final int[] dx,
final String text, final String ptr) throws IFException {
final String text) throws IFException {
final int fontSize = this.state.getFontSize();
getPaintingState().setFontSize(fontSize);


+ 2
- 2
src/java/org/apache/fop/render/afp/AFPRenderer.java View File

@@ -395,7 +395,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust
ImageFlavor.GRAPHICS2D, ImageFlavor.BUFFERED_IMAGE, ImageFlavor.RENDERED_IMAGE };

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, String ptr) {
public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
uri = URISpecification.getURL(uri);
paintingState.setImageUri(uri);

@@ -526,7 +526,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust

/** {@inheritDoc} */
public void renderImage(Image image, Rectangle2D pos) {
drawImage(image.getURL(), pos, image.getForeignAttributes(),"");
drawImage(image.getURL(), pos, image.getForeignAttributes());
}

/** {@inheritDoc} */

+ 18
- 0
src/java/org/apache/fop/render/intermediate/IFContext.java View File

@@ -43,6 +43,8 @@ public class IFContext {
/** foreign attributes: Map<QName, Object> */
private Map foreignAttributes = Collections.EMPTY_MAP;

private String structurePointer;

/**
* Main constructor.
* @param ua the user agent
@@ -108,4 +110,20 @@ public class IFContext {
setForeignAttributes(null);
}

public void setStructurePointer(String ptr) {
this.structurePointer = ptr;
}

public void resetStructurePointer() {
setStructurePointer(null);
}

public String getStructurePointer() {
return this.structurePointer;
}

public boolean hasStructurePointer() {
return (this.structurePointer != null) && (structurePointer.length() > 0);
}

}

+ 3
- 6
src/java/org/apache/fop/render/intermediate/IFPainter.java View File

@@ -153,11 +153,10 @@ public interface IFPainter {
* @param wordSpacing additional spacing between words (may be 0)
* @param dx an array of adjustment values for each character in X-direction (may be null)
* @param text the text
* @param ptr used for accessibility
* @throws IFException if an error occurs while handling this event
*/
void drawText(int x, int y, int letterSpacing, int wordSpacing,
int[] dx, String text, String ptr) throws IFException;
int[] dx, String text) throws IFException;

/**
* Restricts the current clipping region with the given rectangle.
@@ -206,20 +205,18 @@ public interface IFPainter {
* an fo:external-graphic in XSL-FO.
* @param uri the image's URI
* @param rect the rectangle in which the image shall be painted
* @param ptr used for accessibility
* @throws IFException if an error occurs while handling this event
*/
void drawImage(String uri, Rectangle rect, String ptr) throws IFException;
void drawImage(String uri, Rectangle rect) throws IFException;

/**
* Draws an image (represented by a DOM document) inside a given rectangle. This is the
* equivalent to an fo:instream-foreign-object in XSL-FO.
* @param doc the DOM document containing the foreign object
* @param rect the rectangle in which the image shall be painted
* @param ptr used for accessibility
* @throws IFException if an error occurs while handling this event
*/
void drawImage(Document doc, Rectangle rect, String ptr) throws IFException;
void drawImage(Document doc, Rectangle rect) throws IFException;
//Note: For now, all foreign objects are handled as DOM documents. At the moment, all known
//implementations use a DOM anyway, so optimizing this to work with SAX wouldn't result in
//any performance benefits. The IFRenderer itself has a DOM anyway. Only the IFParser could

+ 15
- 3
src/java/org/apache/fop/render/intermediate/IFParser.java View File

@@ -173,6 +173,14 @@ public class IFParser implements IFConstants {
documentHandler.getContext().resetForeignAttributes();
}

private void establishStructurePointer(String ptr) {
documentHandler.getContext().setStructurePointer(ptr);
}

private void resetStructurePointer() {
documentHandler.getContext().resetStructurePointer();
}

/** {@inheritDoc} */
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
@@ -482,7 +490,9 @@ public class IFParser implements IFConstants {
int wordSpacing = (s != null ? Integer.parseInt(s) : 0);
int[] dx = XMLUtil.getAttributeAsIntArray(lastAttributes, "dx");
String ptr = lastAttributes.getValue("ptr"); // used for accessibility
painter.drawText(x, y, letterSpacing, wordSpacing, dx, content.toString(), ptr);
establishStructurePointer(ptr);
painter.drawText(x, y, letterSpacing, wordSpacing, dx, content.toString());
resetStructurePointer();
}

public boolean ignoreCharacters() {
@@ -578,9 +588,10 @@ public class IFParser implements IFConstants {
Map foreignAttributes = getForeignAttributes(lastAttributes);
establishForeignAttributes(foreignAttributes);
String ptr = lastAttributes.getValue("ptr"); // used for accessibility
establishStructurePointer(ptr);
if (foreignObject != null) {
painter.drawImage(foreignObject,
new Rectangle(x, y, width, height), ptr);
new Rectangle(x, y, width, height));
foreignObject = null;
} else {
String uri = lastAttributes.getValue(
@@ -588,9 +599,10 @@ public class IFParser implements IFConstants {
if (uri == null) {
throw new IFException("xlink:href is missing on image", null);
}
painter.drawImage(uri, new Rectangle(x, y, width, height), ptr);
painter.drawImage(uri, new Rectangle(x, y, width, height));
}
resetForeignAttributes();
resetStructurePointer();
inForeignObject = false;
}


+ 38
- 26
src/java/org/apache/fop/render/intermediate/IFRenderer.java View File

@@ -53,6 +53,7 @@ import org.apache.fop.Version;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.area.Area;
import org.apache.fop.area.AreaTreeObject;
import org.apache.fop.area.Block;
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.BookmarkData;
@@ -500,7 +501,10 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
documentHandler.endDocumentHeader();
this.inPageSequence = true;
}
establishForeignAttributes(pageSequence.getForeignAttributes());
documentHandler.startPageSequence(null);
resetForeignAttributes();
processExtensionAttachments(pageSequence);
} catch (IFException e) {
handleIFException(e);
}
@@ -557,13 +561,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
documentHandler.startPageHeader();

//Add page attachments to page header
if (page.hasExtensionAttachments()) {
for (Iterator iter = page.getExtensionAttachments().iterator();
iter.hasNext();) {
ExtensionAttachment attachment = (ExtensionAttachment) iter.next();
this.documentHandler.handleExtensionObject(attachment);
}
}
processExtensionAttachments(page);

documentHandler.endPageHeader();
this.painter = documentHandler.startPageContent();
@@ -590,6 +588,16 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
}
}

private void processExtensionAttachments(AreaTreeObject area) throws IFException {
if (area.hasExtensionAttachments()) {
for (Iterator iter = area.getExtensionAttachments().iterator();
iter.hasNext();) {
ExtensionAttachment attachment = (ExtensionAttachment) iter.next();
this.documentHandler.handleExtensionObject(attachment);
}
}
}

private void establishForeignAttributes(Map foreignAttributes) {
documentHandler.getContext().setForeignAttributes(foreignAttributes);
}
@@ -598,6 +606,14 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
documentHandler.getContext().resetForeignAttributes();
}

private void establishStructurePointer(String ptr) {
documentHandler.getContext().setStructurePointer(ptr);
}

private void resetStructurePointer() {
documentHandler.getContext().resetStructurePointer();
}

/** {@inheritDoc} */
protected void saveGraphicsState() {
graphicContextStack.push(graphicContext);
@@ -818,17 +834,20 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
currentIPPosition = saveIP;
currentBPPosition = saveBP;

currentBPPosition += (bv.getAllocBPD());
currentBPPosition += bv.getAllocBPD();
}
viewportDimensionStack.pop();
}

/** {@inheritDoc} */
public void renderViewport(Viewport viewport) {
String ptr = (String) viewport.getTrait(Trait.PTR);
establishStructurePointer(ptr);
Dimension dim = new Dimension(viewport.getIPD(), viewport.getBPD());
viewportDimensionStack.push(dim);
super.renderViewport(viewport);
viewportDimensionStack.pop();
resetStructurePointer();
}

/** {@inheritDoc} */
@@ -966,6 +985,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
String fontName = getInternalFontNameForArea(text);
int size = ((Integer) text.getTrait(Trait.FONT_SIZE)).intValue();
String ptr = (String)text.getTrait(Trait.PTR); // used for accessibility
establishStructurePointer(ptr);

// This assumes that *all* CIDFonts use a /ToUnicode mapping
Typeface tf = getTypeface(fontName);
@@ -984,9 +1004,10 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
textUtil.setStartPosition(rx, bl);
textUtil.setSpacing(text.getTextLetterSpaceAdjust(), text.getTextWordSpaceAdjust());
super.renderText(text);
textUtil.setPtr(ptr); // used for accessibility
textUtil.flush();
renderTextDecoration(tf, size, text, bl, rx);
resetStructurePointer();
}

/** {@inheritDoc} */
@@ -1061,20 +1082,11 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
private int startx, starty;
private int tls, tws;
private final boolean combined = false;
private String ptr = null; // used for accessibility

void addChar(char ch) {
text.append(ch);
}

/**
* used for accessibility
* @param inPtr to be stored
*/
public void setPtr(String inPtr) {
ptr = inPtr;
}

void adjust(int adjust) {
if (adjust != 0) {
int idx = text.length();
@@ -1117,9 +1129,9 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
System.arraycopy(dx, 0, effDX, 0, size);
}
if (combined) {
painter.drawText(startx, starty, 0, 0, effDX, text.toString(), ptr);
painter.drawText(startx, starty, 0, 0, effDX, text.toString());
} else {
painter.drawText(startx, starty, tls, tws, effDX, text.toString(), ptr);
painter.drawText(startx, starty, tls, tws, effDX, text.toString());
}
} catch (IFException e) {
handleIFException(e);
@@ -1130,12 +1142,12 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
}

/** {@inheritDoc} */
public void renderImage(Image image, Rectangle2D pos, String ptr) {
drawImage(image.getURL(), pos, image.getForeignAttributes(), ptr);
public void renderImage(Image image, Rectangle2D pos) {
drawImage(image.getURL(), pos, image.getForeignAttributes());
}

/** {@inheritDoc} */
protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, String ptr) {
protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
Rectangle posInt = new Rectangle(
currentIPPosition + (int)pos.getX(),
currentBPPosition + (int)pos.getY(),
@@ -1144,7 +1156,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
uri = URISpecification.getURL(uri);
try {
establishForeignAttributes(foreignAttributes);
painter.drawImage(uri, posInt, ptr);
painter.drawImage(uri, posInt);
resetForeignAttributes();
} catch (IFException ife) {
handleIFException(ife);
@@ -1152,7 +1164,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
}

/** {@inheritDoc} */
public void renderForeignObject(ForeignObject fo, Rectangle2D pos, String ptr) {
public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
endTextObject();
Rectangle posInt = new Rectangle(
currentIPPosition + (int)pos.getX(),
@@ -1162,7 +1174,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
Document doc = fo.getDocument();
try {
establishForeignAttributes(fo.getForeignAttributes());
painter.drawImage(doc, posInt, ptr);
painter.drawImage(doc, posInt);
resetForeignAttributes();
} catch (IFException ife) {
handleIFException(ife);

+ 7
- 4
src/java/org/apache/fop/render/intermediate/IFSerializer.java View File

@@ -267,7 +267,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
if (id != null) {
atts.addAttribute(XML_NAMESPACE, "id", "xml:id", XMLUtil.CDATA, id);
}
addForeignAttributes(atts);
handler.startElement(EL_PAGE_SEQUENCE, atts);
if (this.getUserAgent().isAccessibilityEnabled()) {
if (doc == null) {
@@ -463,7 +463,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
public void drawImage(String uri, Rectangle rect) throws IFException {
try {
AttributesImpl atts = new AttributesImpl();
addAttribute(atts, XLINK_HREF, uri);
@@ -472,6 +472,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
addForeignAttributes(atts);
String ptr = getContext().getStructurePointer();
if (ptr != null) {
addAttribute(atts, "ptr", ptr); // used for accessibility
}
@@ -493,7 +494,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
}

/** {@inheritDoc} */
public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
public void drawImage(Document doc, Rectangle rect) throws IFException {
try {
AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x", Integer.toString(rect.x));
@@ -501,6 +502,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
addForeignAttributes(atts);
String ptr = getContext().getStructurePointer();
if (ptr != null) {
addAttribute(atts, "ptr", ptr); // used for accessibility
}
@@ -602,7 +604,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler

/** {@inheritDoc} */
public void drawText(int x, int y, int letterSpacing, int wordSpacing,
int[] dx, String text, String ptr) throws IFException {
int[] dx, String text) throws IFException {
try {
AttributesImpl atts = new AttributesImpl();
XMLUtil.addAttribute(atts, XMLConstants.XML_SPACE, "preserve");
@@ -617,6 +619,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
if (dx != null) {
addAttribute(atts, "dx", IFUtil.toString(dx));
}
String ptr = getContext().getStructurePointer();
if (ptr != null) {
addAttribute(atts, "ptr", ptr); // used for accessibility
}

+ 3
- 3
src/java/org/apache/fop/render/java2d/Java2DPainter.java View File

@@ -156,7 +156,7 @@ public class Java2DPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
public void drawImage(String uri, Rectangle rect) throws IFException {
drawImageUsingURI(uri, rect);
}

@@ -168,7 +168,7 @@ public class Java2DPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
public void drawImage(Document doc, Rectangle rect) throws IFException {
drawImageUsingDocument(doc, rect);
}

@@ -208,7 +208,7 @@ public class Java2DPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String text, String ptr)
public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String text)
throws IFException {
g2dState.updateColor(state.getTextColor());
FontTriplet triplet = new FontTriplet(

+ 1
- 1
src/java/org/apache/fop/render/java2d/Java2DRenderer.java View File

@@ -875,7 +875,7 @@ public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implem
ImageFlavor.XML_DOM};

/** {@inheritDoc} */
protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, String ptr) {
protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {

int x = currentIPPosition + (int)Math.round(pos.getX());
int y = currentBPPosition + (int)Math.round(pos.getY());

+ 4
- 5
src/java/org/apache/fop/render/pcl/PCLPainter.java View File

@@ -154,7 +154,7 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
}

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
public void drawImage(String uri, Rectangle rect) throws IFException {
drawImageUsingURI(uri, rect);
}

@@ -176,7 +176,7 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
}

/** {@inheritDoc} */
public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
public void drawImage(Document doc, Rectangle rect) throws IFException {
drawImageUsingDocument(doc, rect);
}

@@ -312,9 +312,8 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
}

/** {@inheritDoc} */
public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String text, String ptr)
public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String text)
throws IFException {
//Note: ptr is ignored as it is only needed for accessibility
try {
FontTriplet triplet = new FontTriplet(
state.getFontFamily(), state.getFontStyle(), state.getFontWeight());
@@ -475,7 +474,7 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
Java2DPainter painter = new Java2DPainter(g2d,
getContext(), parent.getFontInfo(), state);
try {
painter.drawText(x, y, letterSpacing, wordSpacing, dx, text, "");
painter.drawText(x, y, letterSpacing, wordSpacing, dx, text);
} catch (IFException e) {
//This should never happen with the Java2DPainter
throw new RuntimeException("Unexpected error while painting text", e);

+ 11
- 7
src/java/org/apache/fop/render/pdf/PDFPainter.java View File

@@ -129,11 +129,12 @@ public class PDFPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle rect, String ptr)
public void drawImage(String uri, Rectangle rect)
throws IFException {
PDFXObject xobject = getPDFDoc().getXObject(uri);
if (xobject != null) {
if (accessEnabled && ptr.length() > 0) {
if (accessEnabled && getContext().hasStructurePointer()) {
String ptr = getContext().getStructurePointer();
mcid = this.documentHandler.getMCID();
mcid++; // fix for Acro Checker
this.documentHandler.incMCID(); // simulating a parent text element
@@ -152,7 +153,8 @@ public class PDFPainter extends AbstractIFPainter {
}
return;
}
if (accessEnabled && ptr.length() > 0) {
if (accessEnabled && getContext().hasStructurePointer()) {
String ptr = getContext().getStructurePointer();
mcid = this.documentHandler.getMCID();
mcid++; // fix for Acro Checker
this.documentHandler.incMCID(); // simulating a parent text element
@@ -221,8 +223,9 @@ public class PDFPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
if (accessEnabled && ptr.length() > 0) {
public void drawImage(Document doc, Rectangle rect) throws IFException {
if (accessEnabled && getContext().hasStructurePointer()) {
String ptr = getContext().getStructurePointer();
mcid = this.documentHandler.getMCID();
mcid++; // fix for Acro Checker
this.documentHandler.incMCID(); // simulating a parent text element
@@ -330,9 +333,10 @@ public class PDFPainter extends AbstractIFPainter {

/** {@inheritDoc} */
public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx,
String text, String ptr)
String text)
throws IFException {
if (accessEnabled ) {
if (accessEnabled) {
String ptr = getContext().getStructurePointer();
int mcId;
String structElType = "";
if (ptr != null && ptr.length() > 0) {

+ 1
- 1
src/java/org/apache/fop/render/pdf/PDFRenderer.java View File

@@ -1074,7 +1074,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer implements PDFConf
}

/** {@inheritDoc} */
protected void drawImage(String url, Rectangle2D pos, Map foreignAttributes, String ptr) {
protected void drawImage(String url, Rectangle2D pos, Map foreignAttributes) {
endTextObject();
putImage(url, pos, foreignAttributes);
}

+ 3
- 3
src/java/org/apache/fop/render/ps/PSPainter.java View File

@@ -176,7 +176,7 @@ public class PSPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
public void drawImage(String uri, Rectangle rect) throws IFException {
try {
endTextObject();
} catch (IOException ioe) {
@@ -186,7 +186,7 @@ public class PSPainter extends AbstractIFPainter {
}

/** {@inheritDoc} */
public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
public void drawImage(Document doc, Rectangle rect) throws IFException {
try {
endTextObject();
} catch (IOException ioe) {
@@ -338,7 +338,7 @@ public class PSPainter extends AbstractIFPainter {

/** {@inheritDoc} */
public void drawText(int x, int y, int letterSpacing, int wordSpacing,
int[] dx, String text, String ptr) throws IFException {
int[] dx, String text) throws IFException {
try {
//Note: dy is currently ignored
PSGenerator generator = getGenerator();

+ 2
- 2
src/java/org/apache/fop/render/ps/PSRenderer.java View File

@@ -345,7 +345,7 @@ public class PSRenderer extends AbstractPathOrientedRenderer
}

/** {@inheritDoc} */
protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes, String ptr) {
protected void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
endTextObject();
int x = currentIPPosition + (int)Math.round(pos.getX());
int y = currentBPPosition + (int)Math.round(pos.getY());
@@ -1233,7 +1233,7 @@ public class PSRenderer extends AbstractPathOrientedRenderer
* {@inheritDoc}
*/
public void renderImage(Image image, Rectangle2D pos) {
drawImage(image.getURL(), pos, image.getForeignAttributes(), "");
drawImage(image.getURL(), pos, image.getForeignAttributes());
}

/**

+ 3
- 2
src/java/org/apache/fop/render/txt/TXTRenderer.java View File

@@ -28,6 +28,8 @@ import java.io.OutputStream;
import java.util.List;
import java.util.Map;

import org.apache.xmlgraphics.util.UnitConv;

import org.apache.fop.apps.FOPException;
import org.apache.fop.area.Area;
import org.apache.fop.area.CTM;
@@ -37,7 +39,6 @@ import org.apache.fop.area.inline.TextArea;
import org.apache.fop.render.AbstractPathOrientedRenderer;
import org.apache.fop.render.txt.border.AbstractBorderElement;
import org.apache.fop.render.txt.border.BorderManager;
import org.apache.xmlgraphics.util.UnitConv;

/**
* Renderer that renders areas to plain text.
@@ -443,7 +444,7 @@ public class TXTRenderer extends AbstractPathOrientedRenderer {
}

/** {@inheritDoc} */
protected void drawImage(String url, Rectangle2D pos, Map foreignAttributes, String ptr) {
protected void drawImage(String url, Rectangle2D pos, Map foreignAttributes) {
//No images are painted here
}


+ 4
- 5
src/sandbox/org/apache/fop/render/svg/SVGPainter.java View File

@@ -193,7 +193,7 @@ public class SVGPainter extends AbstractIFPainter implements SVGConstants {
}

/** {@inheritDoc} */
public void drawImage(String uri, Rectangle rect, String ptr) throws IFException {
public void drawImage(String uri, Rectangle rect) throws IFException {
try {
establish(MODE_NORMAL);

@@ -243,7 +243,7 @@ public class SVGPainter extends AbstractIFPainter implements SVGConstants {
}

/** {@inheritDoc} */
public void drawImage(Document doc, Rectangle rect, String ptr) throws IFException {
public void drawImage(Document doc, Rectangle rect) throws IFException {
try {
establish(MODE_NORMAL);

@@ -326,9 +326,8 @@ public class SVGPainter extends AbstractIFPainter implements SVGConstants {

/** {@inheritDoc} */

public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx,
String text, String ptr) throws IFException {
//Note: ptr is ignored as it is only needed for accessibility
public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx,
String text) throws IFException {
try {
establish(MODE_TEXT);
AttributesImpl atts = new AttributesImpl();

Loading…
Cancel
Save