Index: src/java/org/apache/fop/image/AbstractFopImage.java =================================================================== --- src/java/org/apache/fop/image/AbstractFopImage.java (revision 552142) +++ src/java/org/apache/fop/image/AbstractFopImage.java (working copy) @@ -258,6 +258,12 @@ return (int)(getHeight() * 72000 / getVerticalResolution()); } + /** @see org.apache.fop.image.FopImage#getIntrinsicBaselineShift() */ + public int getIntrinsicBaselineShift() { + return this.imageInfo.baselineShift; + } + + /** @see org.apache.fop.image.FopImage#getHorizontalResolution() */ public double getHorizontalResolution() { return this.dpiHorizontal; Index: src/java/org/apache/fop/image/FopImage.java =================================================================== --- src/java/org/apache/fop/image/FopImage.java (revision 552142) +++ src/java/org/apache/fop/image/FopImage.java (working copy) @@ -88,6 +88,11 @@ * @return the intrinsic image width (in millipoints) */ int getIntrinsicHeight(); + + /** + * @return the intrinsic baseline-shift (in millipoints) + */ + int getIntrinsicBaselineShift(); /** * @return the horizontal bitmap resolution (in dpi) @@ -193,6 +198,8 @@ public String mimeType; /** implementation-specific String (ex. the namespace for XML-based images) */ public String str; + /** baselineShift in millipoints */ + public int baselineShift = 0; } } Index: src/java/org/apache/fop/fo/flow/InstreamForeignObject.java =================================================================== --- src/java/org/apache/fop/fo/flow/InstreamForeignObject.java (revision 552142) +++ src/java/org/apache/fop/fo/flow/InstreamForeignObject.java (working copy) @@ -40,6 +40,8 @@ //Additional value private Point2D intrinsicDimensions; + private float intrinsicBaselineShift; + /** * constructs an instream-foreign-object object (called by Maker). * @@ -105,6 +107,7 @@ log.error("Intrinsic dimensions of " + " instream-foreign-object could not be determined"); } + intrinsicBaselineShift = child.getBaselineShift(); } } @@ -132,6 +135,15 @@ } } + /** + * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicBaselineShift() + */ + public int getIntrinsicBaselineShift() { + prepareIntrinsicSize(); + return (int)(intrinsicBaselineShift * 1000); + } + + /** @see org.apache.fop.fo.FONode#addChildNode(org.apache.fop.fo.FONode) */ protected void addChildNode(FONode child) throws FOPException { super.addChildNode(child); Index: src/java/org/apache/fop/fo/flow/AbstractGraphics.java =================================================================== --- src/java/org/apache/fop/fo/flow/AbstractGraphics.java (revision 552142) +++ src/java/org/apache/fop/fo/flow/AbstractGraphics.java (working copy) @@ -29,6 +29,7 @@ import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.FixedLength; import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.fo.properties.SpaceProperty; @@ -250,7 +251,8 @@ * @return the "baseline-shift" property */ public Length getBaselineShift() { - return baselineShift; + return new FixedLength(baselineShift.getValue() + - getIntrinsicBaselineShift()); } /** @@ -261,12 +263,21 @@ } /** - * @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(); + + /** + * retrieve the baseline-shift for this graphic in millipoints. + *

+ * It should probably be 0 < baseline-shift < height. + * + * @return the graphics baseline shift. + */ + public abstract int getIntrinsicBaselineShift(); } Index: src/java/org/apache/fop/fo/flow/ExternalGraphic.java =================================================================== --- src/java/org/apache/fop/fo/flow/ExternalGraphic.java (revision 552142) +++ src/java/org/apache/fop/fo/flow/ExternalGraphic.java (working copy) @@ -44,6 +44,7 @@ private String url; private int intrinsicWidth; private int intrinsicHeight; + private int intrinsicBaselineShift; /** * Create a new External graphic node. @@ -75,6 +76,7 @@ } this.intrinsicWidth = fopimage.getIntrinsicWidth(); this.intrinsicHeight = fopimage.getIntrinsicHeight(); + this.intrinsicBaselineShift = fopimage.getIntrinsicBaselineShift(); } //TODO Report to caller so he can decide to throw an exception } @@ -136,4 +138,10 @@ return this.intrinsicHeight; } + /** + * @see org.apache.fop.fo.flow.AbstractGraphics#getIntrinsicBaselineShift() + */ + public int getIntrinsicBaselineShift() { + return this.intrinsicBaselineShift; + } } Index: src/java/org/apache/fop/fo/XMLObj.java =================================================================== --- src/java/org/apache/fop/fo/XMLObj.java (revision 552142) +++ src/java/org/apache/fop/fo/XMLObj.java (working copy) @@ -94,6 +94,14 @@ public Point2D getDimension(Point2D view) { return null; } + + /** + * Retrieve the baseline-shift of the ares in pts. + * @return the baseline shift. + */ + public float getBaselineShift() { + return 0.0f; + } /** @see org.apache.fop.fo.FONode#getLocalName() */ public String getLocalName() {