From: Vincent Hennebert Date: Thu, 7 Nov 2013 12:31:31 +0000 (+0000) Subject: Added support for dominant-baseline on fo:inline-container X-Git-Tag: fop-2_0~137^2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d08e7a0a304e7f3e3e0d5181bfc00959aa493eee;p=xmlgraphics-fop.git Added support for dominant-baseline on fo:inline-container git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_InlineContainer@1539613 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java b/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java index c1992965c..192956abc 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java +++ b/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java @@ -295,7 +295,7 @@ public class AlignmentContext implements Constants { * Return the dominant baseline identifier. * @return the dominant baseline identifier */ - private int getDominantBaselineIdentifier() { + public int getDominantBaselineIdentifier() { return actualBaselineTable.getDominantBaselineIdentifier(); } diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index b043268bd..21e3cb283 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java @@ -158,7 +158,7 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen ic.getAlignmentAdjust(), ic.getAlignmentBaseline(), ic.getBaselineShift(), ic.getDominantBaseline(), context.getAlignmentContext()); - int baselineOffset = getAlignmentPoint(); + int baselineOffset = getAlignmentPoint(ac.getDominantBaselineIdentifier()); ac.resizeLine(contentAreaBPD, baselineOffset); return ac; } @@ -188,12 +188,13 @@ public class InlineContainerLayoutManager extends AbstractLayoutManager implemen return getInlineContainer().getOverflow() != EN_ERROR_IF_OVERFLOW; } - private int getAlignmentPoint() { + private int getAlignmentPoint(int dominantBaseline) { Length alignmentAdjust = getInlineContainer().getAlignmentAdjust(); int baseline = alignmentAdjust.getEnum(); - if (baseline == Constants.EN_AUTO - || baseline == Constants.EN_BASELINE) { + if (baseline == Constants.EN_AUTO) { return getInlineContainerBaselineOffset(getInlineContainer().getAlignmentBaseline()); + } else if (baseline == Constants.EN_BASELINE) { + return getInlineContainerBaselineOffset(dominantBaseline); } else if (baseline != 0) { return getInlineContainerBaselineOffset(baseline); } else { diff --git a/test/layoutengine/standard-testcases/inline-container_dominant-baseline.xml b/test/layoutengine/standard-testcases/inline-container_dominant-baseline.xml new file mode 100644 index 000000000..402eb806d --- /dev/null +++ b/test/layoutengine/standard-testcases/inline-container_dominant-baseline.xml @@ -0,0 +1,74 @@ + + + + + +

+ Checks that the dominant-baseline property on inline-container behaves properly. +

+
+ + + + + + + + + + + dominant-baseline="alphabetic": + The line before. The line before. Before: + Inside the inline-container. + After the inline-container. + + + + + + dominant-baseline="central": + The line before. The line before. Before: + Inside the inline-container. + After the inline-container. + + + + + + + + + + + + + + + + + + + + + + + +