Index: src/java/org/apache/fop/image/AbstractFopImage.java =================================================================== --- src/java/org/apache/fop/image/AbstractFopImage.java (revision 554189) +++ src/java/org/apache/fop/image/AbstractFopImage.java (working copy) @@ -29,6 +29,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.fop.datatypes.Length; /** * Base class to implement the FopImage interface. @@ -257,6 +258,11 @@ public int getIntrinsicHeight() { return (int)(getHeight() * 72000 / getVerticalResolution()); } + + /** @see org.apache.fop.image.FopImage#getIntrinsicAlignmentAdjust() */ + public Length getIntrinsicAlignmentAdjust() { + return this.imageInfo.alignmentAdjust; + } /** @see org.apache.fop.image.FopImage#getHorizontalResolution() */ public double getHorizontalResolution() { Index: src/java/org/apache/fop/image/FopImage.java =================================================================== --- src/java/org/apache/fop/image/FopImage.java (revision 554189) +++ src/java/org/apache/fop/image/FopImage.java (working copy) @@ -24,6 +24,8 @@ import java.awt.color.ICC_Profile; import java.awt.Color; +import org.apache.fop.datatypes.Length; + /** * Fop image interface for loading images. * @@ -90,6 +92,12 @@ int getIntrinsicHeight(); /** + * @return the intrinsic alignment-adjust value or NULL if the image does + * not have one. + */ + Length getIntrinsicAlignmentAdjust(); + + /** * @return the horizontal bitmap resolution (in dpi) */ double getHorizontalResolution(); @@ -193,6 +201,8 @@ public String mimeType; /** implementation-specific String (ex. the namespace for XML-based images) */ public String str; + /** intrinsic alignment-adjust or null if there is none */ + public Length alignmentAdjust; } } Index: src/java/org/apache/fop/fo/flow/InstreamForeignObject.java =================================================================== --- src/java/org/apache/fop/fo/flow/InstreamForeignObject.java (revision 554189) +++ src/java/org/apache/fop/fo/flow/InstreamForeignObject.java (working copy) @@ -21,6 +21,7 @@ import java.awt.geom.Point2D; import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.ValidationException; import org.apache.fop.fo.XMLObj; @@ -40,6 +41,8 @@ //Additional value private Point2D intrinsicDimensions; + private Length intrinsicAlignmentAdjust; + /** * constructs an instream-foreign-object object (called by Maker). * @@ -98,6 +101,7 @@ log.error("Intrinsic dimensions of " + " instream-foreign-object could not be determined"); } + intrinsicAlignmentAdjust = child.getIntrinsicAlignmentAdjust(); } } @@ -124,6 +128,15 @@ return 0; } } + + /** + * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicAlignmentAdjust() + */ + public Length getIntrinsicAlignmentAdjust() + { + prepareIntrinsicSize(); + return intrinsicAlignmentAdjust; + } /** @see org.apache.fop.fo.FONode#addChildNode(org.apache.fop.fo.FONode) */ protected void addChildNode(FONode child) throws FOPException { Index: src/java/org/apache/fop/fo/flow/AbstractGraphics.java =================================================================== --- src/java/org/apache/fop/fo/flow/AbstractGraphics.java (revision 554189) +++ src/java/org/apache/fop/fo/flow/AbstractGraphics.java (working copy) @@ -236,6 +236,12 @@ * @return the "alignment-adjust" property */ public Length getAlignmentAdjust() { + if (alignmentAdjust.getEnum() == EN_AUTO) { + final Length intrinsicAlignmentAdjust = this.getIntrinsicAlignmentAdjust(); + if (intrinsicAlignmentAdjust != null) { + return intrinsicAlignmentAdjust; + } + } return alignmentAdjust; } @@ -261,12 +267,17 @@ } /** - * @return the graphics intrinsic width + * @return the graphics intrinsic width in millipoints */ public abstract int getIntrinsicWidth(); /** - * @return the graphics intrinsic height + * @return the graphics intrinsic height in millipoints */ public abstract int getIntrinsicHeight(); + + /** + * @return the graphics intrinsic alignment-adjust + */ + public abstract Length getIntrinsicAlignmentAdjust(); } Index: src/java/org/apache/fop/fo/flow/ExternalGraphic.java =================================================================== --- src/java/org/apache/fop/fo/flow/ExternalGraphic.java (revision 554189) +++ src/java/org/apache/fop/fo/flow/ExternalGraphic.java (working copy) @@ -21,6 +21,7 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; @@ -44,6 +45,7 @@ private String url; private int intrinsicWidth; private int intrinsicHeight; + private Length intrinsicAlignmentAdjust; /** * Create a new External graphic node. @@ -75,6 +77,7 @@ } this.intrinsicWidth = fopimage.getIntrinsicWidth(); this.intrinsicHeight = fopimage.getIntrinsicHeight(); + this.intrinsicAlignmentAdjust = fopimage.getIntrinsicAlignmentAdjust(); } //TODO Report to caller so he can decide to throw an exception } @@ -135,5 +138,12 @@ public int getIntrinsicHeight() { return this.intrinsicHeight; } - + + /** + * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicAlignmentAdjust() + */ + public Length getIntrinsicAlignmentAdjust() { + return this.intrinsicAlignmentAdjust; + } + } Index: src/java/org/apache/fop/fo/XMLObj.java =================================================================== --- src/java/org/apache/fop/fo/XMLObj.java (revision 554189) +++ src/java/org/apache/fop/fo/XMLObj.java (working copy) @@ -27,6 +27,7 @@ import org.apache.batik.dom.util.XMLSupport; import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.Length; import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -94,6 +95,14 @@ public Point2D getDimension(Point2D view) { return null; } + + /** + * Retrieve the intrinsic alignment-adjust of the child element. + * @return the intrinsic alignment-adjust. + */ + public Length getIntrinsicAlignmentAdjust() { + return null; + } /** @see org.apache.fop.fo.FONode#getLocalName() */ public String getLocalName() {